aboutsummaryrefslogtreecommitdiff
path: root/lib/propmangle.js
diff options
context:
space:
mode:
authorJoao Carlos <mail@joao-carlos.com>2015-06-09 13:21:22 +0300
committerJoao Carlos <mail@joao-carlos.com>2015-06-09 14:16:50 +0300
commit0ac6918a411c85304dc716cd6de68b293a0d133a (patch)
tree2188e9d794c1eb316ce6bb88ff6ad003900e6fb6 /lib/propmangle.js
parentc6fa2915715f0a1a2b1527c23388bd7de56284c4 (diff)
downloadtracifyjs-0ac6918a411c85304dc716cd6de68b293a0d133a.tar.gz
tracifyjs-0ac6918a411c85304dc716cd6de68b293a0d133a.zip
Add --mangle-regex option
Diffstat (limited to 'lib/propmangle.js')
-rw-r--r--lib/propmangle.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/propmangle.js b/lib/propmangle.js
index 0890eaa7..086709e6 100644
--- a/lib/propmangle.js
+++ b/lib/propmangle.js
@@ -64,7 +64,8 @@ function mangle_properties(ast, options) {
options = defaults(options, {
reserved : null,
cache : null,
- only_cache : false
+ only_cache : false,
+ regex : null
});
var reserved = options.reserved;
@@ -79,6 +80,8 @@ function mangle_properties(ast, options) {
};
}
+ var regex = options.regex;
+
var names_to_mangle = [];
// step 1: find candidates to mangle
@@ -149,6 +152,7 @@ function mangle_properties(ast, options) {
}
function should_mangle(name) {
+ if (regex && !regex.test(name)) return false;
if (reserved.indexOf(name) >= 0) return false;
return cache.props.has(name)
|| names_to_mangle.indexOf(name) >= 0;