Ensure _.merge doesn't iterate over a passed callback arg.

Former-commit-id: 2ed55922c2f5b4e47ac7e9763f3d76b4bec142da
This commit is contained in:
John-David Dalton
2013-02-06 00:38:28 -08:00
parent 5787436177
commit d2ba0d4e7a
5 changed files with 83 additions and 79 deletions

View File

@@ -1901,9 +1901,11 @@
// using their `callback` arguments, `index|key` and `collection`
if (typeof deepIndicator != 'number') {
length = args.length;
callback = typeof (callback = args[length - 2]) == 'function'
? createCallback(callback, args[--length], 2)
: (typeof (callback = args[length - 1]) == 'function' && callback);
if (typeof args[length - 2] == 'function') {
callback = createCallback(args[--length - 1], args[length--], 2);
} else if (typeof args[length - 1] == 'function') {
callback = args[--length];
}
}
}
while (++index < length) {