|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
805 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const intersection$1 = require('../../array/intersection.js');
|
|---|
| 6 | const uniq = require('../../array/uniq.js');
|
|---|
| 7 | const isArrayLikeObject = require('../predicate/isArrayLikeObject.js');
|
|---|
| 8 |
|
|---|
| 9 | function intersection(...arrays) {
|
|---|
| 10 | if (arrays.length === 0) {
|
|---|
| 11 | return [];
|
|---|
| 12 | }
|
|---|
| 13 | if (!isArrayLikeObject.isArrayLikeObject(arrays[0])) {
|
|---|
| 14 | return [];
|
|---|
| 15 | }
|
|---|
| 16 | let result = uniq.uniq(Array.from(arrays[0]));
|
|---|
| 17 | for (let i = 1; i < arrays.length; i++) {
|
|---|
| 18 | const array = arrays[i];
|
|---|
| 19 | if (!isArrayLikeObject.isArrayLikeObject(array)) {
|
|---|
| 20 | return [];
|
|---|
| 21 | }
|
|---|
| 22 | result = intersection$1.intersection(result, Array.from(array));
|
|---|
| 23 | }
|
|---|
| 24 | return result;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | exports.intersection = intersection;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.