ixfx
    Preparing search index...

    Function zip

    • Zip combines the elements of two or more arrays based on their index.

      import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';

      const a = [1,2,3];
      const b = [`red`, `blue`, `green`];

      const c = Arrays.zip(a, b);
      // Yields:
      // [
      // [1, `red`],
      // [2, `blue`],
      // [3, `green`]
      // ]

      Typically the arrays you zip together are all about the same logical item. Eg, in the above example perhaps a is size and b is colour. So thing #1 (at array index 0) is a red thing of size 1. Before zipping we'd access it by a[0] and b[0]. After zipping, we'd have c[0], which is array of [1, red].

      Parameters

      • ...arrays: any[][] | readonly any[][] | readonly (readonly any[])[]

      Returns any[]

      Zipped together array