Merge corresponding objects from arrays. This is assuming objects at the same array indices are connected.
Arrays must be the same length. When merging objects, the properties of later objects override those of earlier objects.
const a = [ { name: `jane`, age: 30 }, { name: `bob`, age: 40 } ];const b = [ { name: `fred`, colour: `red` }, { name: `johanne` } ];const c = [...zipObjects(a, b)];// Yields:// [// { name: `fred`, age: 30, colour: `red` },// { name: `johanne`, age: 40 }// ] Copy
const a = [ { name: `jane`, age: 30 }, { name: `bob`, age: 40 } ];const b = [ { name: `fred`, colour: `red` }, { name: `johanne` } ];const c = [...zipObjects(a, b)];// Yields:// [// { name: `fred`, age: 30, colour: `red` },// { name: `johanne`, age: 40 }// ]
Arrays to merge
Generator of merged records
If either parameter is not an array
If the arrays are not of the same length
Merge corresponding objects from arrays. This is assuming objects at the same array indices are connected.
Arrays must be the same length. When merging objects, the properties of later objects override those of earlier objects.