MCPcopy Create free account
hub / github.com/d3/d3-array / intersection

Function intersection

src/intersection.js:3–15  ·  view source on GitHub ↗
(values, ...others)

Source from the content-addressed store, hash-verified

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);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…