API reference › @evolu/common › Array › zipArray
Call Signature
function zipArray<T>(
arrays: T,
): readonly [Readonly<ZipArrayResult<T>>, Readonly<ZipArrayResult<T>>];
Defined in: packages/common/src/Array.ts:707
Combines multiple arrays into an array of tuples.
Uses "shortest" mode — stops at the shortest input array. Preserves non-empty type when all input arrays are non-empty. See the TC39 Array.zip proposal for the pattern this follows.
Example
zipArray([
[1, 2, 3],
["a", "b", "c"],
]);
// [[1, "a"], [2, "b"], [3, "c"]]
zipArray([
[1, 2],
["a", "b", "c"],
[true, false],
]);
// [[1, "a", true], [2, "b", false]]
Call Signature
function zipArray<T>(arrays: T): readonly Readonly<ZipArrayResult<T>>[];
Defined in: packages/common/src/Array.ts:711
Possibly empty arrays.