🧩 Creates an array of grouped elements from multiple arrays.
Syntax
TypeScript
import { zip } from '@opentf/std'; zip<T>(...arrays: T[][]): (T | undefined)[][]
Parameters
arrays: The arrays to zip together.
Returns
A new zipped array.
Shorter arrays are padded with undefined.
Examples
TypeScript
zip([1, 2], ['a', 'b']) //=> [[1, 'a'], [2, 'b']] zip([1, 2, 3], ['a', 'b']) //=> [[1, 'a'], [2, 'b'], [3, undefined]] zip([1, 2], ['a', 'b'], [true, false]) //=> [[1, 'a', true], [2, 'b', false]]