ixfx
    Preparing search index...

    Function zipObjects

    • 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 }
      // ]

      Type Parameters

      • T extends object[]

      Parameters

      • ...toMerge: { [K in string | number | symbol]: T[K<K>][] }

        Arrays to merge

      Returns Generator<Spread<T>, void, unknown>

      Generator of merged records

      If either parameter is not an array

      If the arrays are not of the same length