Skip to content

unzip ​

The unzip function transforms an array of grouped arrays into arrays of corresponding elements.

Syntax ​

typescript
unzip<T>(array: T[][]): T[][];

Parameters ​

NameTypeDescription
arrayT[][]Array of grouped arrays

Returns ​

TypeDescription
T[][]New array of ungrouped arrays

Examples ​

typescript
unzip([[1, 'a'], [2, 'b'], [3, 'c']]); // => [[1, 2, 3], ['a', 'b', 'c']]

Notes ​

  • Inverse of the zip function.
  • Useful for tabular data manipulation.

References ​

Released under the MIT License.