es-toolkit 1.22.0-dev.697 → 1.22.0-dev.699
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/{flowRight-BzdOZX.js → flowRight-DD5Qyk.js} +21 -0
- package/dist/_chunk/{isWeakSet-DDVaWr.js → isWeakSet-CGakJk.js} +5 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +2 -0
- package/dist/compat/index.d.ts +2 -0
- package/dist/compat/index.js +4 -2
- package/dist/compat/index.mjs +2 -0
- package/dist/function/curryRight.d.mts +140 -0
- package/dist/function/curryRight.d.ts +140 -0
- package/dist/function/curryRight.mjs +21 -0
- package/dist/function/index.d.mts +1 -0
- package/dist/function/index.d.ts +1 -0
- package/dist/function/index.js +2 -1
- package/dist/function/index.mjs +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -2
- package/dist/index.mjs +2 -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/isArrayBuffer.d.mts +20 -0
- package/dist/predicate/isArrayBuffer.d.ts +20 -0
- package/dist/predicate/isArrayBuffer.mjs +5 -0
- package/package.json +1 -1
package/dist/compat/index.d.mts
CHANGED
|
@@ -56,6 +56,7 @@ export { MemoizeCache, memoize } from '../function/memoize.mjs';
|
|
|
56
56
|
export { unary } from '../function/unary.mjs';
|
|
57
57
|
export { partial } from '../function/partial.mjs';
|
|
58
58
|
export { partialRight } from '../function/partialRight.mjs';
|
|
59
|
+
export { curryRight } from '../function/curryRight.mjs';
|
|
59
60
|
export { flow } from '../function/flow.mjs';
|
|
60
61
|
export { flowRight } from '../function/flowRight.mjs';
|
|
61
62
|
export { mean } from '../math/mean.mjs';
|
|
@@ -70,6 +71,7 @@ export { invert } from '../object/invert.mjs';
|
|
|
70
71
|
export { clone } from '../object/clone.mjs';
|
|
71
72
|
export { flattenObject } from '../object/flattenObject.mjs';
|
|
72
73
|
export { toMerged } from '../object/toMerged.mjs';
|
|
74
|
+
export { isArrayBuffer } from '../predicate/isArrayBuffer.mjs';
|
|
73
75
|
export { isDate } from '../predicate/isDate.mjs';
|
|
74
76
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
75
77
|
export { isMap } from '../predicate/isMap.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export { MemoizeCache, memoize } from '../function/memoize.js';
|
|
|
56
56
|
export { unary } from '../function/unary.js';
|
|
57
57
|
export { partial } from '../function/partial.js';
|
|
58
58
|
export { partialRight } from '../function/partialRight.js';
|
|
59
|
+
export { curryRight } from '../function/curryRight.js';
|
|
59
60
|
export { flow } from '../function/flow.js';
|
|
60
61
|
export { flowRight } from '../function/flowRight.js';
|
|
61
62
|
export { mean } from '../math/mean.js';
|
|
@@ -70,6 +71,7 @@ export { invert } from '../object/invert.js';
|
|
|
70
71
|
export { clone } from '../object/clone.js';
|
|
71
72
|
export { flattenObject } from '../object/flattenObject.js';
|
|
72
73
|
export { toMerged } from '../object/toMerged.js';
|
|
74
|
+
export { isArrayBuffer } from '../predicate/isArrayBuffer.js';
|
|
73
75
|
export { isDate } from '../predicate/isDate.js';
|
|
74
76
|
export { isEqual } from '../predicate/isEqual.js';
|
|
75
77
|
export { isMap } from '../predicate/isMap.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
|
|
5
5
|
const zipWith = require('../_chunk/zipWith-EOU_KZ.js');
|
|
6
6
|
const promise_index = require('../_chunk/index-BGZDR9.js');
|
|
7
|
-
const flowRight = require('../_chunk/flowRight-
|
|
7
|
+
const flowRight = require('../_chunk/flowRight-DD5Qyk.js');
|
|
8
8
|
const range = require('../_chunk/range-BXlMmn.js');
|
|
9
9
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
10
10
|
const toMerged = require('../_chunk/toMerged-DD-s3X.js');
|
|
11
11
|
const isPlainObject$1 = require('../_chunk/isPlainObject-DKBeLp.js');
|
|
12
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
12
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-CGakJk.js');
|
|
13
13
|
const pad$1 = require('../_chunk/pad-Cw2pvt.js');
|
|
14
14
|
|
|
15
15
|
function castArray(value) {
|
|
@@ -1847,6 +1847,7 @@ exports.timeout = promise_index.timeout;
|
|
|
1847
1847
|
exports.withTimeout = promise_index.withTimeout;
|
|
1848
1848
|
exports.after = flowRight.after;
|
|
1849
1849
|
exports.before = flowRight.before;
|
|
1850
|
+
exports.curryRight = flowRight.curryRight;
|
|
1850
1851
|
exports.flow = flowRight.flow;
|
|
1851
1852
|
exports.flowRight = flowRight.flowRight;
|
|
1852
1853
|
exports.memoize = flowRight.memoize;
|
|
@@ -1870,6 +1871,7 @@ exports.omitBy = toMerged.omitBy;
|
|
|
1870
1871
|
exports.pickBy = toMerged.pickBy;
|
|
1871
1872
|
exports.toMerged = toMerged.toMerged;
|
|
1872
1873
|
exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
1874
|
+
exports.isArrayBuffer = isWeakSet$1.isArrayBuffer;
|
|
1873
1875
|
exports.isDate = isWeakSet$1.isDate;
|
|
1874
1876
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
1875
1877
|
exports.isFunction = isWeakSet$1.isFunction;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -56,6 +56,7 @@ export { memoize } from '../function/memoize.mjs';
|
|
|
56
56
|
export { unary } from '../function/unary.mjs';
|
|
57
57
|
export { partial } from '../function/partial.mjs';
|
|
58
58
|
export { partialRight } from '../function/partialRight.mjs';
|
|
59
|
+
export { curryRight } from '../function/curryRight.mjs';
|
|
59
60
|
export { flow } from '../function/flow.mjs';
|
|
60
61
|
export { flowRight } from '../function/flowRight.mjs';
|
|
61
62
|
export { mean } from '../math/mean.mjs';
|
|
@@ -72,6 +73,7 @@ export { flattenObject } from '../object/flattenObject.mjs';
|
|
|
72
73
|
export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
73
74
|
export { isObjectLike } from './predicate/isObjectLike.mjs';
|
|
74
75
|
export { toMerged } from '../object/toMerged.mjs';
|
|
76
|
+
export { isArrayBuffer } from '../predicate/isArrayBuffer.mjs';
|
|
75
77
|
export { isDate } from '../predicate/isDate.mjs';
|
|
76
78
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
77
79
|
export { isMap } from '../predicate/isMap.mjs';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
3
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
4
|
+
*
|
|
5
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
6
|
+
*
|
|
7
|
+
* @param {() => R} func - The function to curry.
|
|
8
|
+
* @returns {() => R} A curried function.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* function noArgFunc() {
|
|
12
|
+
* return 42;
|
|
13
|
+
* }
|
|
14
|
+
* const curriedNoArgFunc = curryRight(noArgFunc);
|
|
15
|
+
* console.log(curriedNoArgFunc()); // 42
|
|
16
|
+
*/
|
|
17
|
+
declare function curryRight<R>(func: () => R): () => R;
|
|
18
|
+
/**
|
|
19
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
20
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
21
|
+
*
|
|
22
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
23
|
+
*
|
|
24
|
+
* @param {(p: P) => R} func - The function to curry.
|
|
25
|
+
* @returns {(p: P) => R} A curried function.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* function oneArgFunc(a: number) {
|
|
29
|
+
* return a * 2;
|
|
30
|
+
* }
|
|
31
|
+
* const curriedOneArgFunc = curryRight(oneArgFunc);
|
|
32
|
+
* console.log(curriedOneArgFunc(5)); // 10
|
|
33
|
+
*/
|
|
34
|
+
declare function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
|
|
35
|
+
/**
|
|
36
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
37
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
38
|
+
*
|
|
39
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
40
|
+
*
|
|
41
|
+
* @param {(p1: P1, p2: P2) => R} func - The function to curry.
|
|
42
|
+
* @returns {(p1: P2) => (p2: P1) => R} A curried function.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* function twoArgFunc(a: number, b: number) {
|
|
46
|
+
* return [a, b];
|
|
47
|
+
* }
|
|
48
|
+
* const curriedTwoArgFunc = curryRight(twoArgFunc);
|
|
49
|
+
* const func = curriedTwoArgFunc(1);
|
|
50
|
+
* console.log(func(2)); // [2, 1]
|
|
51
|
+
*/
|
|
52
|
+
declare function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) => (p2: P1) => R;
|
|
53
|
+
/**
|
|
54
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
55
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
56
|
+
*
|
|
57
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
58
|
+
*
|
|
59
|
+
* @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
|
|
60
|
+
* @returns {(p1: P3) => (p2: P2) => (p3: P1) => R} A curried function.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* function threeArgFunc(a: number, b: number, c: number) {
|
|
64
|
+
* return [a, b, c];
|
|
65
|
+
* }
|
|
66
|
+
* const curriedThreeArgFunc = curryRight(threeArgFunc);
|
|
67
|
+
* const func = curriedThreeArgFunc(1);
|
|
68
|
+
* const func2 = func(2);
|
|
69
|
+
* console.log(func2(3)); // [3, 2, 1]
|
|
70
|
+
*/
|
|
71
|
+
declare function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P3) => (p2: P2) => (p3: P1) => R;
|
|
72
|
+
/**
|
|
73
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
74
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
75
|
+
*
|
|
76
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
77
|
+
*
|
|
78
|
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
|
|
79
|
+
* @returns {(p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R} A curried function.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* function fourArgFunc(a: number, b: number, c: number, d: number) {
|
|
83
|
+
* return [a, b, c, d];
|
|
84
|
+
* }
|
|
85
|
+
* const curriedFourArgFunc = curryRight(fourArgFunc);
|
|
86
|
+
* const func = curriedFourArgFunc(1);
|
|
87
|
+
* const func2 = func(2);
|
|
88
|
+
* const func3 = func2(3);
|
|
89
|
+
* console.log(func3(4)); // [4, 3, 2, 1]
|
|
90
|
+
*/
|
|
91
|
+
declare function curryRight<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R;
|
|
92
|
+
/**
|
|
93
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
94
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
95
|
+
*
|
|
96
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
97
|
+
*
|
|
98
|
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R} func - The function to curry.
|
|
99
|
+
* @returns {(p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R} A curried function.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
|
|
103
|
+
* return [a, b, c, d, e];
|
|
104
|
+
* }
|
|
105
|
+
* const curriedFiveArgFunc = curryRight(fiveArgFunc);
|
|
106
|
+
* const func = curriedFiveArgFunc(1);
|
|
107
|
+
* const func2 = func(2);
|
|
108
|
+
* const func3 = func2(3);
|
|
109
|
+
* const func4 = func3(4);
|
|
110
|
+
* console.log(func4(5)); // [5, 4, 3, 2, 1]
|
|
111
|
+
*/
|
|
112
|
+
declare function curryRight<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R;
|
|
113
|
+
/**
|
|
114
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
115
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
116
|
+
*
|
|
117
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
118
|
+
*
|
|
119
|
+
* @param {(...args: any[]) => any} func - The function to curry.
|
|
120
|
+
* @returns {(...args: any[]) => any} A curried function.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* function sum(a: number, b: number, c: number) {
|
|
124
|
+
* return a + b + c;
|
|
125
|
+
* }
|
|
126
|
+
*
|
|
127
|
+
* const curriedSum = curryRight(sum);
|
|
128
|
+
*
|
|
129
|
+
* // The parameter `c` should be given the value `10`.
|
|
130
|
+
* const add10 = curriedSum(10);
|
|
131
|
+
*
|
|
132
|
+
* // The parameter `b` should be given the value `15`.
|
|
133
|
+
* const add25 = add10(15);
|
|
134
|
+
*
|
|
135
|
+
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
|
136
|
+
* const result = add25(5);
|
|
137
|
+
*/
|
|
138
|
+
declare function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
|
|
139
|
+
|
|
140
|
+
export { curryRight };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
3
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
4
|
+
*
|
|
5
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
6
|
+
*
|
|
7
|
+
* @param {() => R} func - The function to curry.
|
|
8
|
+
* @returns {() => R} A curried function.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* function noArgFunc() {
|
|
12
|
+
* return 42;
|
|
13
|
+
* }
|
|
14
|
+
* const curriedNoArgFunc = curryRight(noArgFunc);
|
|
15
|
+
* console.log(curriedNoArgFunc()); // 42
|
|
16
|
+
*/
|
|
17
|
+
declare function curryRight<R>(func: () => R): () => R;
|
|
18
|
+
/**
|
|
19
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
20
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
21
|
+
*
|
|
22
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
23
|
+
*
|
|
24
|
+
* @param {(p: P) => R} func - The function to curry.
|
|
25
|
+
* @returns {(p: P) => R} A curried function.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* function oneArgFunc(a: number) {
|
|
29
|
+
* return a * 2;
|
|
30
|
+
* }
|
|
31
|
+
* const curriedOneArgFunc = curryRight(oneArgFunc);
|
|
32
|
+
* console.log(curriedOneArgFunc(5)); // 10
|
|
33
|
+
*/
|
|
34
|
+
declare function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
|
|
35
|
+
/**
|
|
36
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
37
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
38
|
+
*
|
|
39
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
40
|
+
*
|
|
41
|
+
* @param {(p1: P1, p2: P2) => R} func - The function to curry.
|
|
42
|
+
* @returns {(p1: P2) => (p2: P1) => R} A curried function.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* function twoArgFunc(a: number, b: number) {
|
|
46
|
+
* return [a, b];
|
|
47
|
+
* }
|
|
48
|
+
* const curriedTwoArgFunc = curryRight(twoArgFunc);
|
|
49
|
+
* const func = curriedTwoArgFunc(1);
|
|
50
|
+
* console.log(func(2)); // [2, 1]
|
|
51
|
+
*/
|
|
52
|
+
declare function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) => (p2: P1) => R;
|
|
53
|
+
/**
|
|
54
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
55
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
56
|
+
*
|
|
57
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
58
|
+
*
|
|
59
|
+
* @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
|
|
60
|
+
* @returns {(p1: P3) => (p2: P2) => (p3: P1) => R} A curried function.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* function threeArgFunc(a: number, b: number, c: number) {
|
|
64
|
+
* return [a, b, c];
|
|
65
|
+
* }
|
|
66
|
+
* const curriedThreeArgFunc = curryRight(threeArgFunc);
|
|
67
|
+
* const func = curriedThreeArgFunc(1);
|
|
68
|
+
* const func2 = func(2);
|
|
69
|
+
* console.log(func2(3)); // [3, 2, 1]
|
|
70
|
+
*/
|
|
71
|
+
declare function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P3) => (p2: P2) => (p3: P1) => R;
|
|
72
|
+
/**
|
|
73
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
74
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
75
|
+
*
|
|
76
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
77
|
+
*
|
|
78
|
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
|
|
79
|
+
* @returns {(p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R} A curried function.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* function fourArgFunc(a: number, b: number, c: number, d: number) {
|
|
83
|
+
* return [a, b, c, d];
|
|
84
|
+
* }
|
|
85
|
+
* const curriedFourArgFunc = curryRight(fourArgFunc);
|
|
86
|
+
* const func = curriedFourArgFunc(1);
|
|
87
|
+
* const func2 = func(2);
|
|
88
|
+
* const func3 = func2(3);
|
|
89
|
+
* console.log(func3(4)); // [4, 3, 2, 1]
|
|
90
|
+
*/
|
|
91
|
+
declare function curryRight<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R;
|
|
92
|
+
/**
|
|
93
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
94
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
95
|
+
*
|
|
96
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
97
|
+
*
|
|
98
|
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R} func - The function to curry.
|
|
99
|
+
* @returns {(p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R} A curried function.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
|
|
103
|
+
* return [a, b, c, d, e];
|
|
104
|
+
* }
|
|
105
|
+
* const curriedFiveArgFunc = curryRight(fiveArgFunc);
|
|
106
|
+
* const func = curriedFiveArgFunc(1);
|
|
107
|
+
* const func2 = func(2);
|
|
108
|
+
* const func3 = func2(3);
|
|
109
|
+
* const func4 = func3(4);
|
|
110
|
+
* console.log(func4(5)); // [5, 4, 3, 2, 1]
|
|
111
|
+
*/
|
|
112
|
+
declare function curryRight<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R;
|
|
113
|
+
/**
|
|
114
|
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
|
115
|
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
|
116
|
+
*
|
|
117
|
+
* Unlike `curry`, this function curries the function from right to left.
|
|
118
|
+
*
|
|
119
|
+
* @param {(...args: any[]) => any} func - The function to curry.
|
|
120
|
+
* @returns {(...args: any[]) => any} A curried function.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* function sum(a: number, b: number, c: number) {
|
|
124
|
+
* return a + b + c;
|
|
125
|
+
* }
|
|
126
|
+
*
|
|
127
|
+
* const curriedSum = curryRight(sum);
|
|
128
|
+
*
|
|
129
|
+
* // The parameter `c` should be given the value `10`.
|
|
130
|
+
* const add10 = curriedSum(10);
|
|
131
|
+
*
|
|
132
|
+
* // The parameter `b` should be given the value `15`.
|
|
133
|
+
* const add25 = add10(15);
|
|
134
|
+
*
|
|
135
|
+
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
|
136
|
+
* const result = add25(5);
|
|
137
|
+
*/
|
|
138
|
+
declare function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
|
|
139
|
+
|
|
140
|
+
export { curryRight };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function curryRight(func) {
|
|
2
|
+
if (func.length === 0 || func.length === 1) {
|
|
3
|
+
return func;
|
|
4
|
+
}
|
|
5
|
+
return function (arg) {
|
|
6
|
+
return makeCurryRight(func, func.length, [arg]);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function makeCurryRight(origin, argsLength, args) {
|
|
10
|
+
if (args.length === argsLength) {
|
|
11
|
+
return origin(...args);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const next = function (arg) {
|
|
15
|
+
return makeCurryRight(origin, argsLength, [arg, ...args]);
|
|
16
|
+
};
|
|
17
|
+
return next;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { curryRight };
|
|
@@ -12,6 +12,7 @@ export { partial } from './partial.mjs';
|
|
|
12
12
|
export { partialRight } from './partialRight.mjs';
|
|
13
13
|
export { rest } from './rest.mjs';
|
|
14
14
|
export { curry } from './curry.mjs';
|
|
15
|
+
export { curryRight } from './curryRight.mjs';
|
|
15
16
|
export { spread } from './spread.mjs';
|
|
16
17
|
export { flow } from './flow.mjs';
|
|
17
18
|
export { flowRight } from './flowRight.mjs';
|
package/dist/function/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { partial } from './partial.js';
|
|
|
12
12
|
export { partialRight } from './partialRight.js';
|
|
13
13
|
export { rest } from './rest.js';
|
|
14
14
|
export { curry } from './curry.js';
|
|
15
|
+
export { curryRight } from './curryRight.js';
|
|
15
16
|
export { spread } from './spread.js';
|
|
16
17
|
export { flow } from './flow.js';
|
|
17
18
|
export { flowRight } from './flowRight.js';
|
package/dist/function/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const flowRight = require('../_chunk/flowRight-
|
|
5
|
+
const flowRight = require('../_chunk/flowRight-DD5Qyk.js');
|
|
6
6
|
|
|
7
7
|
function throttle(func, throttleMs, { signal, edges = ['leading', 'trailing'] } = {}) {
|
|
8
8
|
let pendingAt = null;
|
|
@@ -54,6 +54,7 @@ function spread(func) {
|
|
|
54
54
|
exports.after = flowRight.after;
|
|
55
55
|
exports.ary = flowRight.ary;
|
|
56
56
|
exports.before = flowRight.before;
|
|
57
|
+
exports.curryRight = flowRight.curryRight;
|
|
57
58
|
exports.debounce = flowRight.debounce;
|
|
58
59
|
exports.flow = flowRight.flow;
|
|
59
60
|
exports.flowRight = flowRight.flowRight;
|
package/dist/function/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ export { partial } from './partial.mjs';
|
|
|
12
12
|
export { partialRight } from './partialRight.mjs';
|
|
13
13
|
export { rest } from './rest.mjs';
|
|
14
14
|
export { curry } from './curry.mjs';
|
|
15
|
+
export { curryRight } from './curryRight.mjs';
|
|
15
16
|
export { spread } from './spread.mjs';
|
|
16
17
|
export { flow } from './flow.mjs';
|
|
17
18
|
export { flowRight } from './flowRight.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -70,6 +70,7 @@ export { partial } from './function/partial.mjs';
|
|
|
70
70
|
export { partialRight } from './function/partialRight.mjs';
|
|
71
71
|
export { rest } from './function/rest.mjs';
|
|
72
72
|
export { curry } from './function/curry.mjs';
|
|
73
|
+
export { curryRight } from './function/curryRight.mjs';
|
|
73
74
|
export { spread } from './function/spread.mjs';
|
|
74
75
|
export { flow } from './function/flow.mjs';
|
|
75
76
|
export { flowRight } from './function/flowRight.mjs';
|
|
@@ -96,6 +97,7 @@ export { cloneDeep } from './object/cloneDeep.mjs';
|
|
|
96
97
|
export { merge } from './object/merge.mjs';
|
|
97
98
|
export { toMerged } from './object/toMerged.mjs';
|
|
98
99
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
100
|
+
export { isArrayBuffer } from './predicate/isArrayBuffer.mjs';
|
|
99
101
|
export { isDate } from './predicate/isDate.mjs';
|
|
100
102
|
export { isEqual } from './predicate/isEqual.mjs';
|
|
101
103
|
export { isError } from './predicate/isError.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export { partial } from './function/partial.js';
|
|
|
70
70
|
export { partialRight } from './function/partialRight.js';
|
|
71
71
|
export { rest } from './function/rest.js';
|
|
72
72
|
export { curry } from './function/curry.js';
|
|
73
|
+
export { curryRight } from './function/curryRight.js';
|
|
73
74
|
export { spread } from './function/spread.js';
|
|
74
75
|
export { flow } from './function/flow.js';
|
|
75
76
|
export { flowRight } from './function/flowRight.js';
|
|
@@ -96,6 +97,7 @@ export { cloneDeep } from './object/cloneDeep.js';
|
|
|
96
97
|
export { merge } from './object/merge.js';
|
|
97
98
|
export { toMerged } from './object/toMerged.js';
|
|
98
99
|
export { mergeWith } from './object/mergeWith.js';
|
|
100
|
+
export { isArrayBuffer } from './predicate/isArrayBuffer.js';
|
|
99
101
|
export { isDate } from './predicate/isDate.js';
|
|
100
102
|
export { isEqual } from './predicate/isEqual.js';
|
|
101
103
|
export { isError } from './predicate/isError.js';
|
package/dist/index.js
CHANGED
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const zipWith = require('./_chunk/zipWith-EOU_KZ.js');
|
|
6
6
|
const array_index = require('./array/index.js');
|
|
7
7
|
const promise_index = require('./_chunk/index-BGZDR9.js');
|
|
8
|
-
const flowRight = require('./_chunk/flowRight-
|
|
8
|
+
const flowRight = require('./_chunk/flowRight-DD5Qyk.js');
|
|
9
9
|
const function_index = require('./function/index.js');
|
|
10
10
|
const range = require('./_chunk/range-BXlMmn.js');
|
|
11
11
|
const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
12
12
|
const math_index = require('./math/index.js');
|
|
13
13
|
const object_index = require('./object/index.js');
|
|
14
14
|
const toMerged = require('./_chunk/toMerged-DD-s3X.js');
|
|
15
|
-
const isWeakSet = require('./_chunk/isWeakSet-
|
|
15
|
+
const isWeakSet = require('./_chunk/isWeakSet-CGakJk.js');
|
|
16
16
|
const predicate_index = require('./predicate/index.js');
|
|
17
17
|
const isPlainObject = require('./_chunk/isPlainObject-DKBeLp.js');
|
|
18
18
|
const pad = require('./_chunk/pad-Cw2pvt.js');
|
|
@@ -84,6 +84,7 @@ exports.withTimeout = promise_index.withTimeout;
|
|
|
84
84
|
exports.after = flowRight.after;
|
|
85
85
|
exports.ary = flowRight.ary;
|
|
86
86
|
exports.before = flowRight.before;
|
|
87
|
+
exports.curryRight = flowRight.curryRight;
|
|
87
88
|
exports.debounce = flowRight.debounce;
|
|
88
89
|
exports.flow = flowRight.flow;
|
|
89
90
|
exports.flowRight = flowRight.flowRight;
|
|
@@ -121,6 +122,7 @@ exports.merge = toMerged.merge;
|
|
|
121
122
|
exports.omitBy = toMerged.omitBy;
|
|
122
123
|
exports.pickBy = toMerged.pickBy;
|
|
123
124
|
exports.toMerged = toMerged.toMerged;
|
|
125
|
+
exports.isArrayBuffer = isWeakSet.isArrayBuffer;
|
|
124
126
|
exports.isDate = isWeakSet.isDate;
|
|
125
127
|
exports.isEqual = isWeakSet.isEqual;
|
|
126
128
|
exports.isFunction = isWeakSet.isFunction;
|
package/dist/index.mjs
CHANGED
|
@@ -70,6 +70,7 @@ export { partial } from './function/partial.mjs';
|
|
|
70
70
|
export { partialRight } from './function/partialRight.mjs';
|
|
71
71
|
export { rest } from './function/rest.mjs';
|
|
72
72
|
export { curry } from './function/curry.mjs';
|
|
73
|
+
export { curryRight } from './function/curryRight.mjs';
|
|
73
74
|
export { spread } from './function/spread.mjs';
|
|
74
75
|
export { flow } from './function/flow.mjs';
|
|
75
76
|
export { flowRight } from './function/flowRight.mjs';
|
|
@@ -96,6 +97,7 @@ export { cloneDeep } from './object/cloneDeep.mjs';
|
|
|
96
97
|
export { merge } from './object/merge.mjs';
|
|
97
98
|
export { toMerged } from './object/toMerged.mjs';
|
|
98
99
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
100
|
+
export { isArrayBuffer } from './predicate/isArrayBuffer.mjs';
|
|
99
101
|
export { isDate } from './predicate/isDate.mjs';
|
|
100
102
|
export { isEqual } from './predicate/isEqual.mjs';
|
|
101
103
|
export { isError } from './predicate/isError.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 isWeakSet = require('../_chunk/isWeakSet-
|
|
5
|
+
const isWeakSet = require('../_chunk/isWeakSet-CGakJk.js');
|
|
6
6
|
const isPlainObject = require('../_chunk/isPlainObject-DKBeLp.js');
|
|
7
7
|
|
|
8
8
|
function isError(value) {
|
|
@@ -21,6 +21,7 @@ function isString(value) {
|
|
|
21
21
|
return typeof value === 'string';
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
exports.isArrayBuffer = isWeakSet.isArrayBuffer;
|
|
24
25
|
exports.isDate = isWeakSet.isDate;
|
|
25
26
|
exports.isEqual = isWeakSet.isEqual;
|
|
26
27
|
exports.isFunction = isWeakSet.isFunction;
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given value is `ArrayBuffer`.
|
|
3
|
+
*
|
|
4
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} value The value to check if it is a `ArrayBuffer`.
|
|
7
|
+
* @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const value1 = new ArrayBuffer();
|
|
11
|
+
* const value2 = new Array();
|
|
12
|
+
* const value3 = new Map();
|
|
13
|
+
*
|
|
14
|
+
* console.log(isArrayBuffer(value1)); // true
|
|
15
|
+
* console.log(isArrayBuffer(value2)); // false
|
|
16
|
+
* console.log(isArrayBuffer(value3)); // false
|
|
17
|
+
*/
|
|
18
|
+
declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
|
|
19
|
+
|
|
20
|
+
export { isArrayBuffer };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given value is `ArrayBuffer`.
|
|
3
|
+
*
|
|
4
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} value The value to check if it is a `ArrayBuffer`.
|
|
7
|
+
* @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const value1 = new ArrayBuffer();
|
|
11
|
+
* const value2 = new Array();
|
|
12
|
+
* const value3 = new Map();
|
|
13
|
+
*
|
|
14
|
+
* console.log(isArrayBuffer(value1)); // true
|
|
15
|
+
* console.log(isArrayBuffer(value2)); // false
|
|
16
|
+
* console.log(isArrayBuffer(value3)); // false
|
|
17
|
+
*/
|
|
18
|
+
declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
|
|
19
|
+
|
|
20
|
+
export { isArrayBuffer };
|
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.22.0-dev.
|
|
4
|
+
"version": "1.22.0-dev.699+8f7e0960",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|