|
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 | |
|---|
| 1 | import {InternSet} from "internmap";
|
|---|
| 2 |
|
|---|
| 3 | export 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 |
|
|---|
| 17 | function set(values) {
|
|---|
| 18 | return values instanceof InternSet ? values : new InternSet(values);
|
|---|
| 19 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.