Avoid incorrectly converting local variables to boolean values.

Former-commit-id: 322f6dec4c669bdc1ef534f7786cf12aee580e53
This commit is contained in:
John-David Dalton
2013-05-27 15:31:41 -07:00
parent be52c181ea
commit 96e47f3d27
4 changed files with 12 additions and 7 deletions

View File

@@ -2221,7 +2221,7 @@
}
return match.replace(/^(( *)if *\(.*?\bisArray\([^\)]+\).*?\) *{\n)(( *)var index[^;]+.+\n+)/m, function(snippet, statement, indent, vars) {
vars = vars
.replace(/\b(length *=)[^;]+/, '$1 collection' + (methodName == 'reduce' ? '.length' : ' ? collection.length : 0'))
.replace(/\b(length *=)[^;=]+/, '$1 collection' + (methodName == 'reduce' ? '.length' : ' ? collection.length : 0'))
.replace(RegExp('^ ' + indent, 'gm'), indent);
return vars + statement.replace(/\bisArray\([^\)]+\)/, "typeof length == 'number'");
@@ -3263,7 +3263,7 @@
modified = modified
.replace(/\bctor *=.+\s+/, '')
.replace(/^ *ctor\.prototype.+\s+.+\n/m, '')
.replace(/(?:,\n)? *props *=[^;]+/, '')
.replace(/(?:,\n)? *props *=[^;=]+/, '')
.replace(/^ *for *\((?=prop)/, '$&var ')
}
if (!/support\.nonEnumArgs *=(?! *(?:false|true))/.test(match)) {