mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Ensure the second argument passed to _.assign is not treated as a callback. [closes #184]
Former-commit-id: 1254e11ab02d1d5055c08400cd0a4786ed71aef2
This commit is contained in:
20
lodash.js
20
lodash.js
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user