Add --mangle-regex option
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user