There was an error while loading. Please reload this page.
Combine values from iterables.
Similar: cartesianProduct, zip.
function zip(xs, fm, fe, vd?) // xs: iterables // fm: map function (vs, i, xs) // fe: end function (dones) [some] // vd: default value
const xiterable = require('extra-iterable'); var x = [1, 2, 3]; var y = [4, 5]; [...xiterable.zip([x, y])]; // → [[1, 4], [2, 5]] (shortest) [...xiterable.zip([x, y], ([a, b]) => a + b)]; // → [5, 7] [...xiterable.zip([x, y], null, some)]; // → [[1, 4], [2, 5]] (shortest) [...xiterable.zip([x, y], null, every, 0)]; // → [[1, 4], [2, 5], [3, 0]] (longest) [...xiterable.zip([x, y], null, head, 0)]; // → [[1, 4], [2, 5], [3, 0]] (first)