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

Function disjoint

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

Source from the content-addressed store, hash-verified

1import {InternSet} from "internmap";
2
3export default function disjoint(values, other) {
4 const iterator = other[Symbol.iterator](), set = new InternSet();
5 for (const v of values) {
6 if (set.has(v)) return false;
7 let value, done;
8 while (({value, done} = iterator.next())) {
9 if (done) break;
10 if (Object.is(v, value)) return false;
11 set.add(value);
12 }
13 }
14 return true;
15}

Callers 1

disjoint-test.jsFile · 0.85

Calls 1

addMethod · 0.80

Tested by

no test coverage detected