-
Notifications
You must be signed in to change notification settings - Fork 1
isDisjoint
Subhajit Sahu edited this page May 19, 2020
·
25 revisions
Checks if iterables have no value in common. 🏃 📼 📦 🌔 📒
iterable.isDisjoint(x, y, [fc], [fm]);
// x: an iterable
// y: another iterable
// fc: compare function (a, b)
// fm: map function (v, i, x)
⏱️ 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