@vsokolov/utils - v1.4.2
    Preparing search index...

    Function zip

    • Zip multiple arrays together into an array of tuples

      Type Parameters

      • T extends readonly unknown[]

      Parameters

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

        Arrays to zip together

      Returns T[]

      Array of tuples where each tuple contains one element from each input array

      zip([1, 2, 3], ['a', 'b', 'c']) // [[1, 'a'], [2, 'b'], [3, 'c']]
      zip([1, 2], ['a', 'b'], [true, false]) // [[1, 'a', true], [2, 'b', false]]