1 var arrayFilter = require('./_arrayFilter'),
2 baseXor = require('./_baseXor'),
3 isArrayLikeObject = require('./isArrayLikeObject'),
4 last = require('./last'),
5 rest = require('./rest');
8 * This method is like `_.xor` except that it accepts `comparator` which is
9 * invoked to compare elements of `arrays`. The comparator is invoked with
10 * two arguments: (arrVal, othVal).
15 * @param {...Array} [arrays] The arrays to inspect.
16 * @param {Function} [comparator] The comparator invoked per element.
17 * @returns {Array} Returns the new array of values.
20 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
21 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
23 * _.xorWith(objects, others, _.isEqual);
24 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
26 var xorWith = rest(function(arrays) {
27 var comparator = last(arrays);
28 if (isArrayLikeObject(comparator)) {
29 comparator = undefined;
31 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
34 module.exports = xorWith;