es-toolkit 1.22.0-dev.696 → 1.22.0-dev.698
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/{isPlainObject-BIekvL.js → isPlainObject-DKBeLp.js} +7 -7
- package/dist/_chunk/{isWeakSet-CkNwsM.js → isWeakSet-DDVaWr.js} +45 -1
- package/dist/_chunk/{toMerged-BEa9JI.js → toMerged-DD-s3X.js} +1 -1
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +4 -0
- package/dist/compat/index.d.ts +4 -0
- package/dist/compat/index.js +8 -4
- package/dist/compat/index.mjs +4 -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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -4
- package/dist/index.mjs +4 -0
- package/dist/object/index.js +1 -1
- package/dist/predicate/index.d.mts +3 -0
- package/dist/predicate/index.d.ts +3 -0
- package/dist/predicate/index.js +5 -2
- package/dist/predicate/index.mjs +3 -0
- package/dist/predicate/isJSONArray.d.mts +17 -0
- package/dist/predicate/isJSONArray.d.ts +17 -0
- package/dist/predicate/isJSONArray.mjs +10 -0
- package/dist/predicate/isJSONObject.d.mts +16 -0
- package/dist/predicate/isJSONObject.d.ts +16 -0
- package/dist/predicate/isJSONObject.mjs +22 -0
- package/dist/predicate/isJSONValue.d.mts +27 -0
- package/dist/predicate/isJSONValue.d.ts +27 -0
- package/dist/predicate/isJSONValue.mjs +20 -0
- package/dist/predicate/isPlainObject.d.mts +3 -3
- package/dist/predicate/isPlainObject.d.ts +3 -3
- package/dist/predicate/isPlainObject.mjs +7 -7
- 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';
|
|
@@ -79,6 +80,9 @@ export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
|
79
80
|
export { isLength } from '../predicate/isLength.mjs';
|
|
80
81
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
81
82
|
export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
83
|
+
export { isJSONObject } from '../predicate/isJSONObject.mjs';
|
|
84
|
+
export { isJSONValue } from '../predicate/isJSONValue.mjs';
|
|
85
|
+
export { isJSONArray } from '../predicate/isJSONArray.mjs';
|
|
82
86
|
export { isSet } from '../predicate/isSet.mjs';
|
|
83
87
|
export { delay } from '../promise/delay.mjs';
|
|
84
88
|
export { withTimeout } from '../promise/withTimeout.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';
|
|
@@ -79,6 +80,9 @@ export { isUndefined } from '../predicate/isUndefined.js';
|
|
|
79
80
|
export { isLength } from '../predicate/isLength.js';
|
|
80
81
|
export { isFunction } from '../predicate/isFunction.js';
|
|
81
82
|
export { isPrimitive } from '../predicate/isPrimitive.js';
|
|
83
|
+
export { isJSONObject } from '../predicate/isJSONObject.js';
|
|
84
|
+
export { isJSONValue } from '../predicate/isJSONValue.js';
|
|
85
|
+
export { isJSONArray } from '../predicate/isJSONArray.js';
|
|
82
86
|
export { isSet } from '../predicate/isSet.js';
|
|
83
87
|
export { delay } from '../promise/delay.js';
|
|
84
88
|
export { withTimeout } from '../promise/withTimeout.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
|
-
const toMerged = require('../_chunk/toMerged-
|
|
11
|
-
const isPlainObject$1 = require('../_chunk/isPlainObject-
|
|
12
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
10
|
+
const toMerged = require('../_chunk/toMerged-DD-s3X.js');
|
|
11
|
+
const isPlainObject$1 = require('../_chunk/isPlainObject-DKBeLp.js');
|
|
12
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-DDVaWr.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;
|
|
@@ -1873,6 +1874,9 @@ exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
|
1873
1874
|
exports.isDate = isWeakSet$1.isDate;
|
|
1874
1875
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
1875
1876
|
exports.isFunction = isWeakSet$1.isFunction;
|
|
1877
|
+
exports.isJSONArray = isWeakSet$1.isJSONArray;
|
|
1878
|
+
exports.isJSONObject = isWeakSet$1.isJSONObject;
|
|
1879
|
+
exports.isJSONValue = isWeakSet$1.isJSONValue;
|
|
1876
1880
|
exports.isLength = isWeakSet$1.isLength;
|
|
1877
1881
|
exports.isMap = isWeakSet$1.isMap;
|
|
1878
1882
|
exports.isNotNil = isWeakSet$1.isNotNil;
|
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';
|
|
@@ -80,6 +81,9 @@ export { isNull } from '../predicate/isNull.mjs';
|
|
|
80
81
|
export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
81
82
|
export { isLength } from '../predicate/isLength.mjs';
|
|
82
83
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
84
|
+
export { isJSONObject } from '../predicate/isJSONObject.mjs';
|
|
85
|
+
export { isJSONValue } from '../predicate/isJSONValue.mjs';
|
|
86
|
+
export { isJSONArray } from '../predicate/isJSONArray.mjs';
|
|
83
87
|
export { isSet } from '../predicate/isSet.mjs';
|
|
84
88
|
export { delay } from '../promise/delay.mjs';
|
|
85
89
|
export { withTimeout } from '../promise/withTimeout.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';
|
|
@@ -113,6 +114,9 @@ export { isRegExp } from './predicate/isRegExp.mjs';
|
|
|
113
114
|
export { isBoolean } from './predicate/isBoolean.mjs';
|
|
114
115
|
export { isSymbol } from './predicate/isSymbol.mjs';
|
|
115
116
|
export { isString } from './predicate/isString.mjs';
|
|
117
|
+
export { isJSONObject } from './predicate/isJSONObject.mjs';
|
|
118
|
+
export { isJSONValue } from './predicate/isJSONValue.mjs';
|
|
119
|
+
export { isJSONArray } from './predicate/isJSONArray.mjs';
|
|
116
120
|
export { isSet } from './predicate/isSet.mjs';
|
|
117
121
|
export { isWeakMap } from './predicate/isWeakMap.mjs';
|
|
118
122
|
export { isWeakSet } from './predicate/isWeakSet.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';
|
|
@@ -113,6 +114,9 @@ export { isRegExp } from './predicate/isRegExp.js';
|
|
|
113
114
|
export { isBoolean } from './predicate/isBoolean.js';
|
|
114
115
|
export { isSymbol } from './predicate/isSymbol.js';
|
|
115
116
|
export { isString } from './predicate/isString.js';
|
|
117
|
+
export { isJSONObject } from './predicate/isJSONObject.js';
|
|
118
|
+
export { isJSONValue } from './predicate/isJSONValue.js';
|
|
119
|
+
export { isJSONArray } from './predicate/isJSONArray.js';
|
|
116
120
|
export { isSet } from './predicate/isSet.js';
|
|
117
121
|
export { isWeakMap } from './predicate/isWeakMap.js';
|
|
118
122
|
export { isWeakSet } from './predicate/isWeakSet.js';
|
package/dist/index.js
CHANGED
|
@@ -5,16 +5,16 @@ 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
|
-
const toMerged = require('./_chunk/toMerged-
|
|
15
|
-
const isWeakSet = require('./_chunk/isWeakSet-
|
|
14
|
+
const toMerged = require('./_chunk/toMerged-DD-s3X.js');
|
|
15
|
+
const isWeakSet = require('./_chunk/isWeakSet-DDVaWr.js');
|
|
16
16
|
const predicate_index = require('./predicate/index.js');
|
|
17
|
-
const isPlainObject = require('./_chunk/isPlainObject-
|
|
17
|
+
const isPlainObject = require('./_chunk/isPlainObject-DKBeLp.js');
|
|
18
18
|
const pad = require('./_chunk/pad-Cw2pvt.js');
|
|
19
19
|
const string_index = require('./string/index.js');
|
|
20
20
|
|
|
@@ -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;
|
|
@@ -124,6 +125,9 @@ exports.toMerged = toMerged.toMerged;
|
|
|
124
125
|
exports.isDate = isWeakSet.isDate;
|
|
125
126
|
exports.isEqual = isWeakSet.isEqual;
|
|
126
127
|
exports.isFunction = isWeakSet.isFunction;
|
|
128
|
+
exports.isJSONArray = isWeakSet.isJSONArray;
|
|
129
|
+
exports.isJSONObject = isWeakSet.isJSONObject;
|
|
130
|
+
exports.isJSONValue = isWeakSet.isJSONValue;
|
|
127
131
|
exports.isLength = isWeakSet.isLength;
|
|
128
132
|
exports.isMap = isWeakSet.isMap;
|
|
129
133
|
exports.isNil = isWeakSet.isNil;
|
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';
|
|
@@ -113,6 +114,9 @@ export { isRegExp } from './predicate/isRegExp.mjs';
|
|
|
113
114
|
export { isBoolean } from './predicate/isBoolean.mjs';
|
|
114
115
|
export { isSymbol } from './predicate/isSymbol.mjs';
|
|
115
116
|
export { isString } from './predicate/isString.mjs';
|
|
117
|
+
export { isJSONObject } from './predicate/isJSONObject.mjs';
|
|
118
|
+
export { isJSONValue } from './predicate/isJSONValue.mjs';
|
|
119
|
+
export { isJSONArray } from './predicate/isJSONArray.mjs';
|
|
116
120
|
export { isSet } from './predicate/isSet.mjs';
|
|
117
121
|
export { isWeakMap } from './predicate/isWeakMap.mjs';
|
|
118
122
|
export { isWeakSet } from './predicate/isWeakSet.mjs';
|
package/dist/object/index.js
CHANGED
|
@@ -15,6 +15,9 @@ export { isRegExp } from './isRegExp.mjs';
|
|
|
15
15
|
export { isBoolean } from './isBoolean.mjs';
|
|
16
16
|
export { isSymbol } from './isSymbol.mjs';
|
|
17
17
|
export { isString } from './isString.mjs';
|
|
18
|
+
export { isJSONObject } from './isJSONObject.mjs';
|
|
19
|
+
export { isJSONValue } from './isJSONValue.mjs';
|
|
20
|
+
export { isJSONArray } from './isJSONArray.mjs';
|
|
18
21
|
export { isSet } from './isSet.mjs';
|
|
19
22
|
export { isWeakMap } from './isWeakMap.mjs';
|
|
20
23
|
export { isWeakSet } from './isWeakSet.mjs';
|
|
@@ -15,6 +15,9 @@ export { isRegExp } from './isRegExp.js';
|
|
|
15
15
|
export { isBoolean } from './isBoolean.js';
|
|
16
16
|
export { isSymbol } from './isSymbol.js';
|
|
17
17
|
export { isString } from './isString.js';
|
|
18
|
+
export { isJSONObject } from './isJSONObject.js';
|
|
19
|
+
export { isJSONValue } from './isJSONValue.js';
|
|
20
|
+
export { isJSONArray } from './isJSONArray.js';
|
|
18
21
|
export { isSet } from './isSet.js';
|
|
19
22
|
export { isWeakMap } from './isWeakMap.js';
|
|
20
23
|
export { isWeakSet } from './isWeakSet.js';
|
package/dist/predicate/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const isWeakSet = require('../_chunk/isWeakSet-
|
|
6
|
-
const isPlainObject = require('../_chunk/isPlainObject-
|
|
5
|
+
const isWeakSet = require('../_chunk/isWeakSet-DDVaWr.js');
|
|
6
|
+
const isPlainObject = require('../_chunk/isPlainObject-DKBeLp.js');
|
|
7
7
|
|
|
8
8
|
function isError(value) {
|
|
9
9
|
return value instanceof Error;
|
|
@@ -24,6 +24,9 @@ function isString(value) {
|
|
|
24
24
|
exports.isDate = isWeakSet.isDate;
|
|
25
25
|
exports.isEqual = isWeakSet.isEqual;
|
|
26
26
|
exports.isFunction = isWeakSet.isFunction;
|
|
27
|
+
exports.isJSONArray = isWeakSet.isJSONArray;
|
|
28
|
+
exports.isJSONObject = isWeakSet.isJSONObject;
|
|
29
|
+
exports.isJSONValue = isWeakSet.isJSONValue;
|
|
27
30
|
exports.isLength = isWeakSet.isLength;
|
|
28
31
|
exports.isMap = isWeakSet.isMap;
|
|
29
32
|
exports.isNil = isWeakSet.isNil;
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -15,6 +15,9 @@ export { isRegExp } from './isRegExp.mjs';
|
|
|
15
15
|
export { isBoolean } from './isBoolean.mjs';
|
|
16
16
|
export { isSymbol } from './isSymbol.mjs';
|
|
17
17
|
export { isString } from './isString.mjs';
|
|
18
|
+
export { isJSONObject } from './isJSONObject.mjs';
|
|
19
|
+
export { isJSONValue } from './isJSONValue.mjs';
|
|
20
|
+
export { isJSONArray } from './isJSONArray.mjs';
|
|
18
21
|
export { isSet } from './isSet.mjs';
|
|
19
22
|
export { isWeakMap } from './isWeakMap.mjs';
|
|
20
23
|
export { isWeakSet } from './isWeakSet.mjs';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given value is a valid JSON array.
|
|
3
|
+
*
|
|
4
|
+
* A valid JSON array is defined as an array where all items are valid JSON values.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} value - The value to check.
|
|
7
|
+
* @returns {value is any[]} - True if the value is a valid JSON array, otherwise false.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* console.log(isJSONArray([1, 2, 3])); // true
|
|
11
|
+
* console.log(isJSONArray(["string", null, true])); // true
|
|
12
|
+
* console.log(isJSONArray([1, 2, () => {}])); // false
|
|
13
|
+
* console.log(isJSONArray("not an array")); // false
|
|
14
|
+
*/
|
|
15
|
+
declare function isJSONArray(value: unknown): value is any[];
|
|
16
|
+
|
|
17
|
+
export { isJSONArray };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given value is a valid JSON array.
|
|
3
|
+
*
|
|
4
|
+
* A valid JSON array is defined as an array where all items are valid JSON values.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} value - The value to check.
|
|
7
|
+
* @returns {value is any[]} - True if the value is a valid JSON array, otherwise false.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* console.log(isJSONArray([1, 2, 3])); // true
|
|
11
|
+
* console.log(isJSONArray(["string", null, true])); // true
|
|
12
|
+
* console.log(isJSONArray([1, 2, () => {}])); // false
|
|
13
|
+
* console.log(isJSONArray("not an array")); // false
|
|
14
|
+
*/
|
|
15
|
+
declare function isJSONArray(value: unknown): value is any[];
|
|
16
|
+
|
|
17
|
+
export { isJSONArray };
|