Cleanup _.xor patch and add a unit test.

This commit is contained in:
John-David Dalton
2013-12-06 20:34:59 -08:00
parent 64fc924357
commit 51698944e0
9 changed files with 92 additions and 81 deletions

View File

@@ -5436,14 +5436,15 @@
* // => [1, 4, 5]
*/
function xor() {
var result,
index = -1,
var index = -1,
length = arguments.length;
while (++index < length) {
var array = arguments[index];
if (isArray(array) || isArguments(array)) {
result = result ? baseDifference(result, array).concat(baseDifference(array, result)) : array;
var result = result
? baseDifference(result, array).concat(baseDifference(array, result))
: array;
}
}
return result ? baseUniq(result) : [];