es-toolkit 1.15.1-dev.422 → 1.15.1-dev.424
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/{isFunction-D0hq6d.js → isFunction-DPic3X.js} +3 -5
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/getSymbols.mjs +1 -2
- package/dist/compat/function/ary.d.mts +1 -1
- package/dist/compat/function/ary.d.ts +1 -1
- package/dist/compat/index.d.mts +2 -0
- package/dist/compat/index.d.ts +2 -0
- package/dist/compat/index.js +5 -8
- package/dist/compat/index.mjs +2 -0
- package/dist/compat/object/set.mjs +1 -5
- package/dist/compat/predicate/isArrayLike.mjs +1 -2
- package/dist/function/ary.d.mts +1 -1
- package/dist/function/ary.d.ts +1 -1
- package/dist/function/index.d.mts +2 -0
- package/dist/function/index.d.ts +2 -0
- package/dist/function/index.js +48 -0
- package/dist/function/index.mjs +2 -0
- package/dist/function/partial.d.mts +33 -0
- package/dist/function/partial.d.ts +33 -0
- package/dist/function/partial.mjs +23 -0
- package/dist/function/partialRight.d.mts +33 -0
- package/dist/function/partialRight.d.ts +33 -0
- package/dist/function/partialRight.mjs +25 -0
- package/dist/function/unary.d.mts +1 -1
- package/dist/function/unary.d.ts +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/index.mjs +2 -0
- package/dist/predicate/index.js +1 -1
- package/dist/predicate/isEqual.mjs +2 -3
- package/dist/string/camelCase.mjs +2 -2
- package/dist/string/index.js +2 -2
- package/package.json +1 -1
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @param {number} n - The arity cap.
|
|
7
7
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
8
8
|
*/
|
|
9
|
-
declare function ary<F extends (...args: any[]) => any>(func: F, n?: number, guard?: unknown): (
|
|
9
|
+
declare function ary<F extends (...args: any[]) => any>(func: F, n?: number, guard?: unknown): (...args: any[]) => ReturnType<F>;
|
|
10
10
|
|
|
11
11
|
export { ary };
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @param {number} n - The arity cap.
|
|
7
7
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
8
8
|
*/
|
|
9
|
-
declare function ary<F extends (...args: any[]) => any>(func: F, n?: number, guard?: unknown): (
|
|
9
|
+
declare function ary<F extends (...args: any[]) => any>(func: F, n?: number, guard?: unknown): (...args: any[]) => ReturnType<F>;
|
|
10
10
|
|
|
11
11
|
export { ary };
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -54,6 +54,8 @@ export { once } from '../function/once.mjs';
|
|
|
54
54
|
export { throttle } from '../function/throttle.mjs';
|
|
55
55
|
export { negate } from '../function/negate.mjs';
|
|
56
56
|
export { unary } from '../function/unary.mjs';
|
|
57
|
+
export { partial } from '../function/partial.mjs';
|
|
58
|
+
export { partialRight } from '../function/partialRight.mjs';
|
|
57
59
|
export { clamp } from '../math/clamp.mjs';
|
|
58
60
|
export { inRange } from '../math/inRange.mjs';
|
|
59
61
|
export { mean } from '../math/mean.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ export { once } from '../function/once.js';
|
|
|
54
54
|
export { throttle } from '../function/throttle.js';
|
|
55
55
|
export { negate } from '../function/negate.js';
|
|
56
56
|
export { unary } from '../function/unary.js';
|
|
57
|
+
export { partial } from '../function/partial.js';
|
|
58
|
+
export { partialRight } from '../function/partialRight.js';
|
|
57
59
|
export { clamp } from '../math/clamp.js';
|
|
58
60
|
export { inRange } from '../math/inRange.js';
|
|
59
61
|
export { mean } from '../math/mean.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const function_index = require('../function/index.js');
|
|
|
8
8
|
const math_index = require('../math/index.js');
|
|
9
9
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
10
10
|
const toMerged = require('../_chunk/toMerged-BGwYW5.js');
|
|
11
|
-
const isFunction = require('../_chunk/isFunction-
|
|
11
|
+
const isFunction = require('../_chunk/isFunction-DPic3X.js');
|
|
12
12
|
const isTypedArray$1 = require('../_chunk/isTypedArray-BBEkFl.js');
|
|
13
13
|
const string_index = require('../string/index.js');
|
|
14
14
|
|
|
@@ -229,11 +229,7 @@ function isIndex(value) {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
function set(obj, path, value) {
|
|
232
|
-
const resolvedPath = Array.isArray(path)
|
|
233
|
-
? path
|
|
234
|
-
: typeof path === 'string'
|
|
235
|
-
? toPath(path)
|
|
236
|
-
: [path];
|
|
232
|
+
const resolvedPath = Array.isArray(path) ? path : typeof path === 'string' ? toPath(path) : [path];
|
|
237
233
|
let current = obj;
|
|
238
234
|
for (let i = 0; i < resolvedPath.length - 1; i++) {
|
|
239
235
|
const key = resolvedPath[i];
|
|
@@ -516,8 +512,7 @@ function isArray(value) {
|
|
|
516
512
|
}
|
|
517
513
|
|
|
518
514
|
function isArrayLike(value) {
|
|
519
|
-
return value != null && typeof value !==
|
|
520
|
-
isFunction.isLength(value.length);
|
|
515
|
+
return value != null && typeof value !== 'function' && isFunction.isLength(value.length);
|
|
521
516
|
}
|
|
522
517
|
|
|
523
518
|
function isBoolean(x) {
|
|
@@ -727,6 +722,8 @@ exports.debounce = function_index.debounce;
|
|
|
727
722
|
exports.negate = function_index.negate;
|
|
728
723
|
exports.noop = function_index.noop;
|
|
729
724
|
exports.once = function_index.once;
|
|
725
|
+
exports.partial = function_index.partial;
|
|
726
|
+
exports.partialRight = function_index.partialRight;
|
|
730
727
|
exports.throttle = function_index.throttle;
|
|
731
728
|
exports.unary = function_index.unary;
|
|
732
729
|
exports.clamp = math_index.clamp;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -54,6 +54,8 @@ export { once } from '../function/once.mjs';
|
|
|
54
54
|
export { throttle } from '../function/throttle.mjs';
|
|
55
55
|
export { negate } from '../function/negate.mjs';
|
|
56
56
|
export { unary } from '../function/unary.mjs';
|
|
57
|
+
export { partial } from '../function/partial.mjs';
|
|
58
|
+
export { partialRight } from '../function/partialRight.mjs';
|
|
57
59
|
export { clamp } from '../math/clamp.mjs';
|
|
58
60
|
export { inRange } from '../math/inRange.mjs';
|
|
59
61
|
export { mean } from '../math/mean.mjs';
|
|
@@ -2,11 +2,7 @@ import { isIndex } from '../_internal/isIndex.mjs';
|
|
|
2
2
|
import { toPath } from '../_internal/toPath.mjs';
|
|
3
3
|
|
|
4
4
|
function set(obj, path, value) {
|
|
5
|
-
const resolvedPath = Array.isArray(path)
|
|
6
|
-
? path
|
|
7
|
-
: typeof path === 'string'
|
|
8
|
-
? toPath(path)
|
|
9
|
-
: [path];
|
|
5
|
+
const resolvedPath = Array.isArray(path) ? path : typeof path === 'string' ? toPath(path) : [path];
|
|
10
6
|
let current = obj;
|
|
11
7
|
for (let i = 0; i < resolvedPath.length - 1; i++) {
|
|
12
8
|
const key = resolvedPath[i];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { isLength } from '../../predicate/isLength.mjs';
|
|
2
2
|
|
|
3
3
|
function isArrayLike(value) {
|
|
4
|
-
return value != null && typeof value !==
|
|
5
|
-
isLength(value.length);
|
|
4
|
+
return value != null && typeof value !== 'function' && isLength(value.length);
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
export { isArrayLike };
|
package/dist/function/ary.d.mts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* @param {any} guard - Enables use as an iteratee for methods like `map`.
|
|
8
8
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
9
9
|
*/
|
|
10
|
-
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (
|
|
10
|
+
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (...args: any[]) => ReturnType<F>;
|
|
11
11
|
|
|
12
12
|
export { ary };
|
package/dist/function/ary.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* @param {any} guard - Enables use as an iteratee for methods like `map`.
|
|
8
8
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
9
9
|
*/
|
|
10
|
-
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (
|
|
10
|
+
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (...args: any[]) => ReturnType<F>;
|
|
11
11
|
|
|
12
12
|
export { ary };
|
package/dist/function/index.d.ts
CHANGED
package/dist/function/index.js
CHANGED
|
@@ -97,6 +97,52 @@ function unary(func) {
|
|
|
97
97
|
return ary(func, 1);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
function partial(func, ...partialArgs) {
|
|
101
|
+
return function (...providedArgs) {
|
|
102
|
+
const args = [];
|
|
103
|
+
let startIndex = 0;
|
|
104
|
+
for (let i = 0; i < partialArgs.length; i++) {
|
|
105
|
+
const arg = partialArgs[i];
|
|
106
|
+
if (arg === partial.placeholder) {
|
|
107
|
+
args.push(providedArgs[startIndex++]);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
args.push(arg);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (let i = startIndex; i < providedArgs.length; i++) {
|
|
114
|
+
args.push(providedArgs[i]);
|
|
115
|
+
}
|
|
116
|
+
return func.apply(this, args);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const partialPlaceholder = Symbol('partial.placeholder');
|
|
120
|
+
partial.placeholder = partialPlaceholder;
|
|
121
|
+
|
|
122
|
+
function partialRight(func, ...partialArgs) {
|
|
123
|
+
return function (...providedArgs) {
|
|
124
|
+
const placeholderLength = partialArgs.filter(arg => arg === partialRightPlaceholder).length;
|
|
125
|
+
const rangeLength = Math.max(providedArgs.length - placeholderLength, 0);
|
|
126
|
+
const args = [];
|
|
127
|
+
let providedIndex = 0;
|
|
128
|
+
for (let i = 0; i < rangeLength; i++) {
|
|
129
|
+
args.push(providedArgs[providedIndex++]);
|
|
130
|
+
}
|
|
131
|
+
for (let i = 0; i < partialArgs.length; i++) {
|
|
132
|
+
const arg = partialArgs[i];
|
|
133
|
+
if (arg === partialRight.placeholder) {
|
|
134
|
+
args.push(providedArgs[providedIndex++]);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
args.push(arg);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return func.apply(this, args);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const partialRightPlaceholder = Symbol('partialRight.placeholder');
|
|
144
|
+
partialRight.placeholder = partialRightPlaceholder;
|
|
145
|
+
|
|
100
146
|
exports.after = after;
|
|
101
147
|
exports.ary = ary;
|
|
102
148
|
exports.before = before;
|
|
@@ -104,5 +150,7 @@ exports.debounce = debounce;
|
|
|
104
150
|
exports.negate = negate;
|
|
105
151
|
exports.noop = noop;
|
|
106
152
|
exports.once = once;
|
|
153
|
+
exports.partial = partial;
|
|
154
|
+
exports.partialRight = partialRight;
|
|
107
155
|
exports.throttle = throttle;
|
|
108
156
|
exports.unary = unary;
|
package/dist/function/index.mjs
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
|
|
3
|
+
*
|
|
4
|
+
* The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
|
|
5
|
+
*
|
|
6
|
+
* Note: This method doesn't set the `length` property of partially applied functions.
|
|
7
|
+
*
|
|
8
|
+
* @template F The type of the function to partially apply.
|
|
9
|
+
* @param {F} func The function to partially apply arguments to.
|
|
10
|
+
* @param {any[]} partialArgs The arguments to be partially applied.
|
|
11
|
+
* @returns {F} Returns the new partially applied function.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* function greet(greeting, name) {
|
|
15
|
+
* return greeting + ' ' + name;
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* const sayHelloTo = partial(greet, 'hello');
|
|
19
|
+
* sayHelloTo('fred');
|
|
20
|
+
* // => 'hello fred'
|
|
21
|
+
*
|
|
22
|
+
* // Partially applied with placeholders.
|
|
23
|
+
* const greetFred = partial(greet, partial.placeholder, 'fred');
|
|
24
|
+
* greetFred('hi');
|
|
25
|
+
* // => 'hi fred'
|
|
26
|
+
*/
|
|
27
|
+
declare function partial<F extends (...args: any[]) => any>(func: F, ...partialArgs: any[]): F;
|
|
28
|
+
declare namespace partial {
|
|
29
|
+
var placeholder: typeof partialPlaceholder;
|
|
30
|
+
}
|
|
31
|
+
declare const partialPlaceholder: unique symbol;
|
|
32
|
+
|
|
33
|
+
export { partial };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
|
|
3
|
+
*
|
|
4
|
+
* The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
|
|
5
|
+
*
|
|
6
|
+
* Note: This method doesn't set the `length` property of partially applied functions.
|
|
7
|
+
*
|
|
8
|
+
* @template F The type of the function to partially apply.
|
|
9
|
+
* @param {F} func The function to partially apply arguments to.
|
|
10
|
+
* @param {any[]} partialArgs The arguments to be partially applied.
|
|
11
|
+
* @returns {F} Returns the new partially applied function.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* function greet(greeting, name) {
|
|
15
|
+
* return greeting + ' ' + name;
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* const sayHelloTo = partial(greet, 'hello');
|
|
19
|
+
* sayHelloTo('fred');
|
|
20
|
+
* // => 'hello fred'
|
|
21
|
+
*
|
|
22
|
+
* // Partially applied with placeholders.
|
|
23
|
+
* const greetFred = partial(greet, partial.placeholder, 'fred');
|
|
24
|
+
* greetFred('hi');
|
|
25
|
+
* // => 'hi fred'
|
|
26
|
+
*/
|
|
27
|
+
declare function partial<F extends (...args: any[]) => any>(func: F, ...partialArgs: any[]): F;
|
|
28
|
+
declare namespace partial {
|
|
29
|
+
var placeholder: typeof partialPlaceholder;
|
|
30
|
+
}
|
|
31
|
+
declare const partialPlaceholder: unique symbol;
|
|
32
|
+
|
|
33
|
+
export { partial };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function partial(func, ...partialArgs) {
|
|
2
|
+
return function (...providedArgs) {
|
|
3
|
+
const args = [];
|
|
4
|
+
let startIndex = 0;
|
|
5
|
+
for (let i = 0; i < partialArgs.length; i++) {
|
|
6
|
+
const arg = partialArgs[i];
|
|
7
|
+
if (arg === partial.placeholder) {
|
|
8
|
+
args.push(providedArgs[startIndex++]);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
args.push(arg);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
for (let i = startIndex; i < providedArgs.length; i++) {
|
|
15
|
+
args.push(providedArgs[i]);
|
|
16
|
+
}
|
|
17
|
+
return func.apply(this, args);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const partialPlaceholder = Symbol('partial.placeholder');
|
|
21
|
+
partial.placeholder = partialPlaceholder;
|
|
22
|
+
|
|
23
|
+
export { partial };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
|
|
3
|
+
*
|
|
4
|
+
* The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
|
|
5
|
+
*
|
|
6
|
+
* Note: This method doesn't set the `length` property of partially applied functions.
|
|
7
|
+
*
|
|
8
|
+
* @template F The type of the function to partially apply.
|
|
9
|
+
* @param {F} func The function to partially apply arguments to.
|
|
10
|
+
* @param {any[]} partialArgs The arguments to be partially applied.
|
|
11
|
+
* @returns {F} Returns the new partially applied function.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* function greet(greeting, name) {
|
|
15
|
+
* return greeting + ' ' + name;
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* const greetFred = partialRight(greet, 'fred');
|
|
19
|
+
* greetFred('hi');
|
|
20
|
+
* // => 'hi fred'
|
|
21
|
+
*
|
|
22
|
+
* // Partially applied with placeholders.
|
|
23
|
+
* const sayHelloTo = partialRight(greet, 'hello', partialRight.placeholder);
|
|
24
|
+
* sayHelloTo('fred');
|
|
25
|
+
* // => 'hello fred'
|
|
26
|
+
*/
|
|
27
|
+
declare function partialRight<F extends (...args: any[]) => any>(func: F, ...partialArgs: any[]): F;
|
|
28
|
+
declare namespace partialRight {
|
|
29
|
+
var placeholder: typeof partialRightPlaceholder;
|
|
30
|
+
}
|
|
31
|
+
declare const partialRightPlaceholder: unique symbol;
|
|
32
|
+
|
|
33
|
+
export { partialRight };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
|
|
3
|
+
*
|
|
4
|
+
* The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
|
|
5
|
+
*
|
|
6
|
+
* Note: This method doesn't set the `length` property of partially applied functions.
|
|
7
|
+
*
|
|
8
|
+
* @template F The type of the function to partially apply.
|
|
9
|
+
* @param {F} func The function to partially apply arguments to.
|
|
10
|
+
* @param {any[]} partialArgs The arguments to be partially applied.
|
|
11
|
+
* @returns {F} Returns the new partially applied function.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* function greet(greeting, name) {
|
|
15
|
+
* return greeting + ' ' + name;
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* const greetFred = partialRight(greet, 'fred');
|
|
19
|
+
* greetFred('hi');
|
|
20
|
+
* // => 'hi fred'
|
|
21
|
+
*
|
|
22
|
+
* // Partially applied with placeholders.
|
|
23
|
+
* const sayHelloTo = partialRight(greet, 'hello', partialRight.placeholder);
|
|
24
|
+
* sayHelloTo('fred');
|
|
25
|
+
* // => 'hello fred'
|
|
26
|
+
*/
|
|
27
|
+
declare function partialRight<F extends (...args: any[]) => any>(func: F, ...partialArgs: any[]): F;
|
|
28
|
+
declare namespace partialRight {
|
|
29
|
+
var placeholder: typeof partialRightPlaceholder;
|
|
30
|
+
}
|
|
31
|
+
declare const partialRightPlaceholder: unique symbol;
|
|
32
|
+
|
|
33
|
+
export { partialRight };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function partialRight(func, ...partialArgs) {
|
|
2
|
+
return function (...providedArgs) {
|
|
3
|
+
const placeholderLength = partialArgs.filter(arg => arg === partialRightPlaceholder).length;
|
|
4
|
+
const rangeLength = Math.max(providedArgs.length - placeholderLength, 0);
|
|
5
|
+
const args = [];
|
|
6
|
+
let providedIndex = 0;
|
|
7
|
+
for (let i = 0; i < rangeLength; i++) {
|
|
8
|
+
args.push(providedArgs[providedIndex++]);
|
|
9
|
+
}
|
|
10
|
+
for (let i = 0; i < partialArgs.length; i++) {
|
|
11
|
+
const arg = partialArgs[i];
|
|
12
|
+
if (arg === partialRight.placeholder) {
|
|
13
|
+
args.push(providedArgs[providedIndex++]);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
args.push(arg);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return func.apply(this, args);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const partialRightPlaceholder = Symbol('partialRight.placeholder');
|
|
23
|
+
partialRight.placeholder = partialRightPlaceholder;
|
|
24
|
+
|
|
25
|
+
export { partialRight };
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* @param {F} func - The function to cap arguments for.
|
|
6
6
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
7
7
|
*/
|
|
8
|
-
declare function unary<F extends (...args: any[]) => any>(func: F): (
|
|
8
|
+
declare function unary<F extends (...args: any[]) => any>(func: F): (...args: any[]) => ReturnType<F>;
|
|
9
9
|
|
|
10
10
|
export { unary };
|
package/dist/function/unary.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* @param {F} func - The function to cap arguments for.
|
|
6
6
|
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|
7
7
|
*/
|
|
8
|
-
declare function unary<F extends (...args: any[]) => any>(func: F): (
|
|
8
|
+
declare function unary<F extends (...args: any[]) => any>(func: F): (...args: any[]) => ReturnType<F>;
|
|
9
9
|
|
|
10
10
|
export { unary };
|
package/dist/index.d.mts
CHANGED
|
@@ -61,6 +61,8 @@ export { throttle } from './function/throttle.mjs';
|
|
|
61
61
|
export { negate } from './function/negate.mjs';
|
|
62
62
|
export { ary } from './function/ary.mjs';
|
|
63
63
|
export { unary } from './function/unary.mjs';
|
|
64
|
+
export { partial } from './function/partial.mjs';
|
|
65
|
+
export { partialRight } from './function/partialRight.mjs';
|
|
64
66
|
export { clamp } from './math/clamp.mjs';
|
|
65
67
|
export { inRange } from './math/inRange.mjs';
|
|
66
68
|
export { mean } from './math/mean.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export { throttle } from './function/throttle.js';
|
|
|
61
61
|
export { negate } from './function/negate.js';
|
|
62
62
|
export { ary } from './function/ary.js';
|
|
63
63
|
export { unary } from './function/unary.js';
|
|
64
|
+
export { partial } from './function/partial.js';
|
|
65
|
+
export { partialRight } from './function/partialRight.js';
|
|
64
66
|
export { clamp } from './math/clamp.js';
|
|
65
67
|
export { inRange } from './math/inRange.js';
|
|
66
68
|
export { mean } from './math/mean.js';
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const math_index = require('./math/index.js');
|
|
|
10
10
|
const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
11
11
|
const toMerged = require('./_chunk/toMerged-BGwYW5.js');
|
|
12
12
|
const object_index = require('./object/index.js');
|
|
13
|
-
const isFunction = require('./_chunk/isFunction-
|
|
13
|
+
const isFunction = require('./_chunk/isFunction-DPic3X.js');
|
|
14
14
|
const isTypedArray = require('./_chunk/isTypedArray-BBEkFl.js');
|
|
15
15
|
const predicate_index = require('./predicate/index.js');
|
|
16
16
|
const string_index = require('./string/index.js');
|
|
@@ -80,6 +80,8 @@ exports.debounce = function_index.debounce;
|
|
|
80
80
|
exports.negate = function_index.negate;
|
|
81
81
|
exports.noop = function_index.noop;
|
|
82
82
|
exports.once = function_index.once;
|
|
83
|
+
exports.partial = function_index.partial;
|
|
84
|
+
exports.partialRight = function_index.partialRight;
|
|
83
85
|
exports.throttle = function_index.throttle;
|
|
84
86
|
exports.unary = function_index.unary;
|
|
85
87
|
exports.clamp = math_index.clamp;
|
package/dist/index.mjs
CHANGED
|
@@ -61,6 +61,8 @@ export { throttle } from './function/throttle.mjs';
|
|
|
61
61
|
export { negate } from './function/negate.mjs';
|
|
62
62
|
export { ary } from './function/ary.mjs';
|
|
63
63
|
export { unary } from './function/unary.mjs';
|
|
64
|
+
export { partial } from './function/partial.mjs';
|
|
65
|
+
export { partialRight } from './function/partialRight.mjs';
|
|
64
66
|
export { clamp } from './math/clamp.mjs';
|
|
65
67
|
export { inRange } from './math/inRange.mjs';
|
|
66
68
|
export { mean } from './math/mean.mjs';
|
package/dist/predicate/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const isFunction = require('../_chunk/isFunction-
|
|
5
|
+
const isFunction = require('../_chunk/isFunction-DPic3X.js');
|
|
6
6
|
const isTypedArray = require('../_chunk/isTypedArray-BBEkFl.js');
|
|
7
7
|
|
|
8
8
|
function isBoolean(x) {
|
|
@@ -47,7 +47,7 @@ function areObjectsEqual(a, b, stack) {
|
|
|
47
47
|
case numberTag: {
|
|
48
48
|
const x = a.valueOf();
|
|
49
49
|
const y = b.valueOf();
|
|
50
|
-
return x === y || Number.isNaN(x) && Number.isNaN(y);
|
|
50
|
+
return x === y || (Number.isNaN(x) && Number.isNaN(y));
|
|
51
51
|
}
|
|
52
52
|
case booleanTag:
|
|
53
53
|
case dateTag:
|
|
@@ -140,8 +140,7 @@ function areObjectsEqual(a, b, stack) {
|
|
|
140
140
|
return a.name === b.name && a.message === b.message;
|
|
141
141
|
}
|
|
142
142
|
case objectTag: {
|
|
143
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack) ||
|
|
144
|
-
(isPlainObject(a) && isPlainObject(b));
|
|
143
|
+
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack) || (isPlainObject(a) && isPlainObject(b));
|
|
145
144
|
if (!areEqualInstances) {
|
|
146
145
|
return false;
|
|
147
146
|
}
|
|
@@ -4,10 +4,10 @@ import { getWords } from './_internal/getWords.mjs';
|
|
|
4
4
|
function camelCase(str) {
|
|
5
5
|
const words = getWords(str);
|
|
6
6
|
if (words.length === 0) {
|
|
7
|
-
return
|
|
7
|
+
return '';
|
|
8
8
|
}
|
|
9
9
|
const [first, ...rest] = words;
|
|
10
|
-
return `${first.toLowerCase()}${rest.map(
|
|
10
|
+
return `${first.toLowerCase()}${rest.map(word => capitalize(word)).join('')}`;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { camelCase };
|
package/dist/string/index.js
CHANGED
|
@@ -14,10 +14,10 @@ function getWords(str) {
|
|
|
14
14
|
function camelCase(str) {
|
|
15
15
|
const words = getWords(str);
|
|
16
16
|
if (words.length === 0) {
|
|
17
|
-
return
|
|
17
|
+
return '';
|
|
18
18
|
}
|
|
19
19
|
const [first, ...rest] = words;
|
|
20
|
-
return `${first.toLowerCase()}${rest.map(
|
|
20
|
+
return `${first.toLowerCase()}${rest.map(word => capitalize(word)).join('')}`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const snakeCase = (str) => {
|
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.15.1-dev.
|
|
4
|
+
"version": "1.15.1-dev.424+be4162dc",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|