1 | import baseDifference from './_baseDifference.js';
|
2 | import baseFlatten from './_baseFlatten.js';
|
3 | import baseUniq from './_baseUniq.js';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function baseXor(arrays, iteratee, comparator) {
|
16 | var length = arrays.length;
|
17 | if (length < 2) {
|
18 | return length ? baseUniq(arrays[0]) : [];
|
19 | }
|
20 | var index = -1,
|
21 | result = Array(length);
|
22 |
|
23 | while (++index < length) {
|
24 | var array = arrays[index],
|
25 | othIndex = -1;
|
26 |
|
27 | while (++othIndex < length) {
|
28 | if (othIndex != index) {
|
29 | result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
|
30 | }
|
31 | }
|
32 | }
|
33 | return baseUniq(baseFlatten(result, 1), iteratee, comparator);
|
34 | }
|
35 |
|
36 | export default baseXor;
|