UNPKG

811 BJavaScriptView Raw
1var arrayFilter = require('./_arrayFilter'),
2 baseRest = require('./_baseRest'),
3 baseXor = require('./_baseXor'),
4 isArrayLikeObject = require('./isArrayLikeObject');
5
6/**
7 * Creates an array of unique values that is the
8 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
9 * of the given arrays. The order of result values is determined by the order
10 * they occur in the arrays.
11 *
12 * @static
13 * @memberOf _
14 * @since 2.4.0
15 * @category Array
16 * @param {...Array} [arrays] The arrays to inspect.
17 * @returns {Array} Returns the new array of filtered values.
18 * @see _.difference, _.without
19 * @example
20 *
21 * _.xor([2, 1], [2, 3]);
22 * // => [1, 3]
23 */
24var xor = baseRest(function(arrays) {
25 return baseXor(arrayFilter(arrays, isArrayLikeObject));
26});
27
28module.exports = xor;