We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Combine matching entries from objects.
Similar: cartesianProduct, zip.
function zip(xs, fm, fe, vd?) // xs: objects // fm: map function (vs, k) // fe: end function (dones) [array.some] // vd: default value
const object = require('extra-object'); const array = require('extra-array'); var x = {a: 1, b: 2, c: 3}; var y = {a: 10, b: 20}; object.zip([x, y]); // → { a: [ 1, 10 ], b: [ 2, 20 ] } (shortest) object.zip([x, y], ([a, b]) => a + b); // → { a: 11, b: 22 } object.zip([x, y], null, array.some); // → { a: [ 1, 10 ], b: [ 2, 20 ] } (shortest) object.zip([x, y], null, array.every, 0); // → { a: [ 1, 10 ], b: [ 2, 20 ], c: [ 3, 0 ] } (longest) object.zip([x, y], null, array.head, 0); // → { a: [ 1, 10 ], b: [ 2, 20 ], c: [ 3, 0 ] } (first)