diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-04-04 03:50:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-04 03:50:19 +0800 |
commit | 951770fc689c3f69679c390d31bc9f728f3e8bda (patch) | |
tree | 6fde3440ac1af4c99d025e046a1dd1af6a078974 /lib | |
parent | 48b3fe99524e1e85edd30f0a326c2f1136e150e4 (diff) | |
download | tracifyjs-951770fc689c3f69679c390d31bc9f728f3e8bda.tar.gz tracifyjs-951770fc689c3f69679c390d31bc9f728f3e8bda.zip |
exclude mangling of special property names (#1779)
- `null`
- `true`
- `false`
- numeric literals
Diffstat (limited to 'lib')
-rw-r--r-- | lib/propmangle.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/propmangle.js b/lib/propmangle.js index 4e43bb63..b6222990 100644 --- a/lib/propmangle.js +++ b/lib/propmangle.js @@ -46,6 +46,9 @@ function find_builtins() { // NaN will be included due to Number.NaN var a = [ + "null", + "true", + "false", "Infinity", "-Infinity", "undefined", @@ -159,7 +162,7 @@ function mangle_properties(ast, options) { if (options.only_cache) { return cache.props.has(name); } - if (/^[0-9.]+$/.test(name)) return false; + if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false; return true; } |