es-toolkit 1.27.0 → 1.28.0-dev.910
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/CHANGELOG.md +14 -0
- package/dist/_chunk/{isWeakSet-D8h8bS.js → isWeakSet-CvIdTA.js} +5 -0
- package/dist/_chunk/{toMerged-CPY8Ug.js → toMerged-AV73JV.js} +77 -65
- package/dist/_chunk/{upperFirst-DK_rTF.js → upperFirst-CorAVn.js} +1 -0
- package/dist/array/differenceBy.d.mts +10 -3
- package/dist/array/differenceBy.d.ts +10 -3
- package/dist/array/differenceWith.d.mts +11 -4
- package/dist/array/differenceWith.d.ts +11 -4
- package/dist/array/flatMap.d.mts +1 -1
- package/dist/array/flatMap.d.ts +1 -1
- package/dist/array/intersectionBy.d.mts +16 -5
- package/dist/array/intersectionBy.d.ts +16 -5
- package/dist/array/intersectionWith.d.mts +16 -4
- package/dist/array/intersectionWith.d.ts +16 -4
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/dropRightWhile.d.mts +2 -2
- package/dist/compat/array/dropRightWhile.d.ts +2 -2
- package/dist/compat/array/dropRightWhile.mjs +2 -0
- package/dist/compat/array/dropWhile.d.mts +2 -2
- package/dist/compat/array/dropWhile.d.ts +2 -2
- package/dist/compat/array/dropWhile.mjs +2 -0
- package/dist/compat/array/every.d.mts +6 -6
- package/dist/compat/array/every.d.ts +6 -6
- package/dist/compat/array/every.mjs +2 -0
- package/dist/compat/array/filter.d.mts +4 -4
- package/dist/compat/array/filter.d.ts +4 -4
- package/dist/compat/array/filter.mjs +2 -0
- package/dist/compat/array/find.d.mts +6 -6
- package/dist/compat/array/find.d.ts +6 -6
- package/dist/compat/array/find.mjs +2 -0
- package/dist/compat/array/findIndex.d.mts +3 -3
- package/dist/compat/array/findIndex.d.ts +3 -3
- package/dist/compat/array/findIndex.mjs +2 -0
- package/dist/compat/array/findLastIndex.d.mts +3 -3
- package/dist/compat/array/findLastIndex.d.ts +3 -3
- package/dist/compat/array/findLastIndex.mjs +2 -0
- package/dist/compat/array/some.d.mts +5 -5
- package/dist/compat/array/some.d.ts +5 -5
- package/dist/compat/array/some.mjs +2 -0
- package/dist/compat/array/uniqBy.d.mts +34 -13
- package/dist/compat/array/uniqBy.d.ts +34 -13
- package/dist/compat/array/uniqBy.mjs +3 -16
- package/dist/compat/function/debounce.d.mts +7 -5
- package/dist/compat/function/debounce.d.ts +7 -5
- package/dist/compat/function/throttle.d.mts +3 -4
- package/dist/compat/function/throttle.d.ts +3 -4
- package/dist/compat/function/throttle.mjs +6 -1
- package/dist/compat/index.d.mts +13 -2
- package/dist/compat/index.d.ts +13 -2
- package/dist/compat/index.js +211 -69
- package/dist/compat/index.mjs +11 -1
- package/dist/compat/math/add.d.mts +18 -0
- package/dist/compat/math/add.d.ts +18 -0
- package/dist/compat/math/add.mjs +5 -0
- package/dist/compat/object/assignIn.d.mts +103 -0
- package/dist/compat/object/assignIn.d.ts +103 -0
- package/dist/compat/object/assignIn.mjs +20 -0
- package/dist/compat/object/cloneDeep.mjs +2 -24
- package/dist/compat/object/cloneDeepWith.d.mts +38 -0
- package/dist/compat/object/cloneDeepWith.d.ts +38 -0
- package/dist/compat/object/cloneDeepWith.mjs +35 -0
- package/dist/compat/object/keysIn.d.mts +26 -0
- package/dist/compat/object/keysIn.d.ts +26 -0
- package/dist/compat/object/keysIn.mjs +53 -0
- package/dist/compat/predicate/isElement.d.mts +13 -0
- package/dist/compat/predicate/isElement.d.ts +13 -0
- package/dist/compat/predicate/isElement.mjs +8 -0
- package/dist/compat/string/toUpper.d.mts +20 -0
- package/dist/compat/string/toUpper.d.ts +20 -0
- package/dist/compat/string/toUpper.mjs +7 -0
- package/dist/compat/string/trim.mjs +1 -1
- package/dist/compat/string/trimEnd.mjs +1 -1
- package/dist/compat/string/trimStart.mjs +1 -1
- package/dist/compat/string/words.d.mts +15 -0
- package/dist/compat/string/words.d.ts +15 -0
- package/dist/compat/string/words.mjs +10 -0
- package/dist/compat/util/gt.d.mts +15 -0
- package/dist/compat/util/gt.d.ts +15 -0
- package/dist/compat/util/gt.mjs +10 -0
- package/dist/compat/util/gte.d.mts +15 -0
- package/dist/compat/util/gte.d.ts +15 -0
- package/dist/compat/util/gte.mjs +10 -0
- package/dist/compat/util/iteratee.d.mts +1 -1
- package/dist/compat/util/iteratee.d.ts +1 -1
- package/dist/compat/util/toArray.d.mts +15 -0
- package/dist/compat/util/toArray.d.ts +15 -0
- package/dist/compat/util/toArray.mjs +20 -0
- package/dist/function/debounce.d.mts +24 -22
- package/dist/function/debounce.d.ts +24 -22
- package/dist/function/index.d.mts +2 -2
- package/dist/function/index.d.ts +2 -2
- package/dist/function/partial.d.mts +533 -15
- package/dist/function/partial.d.ts +533 -15
- package/dist/function/partialRight.d.mts +610 -15
- package/dist/function/partialRight.d.ts +610 -15
- package/dist/function/throttle.d.mts +7 -5
- package/dist/function/throttle.d.ts +7 -5
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -3
- package/dist/index.mjs +2 -0
- package/dist/object/cloneDeep.mjs +3 -110
- package/dist/object/cloneDeepWith.d.mts +38 -0
- package/dist/object/cloneDeepWith.d.ts +38 -0
- package/dist/object/cloneDeepWith.mjs +121 -0
- package/dist/object/index.d.mts +1 -0
- package/dist/object/index.d.ts +1 -0
- package/dist/object/index.js +2 -1
- package/dist/object/index.mjs +1 -0
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +2 -1
- package/dist/predicate/index.mjs +1 -0
- package/dist/predicate/isBuffer.d.mts +21 -0
- package/dist/predicate/isBuffer.d.ts +21 -0
- package/dist/predicate/isBuffer.mjs +5 -0
- package/dist/string/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if value is greater than other.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to compare.
|
|
5
|
+
* @param {unknown} other The other value to compare.
|
|
6
|
+
* @returns {boolean} Returns `true` if value is greater than other, else `false`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* gt(3, 1); // true
|
|
10
|
+
* gt(3, 3); // false
|
|
11
|
+
* gt(1, 3); // false
|
|
12
|
+
*/
|
|
13
|
+
declare function gt(value: unknown, other: unknown): boolean;
|
|
14
|
+
|
|
15
|
+
export { gt };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if value is greater than or equal to other.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to compare.
|
|
5
|
+
* @param {unknown} other The other value to compare.
|
|
6
|
+
* @returns {boolean} Returns `true` if value is greater than or equal to other, else `false`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* gte(3, 1); // => true
|
|
10
|
+
* gte(3, 3); // => true
|
|
11
|
+
* gte(1, 3); // => false
|
|
12
|
+
*/
|
|
13
|
+
declare function gte(value: unknown, other: unknown): boolean;
|
|
14
|
+
|
|
15
|
+
export { gte };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if value is greater than or equal to other.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to compare.
|
|
5
|
+
* @param {unknown} other The other value to compare.
|
|
6
|
+
* @returns {boolean} Returns `true` if value is greater than or equal to other, else `false`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* gte(3, 1); // => true
|
|
10
|
+
* gte(3, 3); // => true
|
|
11
|
+
* gte(1, 3); // => false
|
|
12
|
+
*/
|
|
13
|
+
declare function gte(value: unknown, other: unknown): boolean;
|
|
14
|
+
|
|
15
|
+
export { gte };
|
|
@@ -39,6 +39,6 @@ declare function iteratee<F extends (...args: any[]) => unknown>(func: F): F;
|
|
|
39
39
|
* const func = iteratee(['a', 1]);
|
|
40
40
|
* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 }
|
|
41
41
|
*/
|
|
42
|
-
declare function iteratee(value
|
|
42
|
+
declare function iteratee(value?: symbol | number | string | object): (...args: any[]) => any;
|
|
43
43
|
|
|
44
44
|
export { iteratee };
|
|
@@ -39,6 +39,6 @@ declare function iteratee<F extends (...args: any[]) => unknown>(func: F): F;
|
|
|
39
39
|
* const func = iteratee(['a', 1]);
|
|
40
40
|
* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 }
|
|
41
41
|
*/
|
|
42
|
-
declare function iteratee(value
|
|
42
|
+
declare function iteratee(value?: symbol | number | string | object): (...args: any[]) => any;
|
|
43
43
|
|
|
44
44
|
export { iteratee };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a value to an array.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value - The value to convert.
|
|
5
|
+
* @returns {any[]} Returns the converted array.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* toArray({ 'a': 1, 'b': 2 }) // => returns [1,2]
|
|
9
|
+
* toArray('abc') // => returns ['a', 'b', 'c']
|
|
10
|
+
* toArray(1) // => returns []
|
|
11
|
+
* toArray(null) // => returns []
|
|
12
|
+
*/
|
|
13
|
+
declare function toArray(value?: unknown): any[];
|
|
14
|
+
|
|
15
|
+
export { toArray };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a value to an array.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value - The value to convert.
|
|
5
|
+
* @returns {any[]} Returns the converted array.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* toArray({ 'a': 1, 'b': 2 }) // => returns [1,2]
|
|
9
|
+
* toArray('abc') // => returns ['a', 'b', 'c']
|
|
10
|
+
* toArray(1) // => returns []
|
|
11
|
+
* toArray(null) // => returns []
|
|
12
|
+
*/
|
|
13
|
+
declare function toArray(value?: unknown): any[];
|
|
14
|
+
|
|
15
|
+
export { toArray };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isArrayLike } from '../predicate/isArrayLike.mjs';
|
|
2
|
+
import { isMap } from '../predicate/isMap.mjs';
|
|
3
|
+
|
|
4
|
+
function toArray(value) {
|
|
5
|
+
if (value == null) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
if (isArrayLike(value) || isMap(value)) {
|
|
9
|
+
return Array.from(value);
|
|
10
|
+
}
|
|
11
|
+
if (typeof value === 'string') {
|
|
12
|
+
return value.split('');
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === 'object') {
|
|
15
|
+
return Object.values(value);
|
|
16
|
+
}
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { toArray };
|
|
@@ -12,6 +12,28 @@ interface DebounceOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
edges?: Array<'leading' | 'trailing'>;
|
|
14
14
|
}
|
|
15
|
+
interface DebouncedFunction<F extends (...args: any[]) => void> {
|
|
16
|
+
(...args: Parameters<F>): void;
|
|
17
|
+
/**
|
|
18
|
+
* Schedules the execution of the debounced function after the specified debounce delay.
|
|
19
|
+
* This method resets any existing timer, ensuring that the function is only invoked
|
|
20
|
+
* after the delay has elapsed since the last call to the debounced function.
|
|
21
|
+
* It is typically called internally whenever the debounced function is invoked.
|
|
22
|
+
*
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
25
|
+
schedule: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Cancels any pending execution of the debounced function.
|
|
28
|
+
* This method clears the active timer and resets any stored context or arguments.
|
|
29
|
+
*/
|
|
30
|
+
cancel: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Immediately invokes the debounced function if there is a pending execution.
|
|
33
|
+
* This method also cancels the current timer, ensuring that the function executes right away.
|
|
34
|
+
*/
|
|
35
|
+
flush: () => void;
|
|
36
|
+
}
|
|
15
37
|
/**
|
|
16
38
|
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
|
17
39
|
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
|
@@ -47,26 +69,6 @@ interface DebounceOptions {
|
|
|
47
69
|
* // Will cancel the debounced function call
|
|
48
70
|
* controller.abort();
|
|
49
71
|
*/
|
|
50
|
-
declare function debounce<F extends (...args: any[]) => void>(func: F, debounceMs: number, { signal, edges }?: DebounceOptions):
|
|
51
|
-
/**
|
|
52
|
-
* Schedules the execution of the debounced function after the specified debounce delay.
|
|
53
|
-
* This method resets any existing timer, ensuring that the function is only invoked
|
|
54
|
-
* after the delay has elapsed since the last call to the debounced function.
|
|
55
|
-
* It is typically called internally whenever the debounced function is invoked.
|
|
56
|
-
*
|
|
57
|
-
* @returns {void}
|
|
58
|
-
*/
|
|
59
|
-
schedule: () => void;
|
|
60
|
-
/**
|
|
61
|
-
* Cancels any pending execution of the debounced function.
|
|
62
|
-
* This method clears the active timer and resets any stored context or arguments.
|
|
63
|
-
*/
|
|
64
|
-
cancel: () => void;
|
|
65
|
-
/**
|
|
66
|
-
* Immediately invokes the debounced function if there is a pending execution.
|
|
67
|
-
* This method also cancels the current timer, ensuring that the function executes right away.
|
|
68
|
-
*/
|
|
69
|
-
flush: () => void;
|
|
70
|
-
};
|
|
72
|
+
declare function debounce<F extends (...args: any[]) => void>(func: F, debounceMs: number, { signal, edges }?: DebounceOptions): DebouncedFunction<F>;
|
|
71
73
|
|
|
72
|
-
export { debounce };
|
|
74
|
+
export { type DebouncedFunction, debounce };
|
|
@@ -12,6 +12,28 @@ interface DebounceOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
edges?: Array<'leading' | 'trailing'>;
|
|
14
14
|
}
|
|
15
|
+
interface DebouncedFunction<F extends (...args: any[]) => void> {
|
|
16
|
+
(...args: Parameters<F>): void;
|
|
17
|
+
/**
|
|
18
|
+
* Schedules the execution of the debounced function after the specified debounce delay.
|
|
19
|
+
* This method resets any existing timer, ensuring that the function is only invoked
|
|
20
|
+
* after the delay has elapsed since the last call to the debounced function.
|
|
21
|
+
* It is typically called internally whenever the debounced function is invoked.
|
|
22
|
+
*
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
25
|
+
schedule: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Cancels any pending execution of the debounced function.
|
|
28
|
+
* This method clears the active timer and resets any stored context or arguments.
|
|
29
|
+
*/
|
|
30
|
+
cancel: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Immediately invokes the debounced function if there is a pending execution.
|
|
33
|
+
* This method also cancels the current timer, ensuring that the function executes right away.
|
|
34
|
+
*/
|
|
35
|
+
flush: () => void;
|
|
36
|
+
}
|
|
15
37
|
/**
|
|
16
38
|
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
|
17
39
|
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
|
@@ -47,26 +69,6 @@ interface DebounceOptions {
|
|
|
47
69
|
* // Will cancel the debounced function call
|
|
48
70
|
* controller.abort();
|
|
49
71
|
*/
|
|
50
|
-
declare function debounce<F extends (...args: any[]) => void>(func: F, debounceMs: number, { signal, edges }?: DebounceOptions):
|
|
51
|
-
/**
|
|
52
|
-
* Schedules the execution of the debounced function after the specified debounce delay.
|
|
53
|
-
* This method resets any existing timer, ensuring that the function is only invoked
|
|
54
|
-
* after the delay has elapsed since the last call to the debounced function.
|
|
55
|
-
* It is typically called internally whenever the debounced function is invoked.
|
|
56
|
-
*
|
|
57
|
-
* @returns {void}
|
|
58
|
-
*/
|
|
59
|
-
schedule: () => void;
|
|
60
|
-
/**
|
|
61
|
-
* Cancels any pending execution of the debounced function.
|
|
62
|
-
* This method clears the active timer and resets any stored context or arguments.
|
|
63
|
-
*/
|
|
64
|
-
cancel: () => void;
|
|
65
|
-
/**
|
|
66
|
-
* Immediately invokes the debounced function if there is a pending execution.
|
|
67
|
-
* This method also cancels the current timer, ensuring that the function executes right away.
|
|
68
|
-
*/
|
|
69
|
-
flush: () => void;
|
|
70
|
-
};
|
|
72
|
+
declare function debounce<F extends (...args: any[]) => void>(func: F, debounceMs: number, { signal, edges }?: DebounceOptions): DebouncedFunction<F>;
|
|
71
73
|
|
|
72
|
-
export { debounce };
|
|
74
|
+
export { type DebouncedFunction, debounce };
|
|
@@ -3,7 +3,7 @@ export { ary } from './ary.mjs';
|
|
|
3
3
|
export { before } from './before.mjs';
|
|
4
4
|
export { curry } from './curry.mjs';
|
|
5
5
|
export { curryRight } from './curryRight.mjs';
|
|
6
|
-
export { debounce } from './debounce.mjs';
|
|
6
|
+
export { DebouncedFunction, debounce } from './debounce.mjs';
|
|
7
7
|
export { flow } from './flow.mjs';
|
|
8
8
|
export { flowRight } from './flowRight.mjs';
|
|
9
9
|
export { identity } from './identity.mjs';
|
|
@@ -15,5 +15,5 @@ export { partial } from './partial.mjs';
|
|
|
15
15
|
export { partialRight } from './partialRight.mjs';
|
|
16
16
|
export { rest } from './rest.mjs';
|
|
17
17
|
export { spread } from './spread.mjs';
|
|
18
|
-
export { throttle } from './throttle.mjs';
|
|
18
|
+
export { ThrottledFunction, throttle } from './throttle.mjs';
|
|
19
19
|
export { unary } from './unary.mjs';
|
package/dist/function/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { ary } from './ary.js';
|
|
|
3
3
|
export { before } from './before.js';
|
|
4
4
|
export { curry } from './curry.js';
|
|
5
5
|
export { curryRight } from './curryRight.js';
|
|
6
|
-
export { debounce } from './debounce.js';
|
|
6
|
+
export { DebouncedFunction, debounce } from './debounce.js';
|
|
7
7
|
export { flow } from './flow.js';
|
|
8
8
|
export { flowRight } from './flowRight.js';
|
|
9
9
|
export { identity } from './identity.js';
|
|
@@ -15,5 +15,5 @@ export { partial } from './partial.js';
|
|
|
15
15
|
export { partialRight } from './partialRight.js';
|
|
16
16
|
export { rest } from './rest.js';
|
|
17
17
|
export { spread } from './spread.js';
|
|
18
|
-
export { throttle } from './throttle.js';
|
|
18
|
+
export { ThrottledFunction, throttle } from './throttle.js';
|
|
19
19
|
export { unary } from './unary.js';
|