es-toolkit 1.35.0-dev.1202 → 1.35.0-dev.1209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunk/{isPromise-ByAybB.js → isPromise-BqEEYJ.js} +126 -40
- package/dist/_chunk/{reverseString-D-wK2p.js → reverseString-BixeGz.js} +84 -13
- package/dist/_chunk/toSnakeCaseKeys-Bvb9j3.js +4578 -0
- package/dist/_chunk/{unary-BsNWRM.js → unary-EIEhcF.js} +46 -0
- package/dist/_chunk/{zip-DxZJSH.js → zipWith-CsbMsR.js} +114 -3
- package/dist/array/index.js +57 -126
- package/dist/array/take.d.mts +1 -1
- package/dist/array/take.d.ts +1 -1
- package/dist/array/take.mjs +4 -1
- package/dist/array/takeRight.d.mts +1 -1
- package/dist/array/takeRight.d.ts +1 -1
- package/dist/array/takeRight.mjs +5 -2
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/compat.d.mts +301 -0
- package/dist/compat/compat.d.ts +301 -0
- package/dist/compat/compat.mjs +303 -0
- package/dist/compat/function/partial.d.mts +575 -0
- package/dist/compat/function/partial.d.ts +575 -0
- package/dist/compat/function/partial.mjs +8 -0
- package/dist/compat/function/partialRight.d.mts +651 -0
- package/dist/compat/function/partialRight.d.ts +651 -0
- package/dist/compat/function/partialRight.mjs +8 -0
- package/dist/compat/index.d.mts +10 -18
- package/dist/compat/index.d.ts +10 -18
- package/dist/compat/index.js +280 -4043
- package/dist/compat/index.mjs +13 -19
- package/dist/compat/object/defaults.mjs +7 -1
- package/dist/compat/string/repeat.d.mts +1 -1
- package/dist/compat/string/repeat.d.ts +1 -1
- package/dist/compat/string/repeat.mjs +12 -2
- package/dist/compat/string/words.d.mts +1 -1
- package/dist/compat/string/words.d.ts +1 -1
- package/dist/compat/string/words.mjs +2 -1
- package/dist/compat/toolkit.d.mts +9 -0
- package/dist/compat/toolkit.d.ts +9 -0
- package/dist/compat/toolkit.mjs +10 -0
- package/dist/function/index.js +3 -4
- package/dist/function/partial.d.mts +3 -3
- package/dist/function/partial.d.ts +3 -3
- package/dist/function/partial.mjs +17 -19
- package/dist/function/partialRight.d.mts +3 -3
- package/dist/function/partialRight.d.ts +3 -3
- package/dist/function/partialRight.mjs +18 -20
- package/dist/index.js +84 -87
- package/dist/object/index.js +15 -15
- package/dist/object/toCamelCaseKeys.mjs +3 -0
- package/dist/object/toSnakeCaseKeys.mjs +3 -0
- package/dist/predicate/index.js +4 -5
- package/dist/string/index.js +7 -8
- package/package.json +1 -1
- package/dist/_chunk/isPlainObject-Xaozpc.js +0 -93
- package/dist/_chunk/partialRight-B0_CSB.js +0 -50
- package/dist/_chunk/snakeCase-BtVEeB.js +0 -75
- package/dist/_chunk/toSnakeCaseKeys-BNpS71.js +0 -569
- package/dist/compat/_internal/copyArray.mjs +0 -12
- package/dist/compat/array/flatMap.d.mts +0 -20
- package/dist/compat/array/flatMap.d.ts +0 -20
- package/dist/compat/array/flatMap.mjs +0 -13
- package/dist/compat/array/forEachRight.d.mts +0 -106
- package/dist/compat/array/forEachRight.d.ts +0 -106
- package/dist/compat/array/forEachRight.mjs +0 -21
- package/dist/compat/array/partition.d.mts +0 -65
- package/dist/compat/array/partition.d.ts +0 -65
- package/dist/compat/array/partition.mjs +0 -24
- package/dist/compat/array/pullAllWith.d.mts +0 -59
- package/dist/compat/array/pullAllWith.d.ts +0 -59
- package/dist/compat/array/pullAllWith.mjs +0 -33
- package/dist/compat/array/pullAt.d.mts +0 -32
- package/dist/compat/array/pullAt.d.ts +0 -32
- package/dist/compat/array/pullAt.mjs +0 -34
- package/dist/compat/array/zipObject.d.mts +0 -49
- package/dist/compat/array/zipObject.d.ts +0 -49
- package/dist/compat/array/zipObject.mjs +0 -11
- package/dist/compat/array/zipWith.d.mts +0 -92
- package/dist/compat/array/zipWith.d.ts +0 -92
- package/dist/compat/array/zipWith.mjs +0 -20
- package/dist/compat/object/at.d.mts +0 -19
- package/dist/compat/object/at.d.ts +0 -19
- package/dist/compat/object/at.mjs +0 -27
- package/dist/compat/object/forIn.d.mts +0 -58
- package/dist/compat/object/forIn.d.ts +0 -58
- package/dist/compat/object/forIn.mjs +0 -16
- package/dist/compat/object/forInRight.d.mts +0 -58
- package/dist/compat/object/forInRight.d.ts +0 -58
- package/dist/compat/object/forInRight.mjs +0 -21
- package/dist/compat/object/forOwn.d.mts +0 -54
- package/dist/compat/object/forOwn.d.ts +0 -54
- package/dist/compat/object/forOwn.mjs +0 -19
- package/dist/compat/object/forOwnRight.d.mts +0 -54
- package/dist/compat/object/forOwnRight.d.ts +0 -54
- package/dist/compat/object/forOwnRight.mjs +0 -19
- package/dist/compat/object/hasIn.d.mts +0 -40
- package/dist/compat/object/hasIn.d.ts +0 -40
- package/dist/compat/object/hasIn.mjs +0 -34
- package/dist/compat/string/split.d.mts +0 -19
- package/dist/compat/string/split.d.ts +0 -19
- package/dist/compat/string/split.mjs +0 -7
- package/dist/compat/util/overEvery.d.mts +0 -67
- package/dist/compat/util/overEvery.d.ts +0 -67
- package/dist/compat/util/overEvery.mjs +0 -23
- package/dist/compat/util/overSome.d.mts +0 -69
- package/dist/compat/util/overSome.d.ts +0 -69
- package/dist/compat/util/overSome.mjs +0 -23
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Combines an array of property names into a single object.
|
|
3
|
-
*
|
|
4
|
-
* This function takes one array containing property names and returns a new object where the property names
|
|
5
|
-
* are keys, and the values are all set to `undefined`.
|
|
6
|
-
*
|
|
7
|
-
* @template P - The type of elements in the array.
|
|
8
|
-
* @param {ArrayLike<K>} keys - An array of property names.
|
|
9
|
-
* @returns {Record<K, undefined>} - A new object composed of the given property names and undefined.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const keys = ['a', 'b', 'c'];
|
|
13
|
-
* const result = zipObject(keys);
|
|
14
|
-
* // result will be { a: undefined, b: undefined, c: undefined }
|
|
15
|
-
*/
|
|
16
|
-
declare function zipObject<K extends PropertyKey>(keys?: ArrayLike<K>): Record<K, undefined>;
|
|
17
|
-
/**
|
|
18
|
-
* Combines two arrays, one of property names and one of corresponding values, into a single object.
|
|
19
|
-
*
|
|
20
|
-
* This function takes two arrays: one containing property names and another containing corresponding values.
|
|
21
|
-
* It returns a new object where the property names from the first array are keys, and the corresponding elements
|
|
22
|
-
* from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will
|
|
23
|
-
* have `undefined` as their values.
|
|
24
|
-
*
|
|
25
|
-
* @template P - The type of elements in the array.
|
|
26
|
-
* @template V - The type of elements in the array.
|
|
27
|
-
* @param {ArrayLike<K>} keys - An array of property names.
|
|
28
|
-
* @param {ArrayLike<V>} values - An array of values corresponding to the property names.
|
|
29
|
-
* @returns {Record<K, V>} - A new object composed of the given property names and values.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* const keys = ['a', 'b', 'c'];
|
|
33
|
-
* const values = [1, 2, 3];
|
|
34
|
-
* const result = zipObject(keys, values);
|
|
35
|
-
* // result will be { a: 1, b: 2, c: 3 }
|
|
36
|
-
*
|
|
37
|
-
* const keys2 = ['a', 'b', 'c'];
|
|
38
|
-
* const values2 = [1, 2];
|
|
39
|
-
* const result2 = zipObject(keys2, values2);
|
|
40
|
-
* // result2 will be { a: 1, b: 2, c: undefined }
|
|
41
|
-
*
|
|
42
|
-
* const keys2 = ['a', 'b'];
|
|
43
|
-
* const values2 = [1, 2, 3];
|
|
44
|
-
* const result2 = zipObject(keys2, values2);
|
|
45
|
-
* // result2 will be { a: 1, b: 2 }
|
|
46
|
-
*/
|
|
47
|
-
declare function zipObject<K extends PropertyKey, V>(keys: ArrayLike<K>, values: ArrayLike<V>): Record<K, V>;
|
|
48
|
-
|
|
49
|
-
export { zipObject };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Combines an array of property names into a single object.
|
|
3
|
-
*
|
|
4
|
-
* This function takes one array containing property names and returns a new object where the property names
|
|
5
|
-
* are keys, and the values are all set to `undefined`.
|
|
6
|
-
*
|
|
7
|
-
* @template P - The type of elements in the array.
|
|
8
|
-
* @param {ArrayLike<K>} keys - An array of property names.
|
|
9
|
-
* @returns {Record<K, undefined>} - A new object composed of the given property names and undefined.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const keys = ['a', 'b', 'c'];
|
|
13
|
-
* const result = zipObject(keys);
|
|
14
|
-
* // result will be { a: undefined, b: undefined, c: undefined }
|
|
15
|
-
*/
|
|
16
|
-
declare function zipObject<K extends PropertyKey>(keys?: ArrayLike<K>): Record<K, undefined>;
|
|
17
|
-
/**
|
|
18
|
-
* Combines two arrays, one of property names and one of corresponding values, into a single object.
|
|
19
|
-
*
|
|
20
|
-
* This function takes two arrays: one containing property names and another containing corresponding values.
|
|
21
|
-
* It returns a new object where the property names from the first array are keys, and the corresponding elements
|
|
22
|
-
* from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will
|
|
23
|
-
* have `undefined` as their values.
|
|
24
|
-
*
|
|
25
|
-
* @template P - The type of elements in the array.
|
|
26
|
-
* @template V - The type of elements in the array.
|
|
27
|
-
* @param {ArrayLike<K>} keys - An array of property names.
|
|
28
|
-
* @param {ArrayLike<V>} values - An array of values corresponding to the property names.
|
|
29
|
-
* @returns {Record<K, V>} - A new object composed of the given property names and values.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* const keys = ['a', 'b', 'c'];
|
|
33
|
-
* const values = [1, 2, 3];
|
|
34
|
-
* const result = zipObject(keys, values);
|
|
35
|
-
* // result will be { a: 1, b: 2, c: 3 }
|
|
36
|
-
*
|
|
37
|
-
* const keys2 = ['a', 'b', 'c'];
|
|
38
|
-
* const values2 = [1, 2];
|
|
39
|
-
* const result2 = zipObject(keys2, values2);
|
|
40
|
-
* // result2 will be { a: 1, b: 2, c: undefined }
|
|
41
|
-
*
|
|
42
|
-
* const keys2 = ['a', 'b'];
|
|
43
|
-
* const values2 = [1, 2, 3];
|
|
44
|
-
* const result2 = zipObject(keys2, values2);
|
|
45
|
-
* // result2 will be { a: 1, b: 2 }
|
|
46
|
-
*/
|
|
47
|
-
declare function zipObject<K extends PropertyKey, V>(keys: ArrayLike<K>, values: ArrayLike<V>): Record<K, V>;
|
|
48
|
-
|
|
49
|
-
export { zipObject };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { assignValue } from '../_internal/assignValue.mjs';
|
|
2
|
-
|
|
3
|
-
function zipObject(keys = [], values = []) {
|
|
4
|
-
const result = {};
|
|
5
|
-
for (let i = 0; i < keys.length; i++) {
|
|
6
|
-
assignValue(result, keys[i], values[i]);
|
|
7
|
-
}
|
|
8
|
-
return result;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { zipObject };
|
|
@@ -1,92 +0,0 @@
|
|
|
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 };
|
|
@@ -1,92 +0,0 @@
|
|
|
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 };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { unzip } from './unzip.mjs';
|
|
2
|
-
import { isFunction } from '../../predicate/isFunction.mjs';
|
|
3
|
-
|
|
4
|
-
function zipWith(...combine) {
|
|
5
|
-
let iteratee = combine.pop();
|
|
6
|
-
if (!isFunction(iteratee)) {
|
|
7
|
-
combine.push(iteratee);
|
|
8
|
-
iteratee = undefined;
|
|
9
|
-
}
|
|
10
|
-
if (!combine?.length) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
const result = unzip(combine);
|
|
14
|
-
if (iteratee == null) {
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
return result.map(group => iteratee(...group));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { zipWith };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns an array of values corresponding to `paths` of `object`.
|
|
3
|
-
*
|
|
4
|
-
* @template T - The type of the object.
|
|
5
|
-
* @param {T} object - The object to iterate over.
|
|
6
|
-
* @param {...(PropertyKey | PropertyKey[] | ArrayLike<PropertyKey>)} [paths] - The property paths to pick.
|
|
7
|
-
* @returns {Array<unknown>} - Returns the picked values.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```js
|
|
11
|
-
* const object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
|
12
|
-
*
|
|
13
|
-
* at(object, ['a[0].b.c', 'a[1]']);
|
|
14
|
-
* // => [3, 4]
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function at<T>(object: T, ...paths: Array<PropertyKey | PropertyKey[] | ArrayLike<PropertyKey>>): unknown[];
|
|
18
|
-
|
|
19
|
-
export { at };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns an array of values corresponding to `paths` of `object`.
|
|
3
|
-
*
|
|
4
|
-
* @template T - The type of the object.
|
|
5
|
-
* @param {T} object - The object to iterate over.
|
|
6
|
-
* @param {...(PropertyKey | PropertyKey[] | ArrayLike<PropertyKey>)} [paths] - The property paths to pick.
|
|
7
|
-
* @returns {Array<unknown>} - Returns the picked values.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```js
|
|
11
|
-
* const object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
|
12
|
-
*
|
|
13
|
-
* at(object, ['a[0].b.c', 'a[1]']);
|
|
14
|
-
* // => [3, 4]
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function at<T>(object: T, ...paths: Array<PropertyKey | PropertyKey[] | ArrayLike<PropertyKey>>): unknown[];
|
|
18
|
-
|
|
19
|
-
export { at };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { get } from './get.mjs';
|
|
2
|
-
import { isArrayLike } from '../predicate/isArrayLike.mjs';
|
|
3
|
-
import { isString } from '../predicate/isString.mjs';
|
|
4
|
-
|
|
5
|
-
function at(object, ...paths) {
|
|
6
|
-
if (paths.length === 0) {
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
const allPaths = [];
|
|
10
|
-
for (let i = 0; i < paths.length; i++) {
|
|
11
|
-
const path = paths[i];
|
|
12
|
-
if (!isArrayLike(path) || isString(path)) {
|
|
13
|
-
allPaths.push(path);
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
for (let j = 0; j < path.length; j++) {
|
|
17
|
-
allPaths.push(path[j]);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const result = [];
|
|
21
|
-
for (let i = 0; i < allPaths.length; i++) {
|
|
22
|
-
result.push(get(object, allPaths[i]));
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { at };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iterates over an object and invokes the `iteratee` function for each property.
|
|
3
|
-
*
|
|
4
|
-
* Iterates over string keyed properties including inherited properties.
|
|
5
|
-
*
|
|
6
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The type of the object
|
|
9
|
-
* @param {T} object - The object to iterate over
|
|
10
|
-
* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration
|
|
11
|
-
* @returns {T} Returns the object
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // Iterate over all properties including inherited ones
|
|
15
|
-
* const obj = { a: 1, b: 2 };
|
|
16
|
-
* forIn(obj, (value, key) => {
|
|
17
|
-
* console.log(key, value);
|
|
18
|
-
* });
|
|
19
|
-
* // Output: 'a' 1, 'b' 2
|
|
20
|
-
*
|
|
21
|
-
* // Early termination
|
|
22
|
-
* forIn(obj, (value, key) => {
|
|
23
|
-
* console.log(key, value);
|
|
24
|
-
* return key !== 'a'; // stop after 'a'
|
|
25
|
-
* });
|
|
26
|
-
* // Output: 'a' 1
|
|
27
|
-
*/
|
|
28
|
-
declare function forIn<T>(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T;
|
|
29
|
-
/**
|
|
30
|
-
* Iterates over an object and invokes the `iteratee` function for each property.
|
|
31
|
-
*
|
|
32
|
-
* Iterates over string keyed properties including inherited properties.
|
|
33
|
-
*
|
|
34
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
35
|
-
*
|
|
36
|
-
* @template T - The type of the object
|
|
37
|
-
* @param {T | null | undefined} object - The object to iterate over
|
|
38
|
-
* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration
|
|
39
|
-
* @returns {T | null | undefined} Returns the object
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Iterate over all properties including inherited ones
|
|
43
|
-
* const obj = { a: 1, b: 2 };
|
|
44
|
-
* forIn(obj, (value, key) => {
|
|
45
|
-
* console.log(key, value);
|
|
46
|
-
* });
|
|
47
|
-
* // Output: 'a' 1, 'b' 2
|
|
48
|
-
*
|
|
49
|
-
* // Early termination
|
|
50
|
-
* forIn(obj, (value, key) => {
|
|
51
|
-
* console.log(key, value);
|
|
52
|
-
* return key !== 'a'; // stop after 'a'
|
|
53
|
-
* });
|
|
54
|
-
* // Output: 'a' 1
|
|
55
|
-
*/
|
|
56
|
-
declare function forIn<T>(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined;
|
|
57
|
-
|
|
58
|
-
export { forIn };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iterates over an object and invokes the `iteratee` function for each property.
|
|
3
|
-
*
|
|
4
|
-
* Iterates over string keyed properties including inherited properties.
|
|
5
|
-
*
|
|
6
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The type of the object
|
|
9
|
-
* @param {T} object - The object to iterate over
|
|
10
|
-
* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration
|
|
11
|
-
* @returns {T} Returns the object
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // Iterate over all properties including inherited ones
|
|
15
|
-
* const obj = { a: 1, b: 2 };
|
|
16
|
-
* forIn(obj, (value, key) => {
|
|
17
|
-
* console.log(key, value);
|
|
18
|
-
* });
|
|
19
|
-
* // Output: 'a' 1, 'b' 2
|
|
20
|
-
*
|
|
21
|
-
* // Early termination
|
|
22
|
-
* forIn(obj, (value, key) => {
|
|
23
|
-
* console.log(key, value);
|
|
24
|
-
* return key !== 'a'; // stop after 'a'
|
|
25
|
-
* });
|
|
26
|
-
* // Output: 'a' 1
|
|
27
|
-
*/
|
|
28
|
-
declare function forIn<T>(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T;
|
|
29
|
-
/**
|
|
30
|
-
* Iterates over an object and invokes the `iteratee` function for each property.
|
|
31
|
-
*
|
|
32
|
-
* Iterates over string keyed properties including inherited properties.
|
|
33
|
-
*
|
|
34
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
35
|
-
*
|
|
36
|
-
* @template T - The type of the object
|
|
37
|
-
* @param {T | null | undefined} object - The object to iterate over
|
|
38
|
-
* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration
|
|
39
|
-
* @returns {T | null | undefined} Returns the object
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Iterate over all properties including inherited ones
|
|
43
|
-
* const obj = { a: 1, b: 2 };
|
|
44
|
-
* forIn(obj, (value, key) => {
|
|
45
|
-
* console.log(key, value);
|
|
46
|
-
* });
|
|
47
|
-
* // Output: 'a' 1, 'b' 2
|
|
48
|
-
*
|
|
49
|
-
* // Early termination
|
|
50
|
-
* forIn(obj, (value, key) => {
|
|
51
|
-
* console.log(key, value);
|
|
52
|
-
* return key !== 'a'; // stop after 'a'
|
|
53
|
-
* });
|
|
54
|
-
* // Output: 'a' 1
|
|
55
|
-
*/
|
|
56
|
-
declare function forIn<T>(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined;
|
|
57
|
-
|
|
58
|
-
export { forIn };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { identity } from '../../function/identity.mjs';
|
|
2
|
-
|
|
3
|
-
function forIn(object, iteratee = identity) {
|
|
4
|
-
if (object == null) {
|
|
5
|
-
return object;
|
|
6
|
-
}
|
|
7
|
-
for (const key in object) {
|
|
8
|
-
const result = iteratee(object[key], key, object);
|
|
9
|
-
if (result === false) {
|
|
10
|
-
break;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return object;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { forIn };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iterates over an object in reverse order and invokes the `iteratee` function for each property.
|
|
3
|
-
*
|
|
4
|
-
* Iterates over string keyed properties including inherited properties in reverse order.
|
|
5
|
-
*
|
|
6
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The type of the object
|
|
9
|
-
* @param {T} object - The object to iterate over
|
|
10
|
-
* @param {(value: T[keyof T], key: string, collection: T) => any} iteratee - The function invoked per iteration
|
|
11
|
-
* @returns {T} Returns the object
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // Iterate over all properties including inherited ones
|
|
15
|
-
* const obj = { a: 1, b: 2 };
|
|
16
|
-
* forInRight(obj, (value, key) => {
|
|
17
|
-
* console.log(key, value);
|
|
18
|
-
* });
|
|
19
|
-
* // Output: 'b' 2, 'a' 1
|
|
20
|
-
*
|
|
21
|
-
* // Early termination
|
|
22
|
-
* forInRight(obj, (value, key) => {
|
|
23
|
-
* console.log(key, value);
|
|
24
|
-
* return key !== 'a'; // stop after 'a'
|
|
25
|
-
* });
|
|
26
|
-
* // Output: 'b' 2
|
|
27
|
-
*/
|
|
28
|
-
declare function forInRight<T>(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T;
|
|
29
|
-
/**
|
|
30
|
-
* Iterates over an object in reverse order and invokes the `iteratee` function for each property.
|
|
31
|
-
*
|
|
32
|
-
* Iterates over string keyed properties including inherited properties in reverse order.
|
|
33
|
-
*
|
|
34
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
35
|
-
*
|
|
36
|
-
* @template T - The type of the object
|
|
37
|
-
* @param {T | null | undefined} object - The object to iterate over
|
|
38
|
-
* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration
|
|
39
|
-
* @returns {T | null | undefined} Returns the object
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Iterate over all properties including inherited ones
|
|
43
|
-
* const obj = { a: 1, b: 2 };
|
|
44
|
-
* forInRight(obj, (value, key) => {
|
|
45
|
-
* console.log(key, value);
|
|
46
|
-
* });
|
|
47
|
-
* // Output: 'b' 2, 'a' 1
|
|
48
|
-
*
|
|
49
|
-
* // Early termination
|
|
50
|
-
* forInRight(obj, (value, key) => {
|
|
51
|
-
* console.log(key, value);
|
|
52
|
-
* return key !== 'a'; // stop after 'a'
|
|
53
|
-
* });
|
|
54
|
-
* // Output: 'b' 2
|
|
55
|
-
*/
|
|
56
|
-
declare function forInRight<T>(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined;
|
|
57
|
-
|
|
58
|
-
export { forInRight };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iterates over an object in reverse order and invokes the `iteratee` function for each property.
|
|
3
|
-
*
|
|
4
|
-
* Iterates over string keyed properties including inherited properties in reverse order.
|
|
5
|
-
*
|
|
6
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The type of the object
|
|
9
|
-
* @param {T} object - The object to iterate over
|
|
10
|
-
* @param {(value: T[keyof T], key: string, collection: T) => any} iteratee - The function invoked per iteration
|
|
11
|
-
* @returns {T} Returns the object
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // Iterate over all properties including inherited ones
|
|
15
|
-
* const obj = { a: 1, b: 2 };
|
|
16
|
-
* forInRight(obj, (value, key) => {
|
|
17
|
-
* console.log(key, value);
|
|
18
|
-
* });
|
|
19
|
-
* // Output: 'b' 2, 'a' 1
|
|
20
|
-
*
|
|
21
|
-
* // Early termination
|
|
22
|
-
* forInRight(obj, (value, key) => {
|
|
23
|
-
* console.log(key, value);
|
|
24
|
-
* return key !== 'a'; // stop after 'a'
|
|
25
|
-
* });
|
|
26
|
-
* // Output: 'b' 2
|
|
27
|
-
*/
|
|
28
|
-
declare function forInRight<T>(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T;
|
|
29
|
-
/**
|
|
30
|
-
* Iterates over an object in reverse order and invokes the `iteratee` function for each property.
|
|
31
|
-
*
|
|
32
|
-
* Iterates over string keyed properties including inherited properties in reverse order.
|
|
33
|
-
*
|
|
34
|
-
* The iteration is terminated early if the `iteratee` function returns `false`.
|
|
35
|
-
*
|
|
36
|
-
* @template T - The type of the object
|
|
37
|
-
* @param {T | null | undefined} object - The object to iterate over
|
|
38
|
-
* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration
|
|
39
|
-
* @returns {T | null | undefined} Returns the object
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Iterate over all properties including inherited ones
|
|
43
|
-
* const obj = { a: 1, b: 2 };
|
|
44
|
-
* forInRight(obj, (value, key) => {
|
|
45
|
-
* console.log(key, value);
|
|
46
|
-
* });
|
|
47
|
-
* // Output: 'b' 2, 'a' 1
|
|
48
|
-
*
|
|
49
|
-
* // Early termination
|
|
50
|
-
* forInRight(obj, (value, key) => {
|
|
51
|
-
* console.log(key, value);
|
|
52
|
-
* return key !== 'a'; // stop after 'a'
|
|
53
|
-
* });
|
|
54
|
-
* // Output: 'b' 2
|
|
55
|
-
*/
|
|
56
|
-
declare function forInRight<T>(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined;
|
|
57
|
-
|
|
58
|
-
export { forInRight };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { identity } from '../../function/identity.mjs';
|
|
2
|
-
|
|
3
|
-
function forInRight(object, iteratee = identity) {
|
|
4
|
-
if (object == null) {
|
|
5
|
-
return object;
|
|
6
|
-
}
|
|
7
|
-
const keys = [];
|
|
8
|
-
for (const key in object) {
|
|
9
|
-
keys.push(key);
|
|
10
|
-
}
|
|
11
|
-
for (let i = keys.length - 1; i >= 0; i--) {
|
|
12
|
-
const key = keys[i];
|
|
13
|
-
const result = iteratee(object[key], key, object);
|
|
14
|
-
if (result === false) {
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return object;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { forInRight };
|