aboutsummaryrefslogtreecommitdiff
path: root/pattern_utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'pattern_utils.js')
-rw-r--r--pattern_utils.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/pattern_utils.js b/pattern_utils.js
index ef1e304..7ab143b 100644
--- a/pattern_utils.js
+++ b/pattern_utils.js
@@ -31,10 +31,18 @@ exports.patternUtils = {
removeNonalpha: function(str) {
return str.replace(/[^a-z0-9<>@]+/gi, '');
},
+
removeWhitespace: function(str) {
return str.replace(/\/\//gmi, '').replace(/\*/gmi, '').replace(/\s+/gmi, '');
},
+
replaceTokens: function(str) {
return str.replace(/<.*?>/gi, '.*?');
+ },
+
+ removeJsComments: function(str) {
+ const ml_comments = /\/\*.*?(\*\/)/g;
+ const il_comments = /\/\/.*/gm;
+ return str.replace(ml_comments, '').replace(il_comments, '');
}
};