source: node_modules/es-toolkit/dist/array/zip.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: 4.5 KB
Line 
1/**
2 * Combines multiple arrays into a single array of tuples.
3 *
4 * This function takes multiple arrays and returns a new array where each element is a tuple
5 * containing the corresponding elements from the input arrays. If the input arrays are of
6 * different lengths, the resulting array will have the length of the longest input array,
7 * with undefined values for missing elements.
8 *
9 * @template T
10 * @param {T[]} arr1 - The first array to zip.
11 * @returns {Array<[T]>} A new array of tuples containing the corresponding elements from the input arrays.
12 *
13 * @example
14 * const arr1 = [1, 2, 3];
15 * const result = zip(arr1);
16 * // result will be [[1], [2], [3]]
17 */
18declare function zip<T>(arr1: readonly T[]): Array<[T]>;
19/**
20 * Combines multiple arrays into a single array of tuples.
21 *
22 * This function takes multiple arrays and returns a new array where each element is a tuple
23 * containing the corresponding elements from the input arrays. If the input arrays are of
24 * different lengths, the resulting array will have the length of the longest input array,
25 * with undefined values for missing elements.
26 *
27 * @template T, U
28 * @param {T[]} arr1 - The first array to zip.
29 * @param {U[]} arr2 - The second array to zip.
30 * @returns {Array<[T, U]>} A new array of tuples containing the corresponding elements from the input arrays.
31 *
32 * @example
33 * const arr1 = [1, 2, 3];
34 * const arr2 = ['a', 'b', 'c'];
35 * const result = zip(arr1, arr2);
36 * // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
37 */
38declare function zip<T, U>(arr1: readonly T[], arr2: readonly U[]): Array<[T, U]>;
39/**
40 * Combines multiple arrays into a single array of tuples.
41 *
42 * This function takes multiple arrays and returns a new array where each element is a tuple
43 * containing the corresponding elements from the input arrays. If the input arrays are of
44 * different lengths, the resulting array will have the length of the longest input array,
45 * with undefined values for missing elements.
46 *
47 * @template T, U, V
48 * @param {T[]} arr1 - The first array to zip.
49 * @param {U[]} arr2 - The second array to zip.
50 * @param {V[]} arr3 - The third array to zip.
51 * @returns {Array<[T, U, V]>} A new array of tuples containing the corresponding elements from the input arrays.
52 *
53 * @example
54 * const arr1 = [1, 2, 3];
55 * const arr2 = ['a', 'b', 'c'];
56 * const arr3 = [true, false];
57 * const result = zip(arr1, arr2, arr3);
58 * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
59 */
60declare function zip<T, U, V>(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[]): Array<[T, U, V]>;
61/**
62 * Combines multiple arrays into a single array of tuples.
63 *
64 * This function takes multiple arrays and returns a new array where each element is a tuple
65 * containing the corresponding elements from the input arrays. If the input arrays are of
66 * different lengths, the resulting array will have the length of the longest input array,
67 * with undefined values for missing elements.
68 *
69 * @template T, U, V, W
70 * @param {T[]} arr1 - The first array to zip.
71 * @param {U[]} arr2 - The second array to zip.
72 * @param {V[]} arr3 - The third array to zip.
73 * @param {W[]} arr4 - The fourth array to zip.
74 * @returns {Array<[T, U, V, W]>} A new array of tuples containing the corresponding elements from the input arrays.
75 *
76 * @example
77 * const arr1 = [1, 2, 3];
78 * const arr2 = ['a', 'b', 'c'];
79 * const arr3 = [true, false];
80 * const arr4 = [null, null, null];
81 * const result = zip(arr1, arr2, arr3, arr4);
82 * // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]]
83 */
84declare function zip<T, U, V, W>(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[]): Array<[T, U, V, W]>;
85/**
86 * Combines multiple arrays into a single array of tuples.
87 *
88 * This function takes multiple arrays and returns a new array where each element is a tuple
89 * containing the corresponding elements from the input arrays. If the input arrays are of
90 * different lengths, the resulting array will have the length of the longest input array,
91 * with undefined values for missing elements.
92 *
93 * @template T
94 * @param {...Array<readonly T[]>} arrs - The arrays to zip together.
95 * @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.
96 *
97 * @example
98 * const arr1 = [1, 2, 3];
99 * const arr2 = ['a', 'b', 'c'];
100 * const arr3 = [true, false];
101 * const result = zip(arr1, arr2, arr3);
102 * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
103 */
104declare function zip<T>(...arrs: Array<readonly T[]>): T[][];
105
106export { zip };
Note: See TracBrowser for help on using the repository browser.