Function Graph Overview
    Preparing search index...

    Function structZip

    • Zips an object of arrays, creating objects with corresponding elements. Stops iterating when the shortest input array is exhausted.

      Type Parameters

      • T extends Record<string, unknown[]>

        An object containing arrays of potentially different types

      Parameters

      • arrays: T

        Object with array values to be zipped

      Returns Generator<
          { [K in string
          | number
          | symbol]: T[K] extends U[] ? U : never },
          void,
          unknown,
      >

      A generator yielding objects with one element from each input array

      const data = {
      names: ['Alice', 'Bob'],
      ages: [30, 25],
      cities: ['New York', 'London']
      };
      [...structZip(data)]
      // [{ names: 'Alice', ages: 30, cities: 'New York' },
      // { names: 'Bob', ages: 25, cities: 'London' }]