From 951770fc689c3f69679c390d31bc9f728f3e8bda Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 4 Apr 2017 03:50:19 +0800 Subject: exclude mangling of special property names (#1779) - `null` - `true` - `false` - numeric literals --- lib/propmangle.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') 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; } -- cgit v1.2.3