(values, ...others)
| 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); |
no outgoing calls
no test coverage detected
searching dependent graphs…