Skip to content

Function.unzip

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / unzip

Function: unzip()

unzip<T>(array): { [K in string | number | symbol]: T[K][] }

Defined in: Array/unzip.ts:10

Splits an array of tuples into one array per tuple position (the inverse of zip) The number of result arrays is the shortest tuple length, matching zip's truncation.

Type Parameters

T

T extends unknown[]

Parameters

array

T[]

Array of tuples to split

Returns

{ [K in string | number | symbol]: T[K][] }

One array per tuple position

Example

unzip([[1, "a"], [2, "b"]]); // [[1, 2], ["a", "b"]]
unzip([[1, "a", true], [2, "b"]]); // [[1, 2], ["a", "b"]]

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally