source: node_modules/es-toolkit/dist/array/unzip.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 654 bytes
Line 
1/**
2 * Gathers elements in the same position in an internal array
3 * from a grouped array of elements and returns them as a new array.
4 *
5 * @template T - The type of elements in the nested array.
6 * @param {Array<[...T]>} zipped - The nested array to unzip.
7 * @returns {Unzip<T>} A new array of unzipped elements.
8 *
9 * @example
10 * const zipped = [['a', true, 1],['b', false, 2]];
11 * const result = unzip(zipped);
12 * // result will be [['a', 'b'], [true, false], [1, 2]]
13 */
14declare function unzip<T extends unknown[]>(zipped: ReadonlyArray<[...T]>): Unzip<T>;
15type Unzip<K extends unknown[]> = {
16 [I in keyof K]: Array<K[I]>;
17};
18
19export { unzip };
Note: See TracBrowser for help on using the repository browser.