-
Notifications
You must be signed in to change notification settings - Fork 1
merge
Subhajit Sahu edited this page May 13, 2020
·
14 revisions
Lists cartesian product of iterables. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]
iterable.product(xs, [fn], [ths]);
// xs: iterables
// fn: map function (vs, i, xs)
// ths: this argument
const iterable = require('extra-iterable');
var x = [1, 3, 5, 7];
var y = [2, 4, 8];
[...iterable.merge([x, y])];
// [
// 1, 2, 3, 4,
// 5, 7, 8
// ]
var y = [-2, -4, -8];
[...iterable.merge([x, y], (a, b) => Math.abs(a) - Math.abs(b))];
// [
// 1, -2, 3, -4,
// 5, 7, -8
// ]