-
Notifications
You must be signed in to change notification settings - Fork 1
intersection
wolfram77 edited this page Mar 27, 2020
·
26 revisions
Gives values present in both iterables.
iterable.intersection(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.intersection(x, [2, 3, 5]);
// [2, 3]
iterable.intersection(x, [-2, -3, -5], (a, b) => Math.abs(a) - Math.abs(b));
// [2, 3]