source: node_modules/es-toolkit/dist/compat/array/intersection.mjs@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 666 bytes
Line 
1import { intersection as intersection$1 } from '../../array/intersection.mjs';
2import { uniq } from '../../array/uniq.mjs';
3import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
4
5function intersection(...arrays) {
6 if (arrays.length === 0) {
7 return [];
8 }
9 if (!isArrayLikeObject(arrays[0])) {
10 return [];
11 }
12 let result = uniq(Array.from(arrays[0]));
13 for (let i = 1; i < arrays.length; i++) {
14 const array = arrays[i];
15 if (!isArrayLikeObject(array)) {
16 return [];
17 }
18 result = intersection$1(result, Array.from(array));
19 }
20 return result;
21}
22
23export { intersection };
Note: See TracBrowser for help on using the repository browser.