es-toolkit 1.16.0-dev.459 → 1.16.0-dev.460
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/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/find.d.mts +1 -1
- package/dist/compat/array/find.d.ts +1 -1
- package/dist/compat/array/findIndex.d.mts +1 -1
- package/dist/compat/array/findIndex.d.ts +1 -1
- package/dist/compat/array/zipObjectDeep.d.mts +2 -1
- package/dist/compat/array/zipObjectDeep.d.ts +2 -1
- package/dist/compat/function/ary.d.mts +1 -1
- package/dist/compat/function/ary.d.ts +1 -1
- package/dist/compat/function/bind.d.mts +5 -6
- package/dist/compat/function/bind.d.ts +5 -6
- package/dist/compat/function/bind.mjs +3 -3
- package/dist/compat/function/rest.d.mts +1 -1
- package/dist/compat/function/rest.d.ts +1 -1
- package/dist/compat/index.js +3 -3
- package/dist/compat/object/mapKeys.d.mts +1 -1
- package/dist/compat/object/mapKeys.d.ts +1 -1
- package/dist/compat/object/merge.d.mts +1 -2
- package/dist/compat/object/merge.d.ts +1 -2
- package/dist/compat/object/mergeWith.d.mts +6 -7
- package/dist/compat/object/mergeWith.d.ts +6 -7
- package/dist/compat/object/property.d.mts +1 -1
- package/dist/compat/object/property.d.ts +1 -1
- package/dist/compat/object/set.d.mts +2 -2
- package/dist/compat/object/set.d.ts +2 -2
- package/dist/compat/predicate/isTypedArray.d.mts +1 -1
- package/dist/compat/predicate/isTypedArray.d.ts +1 -1
- package/dist/function/ary.d.mts +0 -1
- package/dist/function/ary.d.ts +0 -1
- package/dist/function/memoize.d.mts +1 -0
- package/dist/function/memoize.d.ts +1 -0
- package/dist/predicate/isBoolean.d.mts +1 -1
- package/dist/predicate/isBoolean.d.ts +1 -1
- package/dist/predicate/isPrimitive.d.mts +1 -1
- package/dist/predicate/isPrimitive.d.ts +1 -1
- package/dist/predicate/isString.d.mts +2 -2
- package/dist/predicate/isString.d.ts +2 -2
- package/dist/predicate/isTypedArray.d.mts +1 -1
- package/dist/predicate/isTypedArray.d.ts +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ declare function find<T>(arr: readonly T[], doesMatch: (item: T, index: number,
|
|
|
17
17
|
* Finds the first item in an array that matches the given partial object.
|
|
18
18
|
*
|
|
19
19
|
* @template T
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {T[]} arr - The array to search through.
|
|
21
21
|
* @param {Partial<T>} doesMatch - A partial object that specifies the properties to match.
|
|
22
22
|
* @returns {T | undefined} - The first item that matches the partial object, or `undefined` if no match is found.
|
|
23
23
|
*
|
|
@@ -17,7 +17,7 @@ declare function find<T>(arr: readonly T[], doesMatch: (item: T, index: number,
|
|
|
17
17
|
* Finds the first item in an array that matches the given partial object.
|
|
18
18
|
*
|
|
19
19
|
* @template T
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {T[]} arr - The array to search through.
|
|
21
21
|
* @param {Partial<T>} doesMatch - A partial object that specifies the properties to match.
|
|
22
22
|
* @returns {T | undefined} - The first item that matches the partial object, or `undefined` if no match is found.
|
|
23
23
|
*
|
|
@@ -17,7 +17,7 @@ declare function findIndex<T>(arr: readonly T[], doesMatch: (item: T, index: num
|
|
|
17
17
|
* Finds the index of the first item in an array that matches the given partial object.
|
|
18
18
|
*
|
|
19
19
|
* @template T
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {T[]} arr - The array to search through.
|
|
21
21
|
* @param {Partial<T>} doesMatch - A partial object that specifies the properties to match.
|
|
22
22
|
* @returns {number} - The index of the first item that matches the partial object, or `undefined` if no match is found.
|
|
23
23
|
*
|
|
@@ -17,7 +17,7 @@ declare function findIndex<T>(arr: readonly T[], doesMatch: (item: T, index: num
|
|
|
17
17
|
* Finds the index of the first item in an array that matches the given partial object.
|
|
18
18
|
*
|
|
19
19
|
* @template T
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {T[]} arr - The array to search through.
|
|
21
21
|
* @param {Partial<T>} doesMatch - A partial object that specifies the properties to match.
|
|
22
22
|
* @returns {number} - The index of the first item that matches the partial object, or `undefined` if no match is found.
|
|
23
23
|
*
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
|
9
9
|
*
|
|
10
|
-
* @template
|
|
10
|
+
* @template P - The type of property paths.
|
|
11
|
+
* @template V - The type of values corresponding to the property paths.
|
|
11
12
|
* @param {P[] | P[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
|
12
13
|
* @param {V[]} values - An array of values corresponding to the property paths.
|
|
13
14
|
* @returns {object} A new object composed of the given property paths and values.
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
|
9
9
|
*
|
|
10
|
-
* @template
|
|
10
|
+
* @template P - The type of property paths.
|
|
11
|
+
* @template V - The type of values corresponding to the property paths.
|
|
11
12
|
* @param {P[] | P[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
|
12
13
|
* @param {V[]} values - An array of values corresponding to the property paths.
|
|
13
14
|
* @returns {object} A new object composed of the given property paths and values.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @template F - The type of the function.
|
|
5
5
|
* @param {F} func - The function to cap arguments for.
|
|
6
|
-
* @param guard
|
|
7
6
|
* @param {number} n - The arity cap.
|
|
7
|
+
* @param {unknown} guard - The value to guard the arity cap.
|
|
8
8
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
9
9
|
*/
|
|
10
10
|
declare function ary<F extends (...args: any[]) => any>(func: F, n?: number, guard?: unknown): (...args: any[]) => ReturnType<F>;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @template F - The type of the function.
|
|
5
5
|
* @param {F} func - The function to cap arguments for.
|
|
6
|
-
* @param guard
|
|
7
6
|
* @param {number} n - The arity cap.
|
|
7
|
+
* @param {unknown} guard - The value to guard the arity cap.
|
|
8
8
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
9
9
|
*/
|
|
10
10
|
declare function ary<F extends (...args: any[]) => any>(func: F, n?: number, guard?: unknown): (...args: any[]) => ReturnType<F>;
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param
|
|
12
|
-
* @
|
|
13
|
-
* @returns {(...args: any[]) => any} Returns the new bound function.
|
|
8
|
+
* @template F - The type of the function to bind.
|
|
9
|
+
* @param {F} func - The function to bind.
|
|
10
|
+
* @param {unknown} thisObj - The `this` binding of `func`.
|
|
11
|
+
* @param {...any} partialArgs - The arguments to be partially applied.
|
|
12
|
+
* @returns {F} - Returns the new bound function.
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
16
15
|
* function greet(greeting, punctuation) {
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param
|
|
12
|
-
* @
|
|
13
|
-
* @returns {(...args: any[]) => any} Returns the new bound function.
|
|
8
|
+
* @template F - The type of the function to bind.
|
|
9
|
+
* @param {F} func - The function to bind.
|
|
10
|
+
* @param {unknown} thisObj - The `this` binding of `func`.
|
|
11
|
+
* @param {...any} partialArgs - The arguments to be partially applied.
|
|
12
|
+
* @returns {F} - Returns the new bound function.
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
16
15
|
* function greet(greeting, punctuation) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function bind(func, thisObj, ...partialArgs) {
|
|
2
|
-
const
|
|
2
|
+
const bound = function (...providedArgs) {
|
|
3
3
|
const args = [];
|
|
4
4
|
let startIndex = 0;
|
|
5
5
|
for (let i = 0; i < partialArgs.length; i++) {
|
|
@@ -14,12 +14,12 @@ function bind(func, thisObj, ...partialArgs) {
|
|
|
14
14
|
for (let i = startIndex; i < providedArgs.length; i++) {
|
|
15
15
|
args.push(providedArgs[i]);
|
|
16
16
|
}
|
|
17
|
-
if (this instanceof
|
|
17
|
+
if (this instanceof bound) {
|
|
18
18
|
return new func(...args);
|
|
19
19
|
}
|
|
20
20
|
return func.apply(thisObj, args);
|
|
21
21
|
};
|
|
22
|
-
return
|
|
22
|
+
return bound;
|
|
23
23
|
}
|
|
24
24
|
const bindPlaceholder = Symbol('bind.placeholder');
|
|
25
25
|
bind.placeholder = bindPlaceholder;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @template F - The type of the function being transformed.
|
|
7
7
|
* @param {F} func - The function whose arguments are to be transformed.
|
|
8
|
-
* @param {number} [
|
|
8
|
+
* @param {number} [start=func.length - 1] - The index from which to start grouping the remaining arguments into an array.
|
|
9
9
|
* Defaults to `func.length - 1`, grouping all arguments after the last parameter.
|
|
10
10
|
* @returns {(...args: any[]) => ReturnType<F>} A new function that, when called, returns the result of calling `func` with the transformed arguments.
|
|
11
11
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @template F - The type of the function being transformed.
|
|
7
7
|
* @param {F} func - The function whose arguments are to be transformed.
|
|
8
|
-
* @param {number} [
|
|
8
|
+
* @param {number} [start=func.length - 1] - The index from which to start grouping the remaining arguments into an array.
|
|
9
9
|
* Defaults to `func.length - 1`, grouping all arguments after the last parameter.
|
|
10
10
|
* @returns {(...args: any[]) => ReturnType<F>} A new function that, when called, returns the result of calling `func` with the transformed arguments.
|
|
11
11
|
*
|
package/dist/compat/index.js
CHANGED
|
@@ -581,7 +581,7 @@ function ary(func, n = func.length, guard) {
|
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
function bind(func, thisObj, ...partialArgs) {
|
|
584
|
-
const
|
|
584
|
+
const bound = function (...providedArgs) {
|
|
585
585
|
const args = [];
|
|
586
586
|
let startIndex = 0;
|
|
587
587
|
for (let i = 0; i < partialArgs.length; i++) {
|
|
@@ -596,12 +596,12 @@ function bind(func, thisObj, ...partialArgs) {
|
|
|
596
596
|
for (let i = startIndex; i < providedArgs.length; i++) {
|
|
597
597
|
args.push(providedArgs[i]);
|
|
598
598
|
}
|
|
599
|
-
if (this instanceof
|
|
599
|
+
if (this instanceof bound) {
|
|
600
600
|
return new func(...args);
|
|
601
601
|
}
|
|
602
602
|
return func.apply(thisObj, args);
|
|
603
603
|
};
|
|
604
|
-
return
|
|
604
|
+
return bound;
|
|
605
605
|
}
|
|
606
606
|
const bindPlaceholder = Symbol('bind.placeholder');
|
|
607
607
|
bind.placeholder = bindPlaceholder;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @param {T} object - The object to iterate over.
|
|
9
9
|
* @param {PropertyKey | PropertyKey[]} getNewKey - The path of the property to get to generate the new keys.
|
|
10
|
-
* @returns {Record<
|
|
10
|
+
* @returns {Record<PropertyKey, T[K1]>} - Returns the new mapped object.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* // Example usage:
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @param {T} object - The object to iterate over.
|
|
9
9
|
* @param {PropertyKey | PropertyKey[]} getNewKey - The path of the property to get to generate the new keys.
|
|
10
|
-
* @returns {Record<
|
|
10
|
+
* @returns {Record<PropertyKey, T[K1]>} - Returns the new mapped object.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* // Example usage:
|
|
@@ -183,8 +183,7 @@ declare function merge<O, S1, S2, S3, S4>(object: O, source1: S1, source2: S2, s
|
|
|
183
183
|
*
|
|
184
184
|
* The function can handle multiple source objects and will merge them all into the target object.
|
|
185
185
|
*
|
|
186
|
-
* @param {any}
|
|
187
|
-
* @param object
|
|
186
|
+
* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place.
|
|
188
187
|
* @param {any[]} sources - The source objects whose properties will be merged into the target object.
|
|
189
188
|
* @returns {any} The updated target object with properties from the source object(s) merged in.
|
|
190
189
|
*
|
|
@@ -183,8 +183,7 @@ declare function merge<O, S1, S2, S3, S4>(object: O, source1: S1, source2: S2, s
|
|
|
183
183
|
*
|
|
184
184
|
* The function can handle multiple source objects and will merge them all into the target object.
|
|
185
185
|
*
|
|
186
|
-
* @param {any}
|
|
187
|
-
* @param object
|
|
186
|
+
* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place.
|
|
188
187
|
* @param {any[]} sources - The source objects whose properties will be merged into the target object.
|
|
189
188
|
* @returns {any} The updated target object with properties from the source object(s) merged in.
|
|
190
189
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @param {T} target - The target object into which the source object properties will be merged. This object is modified in place.
|
|
22
22
|
* @param {S} source - The first source object whose properties will be merged into the target object.
|
|
23
|
-
* @param merge
|
|
23
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: T, source: S, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
24
24
|
* @returns {T & S} The updated target object with properties from the source object(s) merged in.
|
|
25
25
|
*
|
|
26
26
|
* @template T - Type of the target object.
|
|
@@ -72,7 +72,7 @@ declare function mergeWith<T, S>(target: T, source: S, merge: (targetValue: any,
|
|
|
72
72
|
* @param {O} object - The target object into which the source object properties will be merged. This object is modified in place.
|
|
73
73
|
* @param {S1} source1 - The first source object to be merged into the target object.
|
|
74
74
|
* @param {S2} source2 - The second source object to be merged into the target object.
|
|
75
|
-
* @param merge
|
|
75
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: any, source: any, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
76
76
|
* @returns {O & S1 & S2} The updated target object with properties from the source objects merged in.
|
|
77
77
|
*
|
|
78
78
|
* @template O - Type of the target object.
|
|
@@ -126,7 +126,7 @@ declare function mergeWith<O, S1, S2>(object: O, source1: S1, source2: S2, merge
|
|
|
126
126
|
* @param {S1} source1 - The first source object whose properties will be merged into the target object.
|
|
127
127
|
* @param {S2} source2 - The second source object whose properties will be merged into the target object.
|
|
128
128
|
* @param {S3} source3 - The third source object whose properties will be merged into the target object.
|
|
129
|
-
* @param merge
|
|
129
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: any, source: any, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
130
130
|
* @returns {O & S1 & S2 & S3} The updated target object with properties from the source object(s) merged in.
|
|
131
131
|
*
|
|
132
132
|
* @template O - Type of the target object.
|
|
@@ -182,7 +182,7 @@ declare function mergeWith<O, S1, S2, S3>(object: O, source1: S1, source2: S2, s
|
|
|
182
182
|
* @param {S2} source2 - The second source object whose properties will be merged into the target object.
|
|
183
183
|
* @param {S3} source3 - The third source object whose properties will be merged into the target object.
|
|
184
184
|
* @param {S4} source4 - The fourth source object whose properties will be merged into the target object.
|
|
185
|
-
* @param merge
|
|
185
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: any, source: any, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
186
186
|
* @returns {O & S1 & S2 & S3 & S4} The updated target object with properties from the source object(s) merged in.
|
|
187
187
|
*
|
|
188
188
|
* @template O - Type of the target object.
|
|
@@ -234,10 +234,9 @@ declare function mergeWith<O, S1, S2, S3, S4>(object: O, source1: S1, source2: S
|
|
|
234
234
|
*
|
|
235
235
|
* The function can handle multiple source objects and will merge them all into the target object.
|
|
236
236
|
*
|
|
237
|
-
* @param {any}
|
|
237
|
+
* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place.
|
|
238
238
|
* @param {any[]} sources - The source objects whose properties will be merged into the target object.
|
|
239
|
-
* @param object
|
|
240
|
-
* @param {...any} otherArgs
|
|
239
|
+
* @param {...any} otherArgs - Additional source objects to merge into the target object, including the custom `merge` function.
|
|
241
240
|
* @returns {any} The updated target object with properties from the source object(s) merged in.
|
|
242
241
|
*
|
|
243
242
|
* @example
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @param {T} target - The target object into which the source object properties will be merged. This object is modified in place.
|
|
22
22
|
* @param {S} source - The first source object whose properties will be merged into the target object.
|
|
23
|
-
* @param merge
|
|
23
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: T, source: S, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
24
24
|
* @returns {T & S} The updated target object with properties from the source object(s) merged in.
|
|
25
25
|
*
|
|
26
26
|
* @template T - Type of the target object.
|
|
@@ -72,7 +72,7 @@ declare function mergeWith<T, S>(target: T, source: S, merge: (targetValue: any,
|
|
|
72
72
|
* @param {O} object - The target object into which the source object properties will be merged. This object is modified in place.
|
|
73
73
|
* @param {S1} source1 - The first source object to be merged into the target object.
|
|
74
74
|
* @param {S2} source2 - The second source object to be merged into the target object.
|
|
75
|
-
* @param merge
|
|
75
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: any, source: any, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
76
76
|
* @returns {O & S1 & S2} The updated target object with properties from the source objects merged in.
|
|
77
77
|
*
|
|
78
78
|
* @template O - Type of the target object.
|
|
@@ -126,7 +126,7 @@ declare function mergeWith<O, S1, S2>(object: O, source1: S1, source2: S2, merge
|
|
|
126
126
|
* @param {S1} source1 - The first source object whose properties will be merged into the target object.
|
|
127
127
|
* @param {S2} source2 - The second source object whose properties will be merged into the target object.
|
|
128
128
|
* @param {S3} source3 - The third source object whose properties will be merged into the target object.
|
|
129
|
-
* @param merge
|
|
129
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: any, source: any, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
130
130
|
* @returns {O & S1 & S2 & S3} The updated target object with properties from the source object(s) merged in.
|
|
131
131
|
*
|
|
132
132
|
* @template O - Type of the target object.
|
|
@@ -182,7 +182,7 @@ declare function mergeWith<O, S1, S2, S3>(object: O, source1: S1, source2: S2, s
|
|
|
182
182
|
* @param {S2} source2 - The second source object whose properties will be merged into the target object.
|
|
183
183
|
* @param {S3} source3 - The third source object whose properties will be merged into the target object.
|
|
184
184
|
* @param {S4} source4 - The fourth source object whose properties will be merged into the target object.
|
|
185
|
-
* @param merge
|
|
185
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: any, source: any, stack: Map<any, any>) => any} merge - The function to customize merging properties.
|
|
186
186
|
* @returns {O & S1 & S2 & S3 & S4} The updated target object with properties from the source object(s) merged in.
|
|
187
187
|
*
|
|
188
188
|
* @template O - Type of the target object.
|
|
@@ -234,10 +234,9 @@ declare function mergeWith<O, S1, S2, S3, S4>(object: O, source1: S1, source2: S
|
|
|
234
234
|
*
|
|
235
235
|
* The function can handle multiple source objects and will merge them all into the target object.
|
|
236
236
|
*
|
|
237
|
-
* @param {any}
|
|
237
|
+
* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place.
|
|
238
238
|
* @param {any[]} sources - The source objects whose properties will be merged into the target object.
|
|
239
|
-
* @param object
|
|
240
|
-
* @param {...any} otherArgs
|
|
239
|
+
* @param {...any} otherArgs - Additional source objects to merge into the target object, including the custom `merge` function.
|
|
241
240
|
* @returns {any} The updated target object with properties from the source object(s) merged in.
|
|
242
241
|
*
|
|
243
242
|
* @example
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates a function that returns the value at a given path of an object.
|
|
3
3
|
*
|
|
4
|
-
* @param {PropertyKey |
|
|
4
|
+
* @param {PropertyKey | PropertyKey[]} path - The path of the property to get.
|
|
5
5
|
* @returns {(object: unknown) => any} - Returns a new function that takes an object and returns the value at the specified path.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates a function that returns the value at a given path of an object.
|
|
3
3
|
*
|
|
4
|
-
* @param {PropertyKey |
|
|
4
|
+
* @param {PropertyKey | PropertyKey[]} path - The path of the property to get.
|
|
5
5
|
* @returns {(object: unknown) => any} - Returns a new function that takes an object and returns the value at the specified path.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.
|
|
3
3
|
*
|
|
4
4
|
* @template T - The type of the object.
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
5
|
+
* @param {T} obj - The object to modify.
|
|
6
|
+
* @param {PropertyKey | PropertyKey[]} path - The path of the property to set.
|
|
7
7
|
* @param {any} value - The value to set.
|
|
8
8
|
* @returns {T} - The modified object.
|
|
9
9
|
*
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.
|
|
3
3
|
*
|
|
4
4
|
* @template T - The type of the object.
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
5
|
+
* @param {T} obj - The object to modify.
|
|
6
|
+
* @param {PropertyKey | PropertyKey[]} path - The path of the property to set.
|
|
7
7
|
* @param {any} value - The value to set.
|
|
8
8
|
* @returns {T} - The modified object.
|
|
9
9
|
*
|
package/dist/function/ary.d.mts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @template F - The type of the function.
|
|
5
5
|
* @param {F} func - The function to cap arguments for.
|
|
6
6
|
* @param {number} n - The arity cap.
|
|
7
|
-
* @param {any} guard - Enables use as an iteratee for methods like `map`.
|
|
8
7
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
9
8
|
*/
|
|
10
9
|
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (...args: any[]) => ReturnType<F>;
|
package/dist/function/ary.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @template F - The type of the function.
|
|
5
5
|
* @param {F} func - The function to cap arguments for.
|
|
6
6
|
* @param {number} n - The arity cap.
|
|
7
|
-
* @param {any} guard - Enables use as an iteratee for methods like `map`.
|
|
8
7
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
9
8
|
*/
|
|
10
9
|
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (...args: any[]) => ReturnType<F>;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* If the argument is not primitive (e.g., arrays or objects), provide a
|
|
11
11
|
* `getCacheKey` function to generate a unique cache key for proper caching.
|
|
12
12
|
*
|
|
13
|
+
* @template F - The type of the function to be memoized.
|
|
13
14
|
* @param {F} fn - The function to be memoized. It should accept a single argument and return a value.
|
|
14
15
|
* @param {MemoizeOptions<Parameters<F>[0], ReturnType<F>>} [options={}] - Optional configuration for the memoization.
|
|
15
16
|
* @param {MemoizeCache<any, V>} [options.cache] - The cache object used to store results. Defaults to a new `Map`.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* If the argument is not primitive (e.g., arrays or objects), provide a
|
|
11
11
|
* `getCacheKey` function to generate a unique cache key for proper caching.
|
|
12
12
|
*
|
|
13
|
+
* @template F - The type of the function to be memoized.
|
|
13
14
|
* @param {F} fn - The function to be memoized. It should accept a single argument and return a value.
|
|
14
15
|
* @param {MemoizeOptions<Parameters<F>[0], ReturnType<F>>} [options={}] - Optional configuration for the memoization.
|
|
15
16
|
* @param {MemoizeCache<any, V>} [options.cache] - The cache object used to store results. Defaults to a new `Map`.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `boolean`.
|
|
8
8
|
*
|
|
9
9
|
* @param {unknown} x - The Value to test if it is boolean.
|
|
10
|
-
* @returns {x is boolean} True if the value is
|
|
10
|
+
* @returns {x is boolean} True if the value is boolean, false otherwise.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `boolean`.
|
|
8
8
|
*
|
|
9
9
|
* @param {unknown} x - The Value to test if it is boolean.
|
|
10
|
-
* @returns {x is boolean} True if the value is
|
|
10
|
+
* @returns {x is boolean} True if the value is boolean, false otherwise.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Checks if a given value is
|
|
2
|
+
* Checks if a given value is string.
|
|
3
3
|
*
|
|
4
4
|
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `string`.
|
|
5
5
|
*
|
|
6
6
|
* @param {unknown} value The value to check if it is string.
|
|
7
|
-
* @returns {value is string} Returns `true` if `value` is a
|
|
7
|
+
* @returns {value is string} Returns `true` if `value` is a string, else `false`.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* const value1 = 'abc';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Checks if a given value is
|
|
2
|
+
* Checks if a given value is string.
|
|
3
3
|
*
|
|
4
4
|
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `string`.
|
|
5
5
|
*
|
|
6
6
|
* @param {unknown} value The value to check if it is string.
|
|
7
|
-
* @returns {value is string} Returns `true` if `value` is a
|
|
7
|
+
* @returns {value is string} Returns `true` if `value` is a string, else `false`.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* const value1 = 'abc';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.16.0-dev.
|
|
4
|
+
"version": "1.16.0-dev.460+9862a7d7",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|