Ensure _.difference works with arrays regardless of arg position.

This commit is contained in:
John-David Dalton
2014-04-16 08:39:12 -07:00
parent c331d12678
commit 0e828e5b3b

View File

@@ -2388,7 +2388,16 @@
* // => [1, 3]
*/
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));
}
/**