@extra-iterable/is-disjoint

Checks if iterables have no value in common.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-iterable/is-disjoint
512.5.222 years ago3 years agoMinified + gzip package size for @extra-iterable/is-disjoint in KB

Readme

Checks if iterables have no value in common. :package: :smileycat: :running: :vhs: :moon: :scroll: :newspaper: :bluebook:
Similar: isUnique, isDisjoint, intersection.

This is part of package extra-iterable.



iterable.isDisjoint(x, y, [fc], [fm]);
// x:  an iterable
// y:  another iterable
// fc: compare function (a, b)
// fm: map function (v, i, x)
:stopwatch: Compare function => O(n²).

const iterable = require("extra-iterable");

var x = [1, 2, 3, 4];
iterable.isDisjoint(x, [2, 5]);
// false

iterable.isDisjoint(x, [-2, -5]);
// true

iterable.isDisjoint(x, [-2, -5], (a, b) => Math.abs(a) - Math.abs(b));
// false

iterable.isDisjoint(x, [-2, -5], null, v => Math.abs(v));
// false



References