Use typeof x == 'undefined' checks instead of x === undefined for consistency with other typeof checks.

Former-commit-id: 8ab7d3efe54aa7017b52295b0598b75c297a6277
This commit is contained in:
John-David Dalton
2012-11-26 09:24:51 -06:00
parent 221e0e550c
commit f9768cb5a3
4 changed files with 54 additions and 55 deletions

View File

@@ -29,8 +29,7 @@
'result',
'skipProto',
'source',
'thisArg',
'undefined'
'thisArg'
];
/** Used to minify `compileIterator` option properties */
@@ -342,8 +341,8 @@
// ensure properties in compiled strings aren't minified
modified = modified.replace(RegExp('([^.]\\b)' + variable + '\\b(?!\' *[\\]:])', 'g'), '$1' + minNames[index]);
// correct `typeof` of 'object' and 'undefined'
if (variable == 'object' || variable == 'undefined') {
// correct `typeof` values
if (/^(?:boolean|function|object|number|string|undefined)$/.test(variable)) {
modified = modified.replace(RegExp("(typeof [^']+')" + minNames[index] + "'", 'g'), '$1' + variable + "'");
}
});