🧩 Creates an array of ungrouped elements from a zipped array.

Syntax

TypeScript
import { unzip } from '@opentf/std';

unzip<T>(zipped: (T | undefined)[][] = []): (T | undefined)[][]

Parameters

  • zipped: The zipped array to unzip.

Returns

A new array of arrays.

Jagged input groups preserve missing positions as undefined.

Examples

TypeScript
unzip([[1, 'a'], [2, 'b']]) //=> [[1, 2], ['a', 'b']]

unzip([[1], [2]]) //=> [[1, 2]]

unzip([[1, 'a'], [2]]) //=> [[1, 2], ['a', undefined]]

unzip([]) //=> []
Last updated on
Edit this page