deno.land / x / lodash@4.17.19 / npm-package / _baseXor.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var baseDifference = require('./_baseDifference'), baseFlatten = require('./_baseFlatten'), baseUniq = require('./_baseUniq');
/** * The base implementation of methods like `_.xor`, without support for * iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. */function baseXor(arrays, iteratee, comparator) { var length = arrays.length; if (length < 2) { return length ? baseUniq(arrays[0]) : []; } var index = -1, result = Array(length);
while (++index < length) { var array = arrays[index], othIndex = -1;
while (++othIndex < length) { if (othIndex != index) { result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); } } } return baseUniq(baseFlatten(result, 1), iteratee, comparator);}
module.exports = baseXor;
lodash

Version Info

Tagged at
3 years ago

External Dependencies

No external dependencies 🎉