source: node_modules/d3-array/src/intersection.js@ e4c61dd

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

Prototype 1.1

  • Property mode set to 100644
File size: 446 bytes
Line 
1import {InternSet} from "internmap";
2
3export default function intersection(values, ...others) {
4 values = new InternSet(values);
5 others = others.map(set);
6 out: for (const value of values) {
7 for (const other of others) {
8 if (!other.has(value)) {
9 values.delete(value);
10 continue out;
11 }
12 }
13 }
14 return values;
15}
16
17function set(values) {
18 return values instanceof InternSet ? values : new InternSet(values);
19}
Note: See TracBrowser for help on using the repository browser.