Skip to content

unzip

unzip<T>(tuples): Unzipped<T>

Defined in: packages/core/src/iterable/unzip.ts:22

Splits an iterable of tuples into one array per tuple position — the inverse of zip.

Eager, unlike most of this directory: a column cannot be produced without reading every row.

Ragged input is tolerated. The result has as many columns as the longest tuple seen, and a tuple shorter than that contributes nothing to the columns it does not reach, so those columns end up shorter rather than padded.

Time complexity: O(n × width).

T extends readonly unknown[]

Iterable<T>

The tuples to split.

Unzipped<T>

The columns. Empty when the input is.