Ensure _.clone, _.flatten, and _.uniq can be used as a callback for methods like _.map. [closes #270]

Former-commit-id: fb62b5bbdad844cb04c3259c323e27fb81932809
This commit is contained in:
John-David Dalton
2013-05-14 00:49:31 -07:00
parent b72b0d60cb
commit 4b3009a195
2 changed files with 19 additions and 5 deletions

View File

@@ -1178,7 +1178,7 @@
// allows working with "Collections" methods without using their `callback`
// argument, `index|key`, for this method's `callback`
if (typeof deep == 'function') {
if (typeof deep != 'boolean' && deep != null) {
thisArg = callback;
callback = deep;
deep = false;
@@ -3529,7 +3529,7 @@
// juggle arguments
if (typeof isShallow != 'boolean' && isShallow != null) {
thisArg = callback;
callback = isShallow;
callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined;
isShallow = false;
}
if (callback != null) {
@@ -4090,7 +4090,7 @@
// juggle arguments
if (typeof isSorted != 'boolean' && isSorted != null) {
thisArg = callback;
callback = isSorted;
callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined;
isSorted = false;
}
// init value cache for large arrays