00001 var baseDifference = require('./_baseDifference'), 00002 baseFlatten = require('./_baseFlatten'), 00003 baseUniq = require('./_baseUniq'); 00004 00015 function baseXor(arrays, iteratee, comparator) { 00016 var length = arrays.length; 00017 if (length < 2) { 00018 return length ? baseUniq(arrays[0]) : []; 00019 } 00020 var index = -1, 00021 result = Array(length); 00022 00023 while (++index < length) { 00024 var array = arrays[index], 00025 othIndex = -1; 00026 00027 while (++othIndex < length) { 00028 if (othIndex != index) { 00029 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 00030 } 00031 } 00032 } 00033 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 00034 } 00035 00036 module.exports = baseXor;