Ensure the second argument passed to _.assign is not treated as a callback. [closes #184]

Former-commit-id: 1254e11ab02d1d5055c08400cd0a4786ed71aef2
This commit is contained in:
John-David Dalton
2013-02-15 08:11:19 -08:00
parent 7ea7a6cbb1
commit 02687f3c78
6 changed files with 32 additions and 41 deletions

View File

@@ -1060,12 +1060,10 @@
'top':
defaultsIteratorOptions.top.replace(';',
';\n' +
'if (argsLength > 2) {\n' +
" if (typeof args[argsLength - 2] == 'function') {\n" +
' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
" } else if (typeof args[argsLength - 1] == 'function') {\n" +
' callback = args[--argsLength];\n' +
' }\n' +
"if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
"} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
' callback = args[--argsLength];\n' +
'}'
),
'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
@@ -1922,12 +1920,10 @@
if (typeof deepIndicator != 'number') {
length = args.length;
}
if (length > 2) {
if (typeof args[length - 2] == 'function') {
callback = createCallback(args[--length - 1], args[length--], 2);
} else if (typeof args[length - 1] == 'function') {
callback = args[--length];
}
if (length > 3 && typeof args[length - 2] == 'function') {
callback = createCallback(args[--length - 1], args[length--], 2);
} else if (length > 2 && typeof args[length - 1] == 'function') {
callback = args[--length];
}
}
while (++index < length) {