| [a762898] | 1 | /**
|
|---|
| 2 | * Combines one array into a single array using a custom combiner function.
|
|---|
| 3 | *
|
|---|
| 4 | * @template T - The type of elements in the first array.
|
|---|
| 5 | * @template R - The type of elements in the resulting array.
|
|---|
| 6 | * @param {ArrayLike<T>} arr1 - The first array to zip.
|
|---|
| 7 | * @param {(item: T) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|---|
| 8 | * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|---|
| 9 | */
|
|---|
| 10 | declare function zipWith<T, R>(arr1: ArrayLike<T>, combine: (item: T) => R): R[];
|
|---|
| 11 | /**
|
|---|
| 12 | * Combines two arrays into a single array using a custom combiner function.
|
|---|
| 13 | *
|
|---|
| 14 | * @template T - The type of elements in the first array.
|
|---|
| 15 | * @template U - The type of elements in the second array.
|
|---|
| 16 | * @template R - The type of elements in the resulting array.
|
|---|
| 17 | * @param {ArrayLike<T>} arr1 - The first array to zip.
|
|---|
| 18 | * @param {ArrayLike<U>} arr2 - The second array to zip.
|
|---|
| 19 | * @param {(item1: T, item2: U) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|---|
| 20 | * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|---|
| 21 | */
|
|---|
| 22 | declare function zipWith<T, U, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, combine: (item1: T, item2: U) => R): R[];
|
|---|
| 23 | /**
|
|---|
| 24 | * Combines three arrays into a single array using a custom combiner function.
|
|---|
| 25 | *
|
|---|
| 26 | * @template T - The type of elements in the first array.
|
|---|
| 27 | * @template U - The type of elements in the second array.
|
|---|
| 28 | * @template V - The type of elements in the third array.
|
|---|
| 29 | * @template R - The type of elements in the resulting array.
|
|---|
| 30 | * @param {ArrayLike<T>} arr1 - The first array to zip.
|
|---|
| 31 | * @param {ArrayLike<U>} arr2 - The second array to zip.
|
|---|
| 32 | * @param {ArrayLike<V>} arr3 - The third array to zip.
|
|---|
| 33 | * @param {(item1: T, item2: U, item3: V) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|---|
| 34 | * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|---|
| 35 | */
|
|---|
| 36 | declare function zipWith<T, U, V, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, combine: (item1: T, item2: U, item3: V) => R): R[];
|
|---|
| 37 | /**
|
|---|
| 38 | * Combines four arrays into a single array using a custom combiner function.
|
|---|
| 39 | *
|
|---|
| 40 | * @template T - The type of elements in the first array.
|
|---|
| 41 | * @template U - The type of elements in the second array.
|
|---|
| 42 | * @template V - The type of elements in the third array.
|
|---|
| 43 | * @template W - The type of elements in the fourth array.
|
|---|
| 44 | * @template R - The type of elements in the resulting array.
|
|---|
| 45 | * @param {ArrayLike<T>} arr1 - The first array to zip.
|
|---|
| 46 | * @param {ArrayLike<U>} arr2 - The second array to zip.
|
|---|
| 47 | * @param {ArrayLike<V>} arr3 - The third array to zip.
|
|---|
| 48 | * @param {ArrayLike<W>} arr4 - The fourth array to zip.
|
|---|
| 49 | * @param {(item1: T, item2: U, item3: V, item4: W) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|---|
| 50 | * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|---|
| 51 | */
|
|---|
| 52 | declare function zipWith<T, U, V, W, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, combine: (item1: T, item2: U, item3: V, item4: W) => R): R[];
|
|---|
| 53 | /**
|
|---|
| 54 | * Combines five arrays into a single array using a custom combiner function.
|
|---|
| 55 | *
|
|---|
| 56 | * @template T - The type of elements in the first array.
|
|---|
| 57 | * @template U - The type of elements in the second array.
|
|---|
| 58 | * @template V - The type of elements in the third array.
|
|---|
| 59 | * @template W - The type of elements in the fourth array.
|
|---|
| 60 | * @template X - The type of elements in the fifth array.
|
|---|
| 61 | * @template R - The type of elements in the resulting array.
|
|---|
| 62 | * @param {ArrayLike<T>} arr1 - The first array to zip.
|
|---|
| 63 | * @param {ArrayLike<U>} arr2 - The second array to zip.
|
|---|
| 64 | * @param {ArrayLike<V>} arr3 - The third array to zip.
|
|---|
| 65 | * @param {ArrayLike<W>} arr4 - The fourth array to zip.
|
|---|
| 66 | * @param {ArrayLike<X>} arr5 - The fifth array to zip.
|
|---|
| 67 | * @param {(item1: T, item2: U, item3: V, item4: W, item5: X) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|---|
| 68 | * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|---|
| 69 | */
|
|---|
| 70 | declare function zipWith<T, U, V, W, X, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, arr5: ArrayLike<X>, combine: (item1: T, item2: U, item3: V, item4: W, item5: X) => R): R[];
|
|---|
| 71 | /**
|
|---|
| 72 | * Combines multiple arrays into a single array using a custom combiner function.
|
|---|
| 73 | *
|
|---|
| 74 | * This function takes one array and a variable number of additional arrays,
|
|---|
| 75 | * applying the provided combiner function to the corresponding elements of each array.
|
|---|
| 76 | * If the input arrays are of different lengths, the resulting array will have the length
|
|---|
| 77 | * of the longest input array, with undefined values for missing elements.
|
|---|
| 78 | *
|
|---|
| 79 | * @template T - The type of elements in the input arrays.
|
|---|
| 80 | * @template R - The type of elements in the resulting array.
|
|---|
| 81 | * @param {Array<((...group: T[]) => R) | ArrayLike<T> | null | undefined>} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|---|
| 82 | * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|---|
| 83 | *
|
|---|
| 84 | * @example
|
|---|
| 85 | * const arr1 = [1, 2, 3];
|
|---|
| 86 | * const arr2 = ['a', 'b', 'c'];
|
|---|
| 87 | * const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`);
|
|---|
| 88 | * // result will be ['1a', '2b', '3c']
|
|---|
| 89 | */
|
|---|
| 90 | declare function zipWith<T, R>(...combine: Array<((...group: T[]) => R) | ArrayLike<T> | null | undefined>): R[];
|
|---|
| 91 |
|
|---|
| 92 | export { zipWith };
|
|---|