Version 1
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / _baseXor.js
1 var arrayPush = require('./_arrayPush'),
2     baseDifference = require('./_baseDifference'),
3     baseUniq = require('./_baseUniq');
4
5 /**
6  * The base implementation of methods like `_.xor`, without support for
7  * iteratee shorthands, that accepts an array of arrays to inspect.
8  *
9  * @private
10  * @param {Array} arrays The arrays to inspect.
11  * @param {Function} [iteratee] The iteratee invoked per element.
12  * @param {Function} [comparator] The comparator invoked per element.
13  * @returns {Array} Returns the new array of values.
14  */
15 function baseXor(arrays, iteratee, comparator) {
16   var index = -1,
17       length = arrays.length;
18
19   while (++index < length) {
20     var result = result
21       ? arrayPush(
22           baseDifference(result, arrays[index], iteratee, comparator),
23           baseDifference(arrays[index], result, iteratee, comparator)
24         )
25       : arrays[index];
26   }
27   return (result && result.length) ? baseUniq(result, iteratee, comparator) : [];
28 }
29
30 module.exports = baseXor;