UNPKG

809 BJavaScriptView Raw
1import arrayFilter from './_arrayFilter.js';
2import baseRest from './_baseRest.js';
3import baseXor from './_baseXor.js';
4import isArrayLikeObject from './isArrayLikeObject.js';
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
28export default xor;