Skip to content

isDisjoint

Subhajit Sahu edited this page May 10, 2020 · 25 revisions

Checks if iterables have no value in common. 🏃 📼 📦 🌔

Alternatives: compare, map.

iterable.isDisjoint(x, y, [fn]);
// x:  an iterable
// y:  another iterable
// fn: compare function (a, b)
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

references

Clone this wiki locally