mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Ensure _.difference works with arrays regardless of arg position.
This commit is contained in:
11
lodash.js
11
lodash.js
@@ -2388,7 +2388,16 @@
|
|||||||
* // => [1, 3]
|
* // => [1, 3]
|
||||||
*/
|
*/
|
||||||
function difference() {
|
function difference() {
|
||||||
return baseDifference(arguments[0], baseFlatten(arguments, true, true, 1));
|
var index = -1,
|
||||||
|
length = arguments.length;
|
||||||
|
|
||||||
|
while (++index < length) {
|
||||||
|
var value = arguments[index];
|
||||||
|
if (isArray(value) || isArguments(value)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return baseDifference(arguments[index], baseFlatten(arguments, true, true, ++index));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user