unzip es-toolkit
Unpacks grouped arrays and creates new arrays by gathering elements at the same position.
Usage
unzip(zipped)
Use unzip when you want to create new arrays by collecting elements at the same index from a 2D array where multiple arrays are grouped together. It's the opposite operation of zip.
The returned array's length matches the longest nested array, and missing positions from shorter arrays are filled with undefined.
Passing an empty array returns an empty array.
Parameters
A 2D array where multiple arrays are grouped together to be unpacked.
Returns
New arrays where elements at the same position are grouped together. If the original arrays have different lengths, empty positions in shorter arrays are filled with undefined.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.