es-toolkit 1.35.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/_chunk/{isPromise-ByAybB.js → isPromise-CxqI1v.js} +122 -36
- package/dist/_chunk/{reverseString-D-wK2p.js → reverseString-BixeGz.js} +84 -13
- package/dist/_chunk/toSnakeCaseKeys-DZO2eB.js +4901 -0
- package/dist/_chunk/{unary-BsNWRM.js → unary-EIEhcF.js} +46 -0
- package/dist/_chunk/{zip-_HttSl.js → zip-BJSrRi.js} +38 -57
- package/dist/array/index.js +55 -6
- package/dist/array/pullAt.d.mts +0 -2
- package/dist/array/pullAt.d.ts +0 -2
- package/dist/array/take.d.mts +1 -1
- package/dist/array/take.d.ts +1 -1
- package/dist/array/take.mjs +4 -1
- package/dist/array/takeRight.d.mts +1 -1
- package/dist/array/takeRight.d.ts +1 -1
- package/dist/array/takeRight.mjs +5 -2
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/copyArray.mjs +12 -0
- package/dist/compat/_internal/mapToEntries.mjs +11 -0
- package/dist/compat/_internal/setToEntries.mjs +11 -0
- package/dist/compat/_internal/toKey.mjs +2 -2
- package/dist/compat/array/find.mjs +3 -3
- package/dist/compat/array/findLast.mjs +2 -2
- package/dist/compat/array/flatMap.d.mts +20 -0
- package/dist/compat/array/flatMap.d.ts +20 -0
- package/dist/compat/array/flatMap.mjs +13 -0
- package/dist/compat/array/forEachRight.d.mts +106 -0
- package/dist/compat/array/forEachRight.d.ts +106 -0
- package/dist/compat/array/forEachRight.mjs +21 -0
- package/dist/compat/array/groupBy.d.mts +55 -0
- package/dist/compat/array/groupBy.d.ts +55 -0
- package/dist/compat/array/groupBy.mjs +15 -0
- package/dist/compat/array/partition.d.mts +65 -0
- package/dist/compat/array/partition.d.ts +65 -0
- package/dist/compat/array/partition.mjs +24 -0
- package/dist/compat/array/pullAllWith.d.mts +59 -0
- package/dist/compat/array/pullAllWith.d.ts +59 -0
- package/dist/compat/array/pullAllWith.mjs +33 -0
- package/dist/compat/array/pullAt.d.mts +32 -0
- package/dist/compat/array/pullAt.d.ts +32 -0
- package/dist/compat/array/pullAt.mjs +34 -0
- package/dist/compat/compat.d.mts +310 -0
- package/dist/compat/compat.d.ts +310 -0
- package/dist/compat/compat.mjs +312 -0
- package/dist/compat/function/partial.d.mts +575 -0
- package/dist/compat/function/partial.d.ts +575 -0
- package/dist/compat/function/partial.mjs +8 -0
- package/dist/compat/function/partialRight.d.mts +651 -0
- package/dist/compat/function/partialRight.d.ts +651 -0
- package/dist/compat/function/partialRight.mjs +8 -0
- package/dist/compat/index.d.mts +16 -7
- package/dist/compat/index.d.ts +16 -7
- package/dist/compat/index.js +290 -3771
- package/dist/compat/index.mjs +19 -8
- package/dist/compat/object/defaults.mjs +7 -1
- package/dist/compat/object/forIn.d.mts +58 -0
- package/dist/compat/object/forIn.d.ts +58 -0
- package/dist/compat/object/forIn.mjs +16 -0
- package/dist/compat/object/forInRight.d.mts +58 -0
- package/dist/compat/object/forInRight.d.ts +58 -0
- package/dist/compat/object/forInRight.mjs +21 -0
- package/dist/compat/object/forOwn.d.mts +54 -0
- package/dist/compat/object/forOwn.d.ts +54 -0
- package/dist/compat/object/forOwn.mjs +19 -0
- package/dist/compat/object/forOwnRight.d.mts +54 -0
- package/dist/compat/object/forOwnRight.d.ts +54 -0
- package/dist/compat/object/forOwnRight.mjs +19 -0
- package/dist/compat/object/hasIn.d.mts +40 -0
- package/dist/compat/object/hasIn.d.ts +40 -0
- package/dist/compat/object/hasIn.mjs +34 -0
- package/dist/compat/object/toPairs.mjs +7 -2
- package/dist/compat/object/toPairsIn.mjs +7 -2
- package/dist/compat/string/repeat.d.mts +1 -1
- package/dist/compat/string/repeat.d.ts +1 -1
- package/dist/compat/string/repeat.mjs +12 -2
- package/dist/compat/string/words.d.mts +1 -1
- package/dist/compat/string/words.d.ts +1 -1
- package/dist/compat/string/words.mjs +2 -1
- package/dist/compat/toolkit.d.mts +9 -0
- package/dist/compat/toolkit.d.ts +9 -0
- package/dist/compat/toolkit.mjs +10 -0
- package/dist/compat/util/overEvery.d.mts +67 -0
- package/dist/compat/util/overEvery.d.ts +67 -0
- package/dist/compat/util/overEvery.mjs +23 -0
- package/dist/compat/util/overSome.d.mts +69 -0
- package/dist/compat/util/overSome.d.ts +69 -0
- package/dist/compat/util/overSome.mjs +23 -0
- package/dist/function/index.js +3 -5
- package/dist/function/partial.d.mts +3 -3
- package/dist/function/partial.d.ts +3 -3
- package/dist/function/partial.mjs +17 -19
- package/dist/function/partialRight.d.mts +3 -3
- package/dist/function/partialRight.d.ts +3 -3
- package/dist/function/partialRight.mjs +18 -20
- package/dist/function/throttle.mjs +0 -1
- package/dist/index.js +39 -42
- package/dist/object/index.js +15 -15
- package/dist/object/toCamelCaseKeys.mjs +3 -0
- package/dist/object/toSnakeCaseKeys.mjs +3 -0
- package/dist/predicate/index.js +4 -5
- package/dist/string/index.js +7 -8
- package/package.json +1 -1
- package/dist/_chunk/isPlainObject-Xaozpc.js +0 -93
- package/dist/_chunk/partialRight-B0_CSB.js +0 -50
- package/dist/_chunk/snakeCase-BtVEeB.js +0 -75
- package/dist/_chunk/toSnakeCaseKeys-BNpS71.js +0 -569
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
function partial(func, ...partialArgs) {
|
|
2
|
-
return
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
for (let i = startIndex; i < providedArgs.length; i++) {
|
|
15
|
-
args.push(providedArgs[i]);
|
|
16
|
-
}
|
|
17
|
-
return func.apply(this, args);
|
|
2
|
+
return partialImpl(func, placeholderSymbol, ...partialArgs);
|
|
3
|
+
}
|
|
4
|
+
function partialImpl(func, placeholder, ...partialArgs) {
|
|
5
|
+
const partialed = function (...providedArgs) {
|
|
6
|
+
let providedArgsIndex = 0;
|
|
7
|
+
const substitutedArgs = partialArgs
|
|
8
|
+
.slice()
|
|
9
|
+
.map(arg => (arg === placeholder ? providedArgs[providedArgsIndex++] : arg));
|
|
10
|
+
const remainingArgs = providedArgs.slice(providedArgsIndex);
|
|
11
|
+
return func.apply(this, substitutedArgs.concat(remainingArgs));
|
|
18
12
|
};
|
|
13
|
+
if (func.prototype) {
|
|
14
|
+
partialed.prototype = Object.create(func.prototype);
|
|
15
|
+
}
|
|
16
|
+
return partialed;
|
|
19
17
|
}
|
|
20
|
-
const
|
|
21
|
-
partial.placeholder =
|
|
18
|
+
const placeholderSymbol = Symbol('partial.placeholder');
|
|
19
|
+
partial.placeholder = placeholderSymbol;
|
|
22
20
|
|
|
23
|
-
export { partial };
|
|
21
|
+
export { partial, partialImpl };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
type Placeholder = typeof partialRightPlaceholder;
|
|
2
1
|
/**
|
|
3
2
|
* This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
|
|
4
3
|
*
|
|
@@ -621,8 +620,9 @@ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3
|
|
|
621
620
|
*/
|
|
622
621
|
declare function partialRight(func: (...args: any[]) => any, ...args: any[]): (...args: any[]) => any;
|
|
623
622
|
declare namespace partialRight {
|
|
624
|
-
var placeholder: typeof
|
|
623
|
+
var placeholder: typeof placeholderSymbol;
|
|
625
624
|
}
|
|
626
|
-
declare const
|
|
625
|
+
declare const placeholderSymbol: unique symbol;
|
|
626
|
+
type Placeholder = typeof placeholderSymbol;
|
|
627
627
|
|
|
628
628
|
export { partialRight };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
type Placeholder = typeof partialRightPlaceholder;
|
|
2
1
|
/**
|
|
3
2
|
* This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
|
|
4
3
|
*
|
|
@@ -621,8 +620,9 @@ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3
|
|
|
621
620
|
*/
|
|
622
621
|
declare function partialRight(func: (...args: any[]) => any, ...args: any[]): (...args: any[]) => any;
|
|
623
622
|
declare namespace partialRight {
|
|
624
|
-
var placeholder: typeof
|
|
623
|
+
var placeholder: typeof placeholderSymbol;
|
|
625
624
|
}
|
|
626
|
-
declare const
|
|
625
|
+
declare const placeholderSymbol: unique symbol;
|
|
626
|
+
type Placeholder = typeof placeholderSymbol;
|
|
627
627
|
|
|
628
628
|
export { partialRight };
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
function partialRight(func, ...partialArgs) {
|
|
2
|
-
return
|
|
3
|
-
|
|
2
|
+
return partialRightImpl(func, placeholderSymbol, ...partialArgs);
|
|
3
|
+
}
|
|
4
|
+
function partialRightImpl(func, placeholder, ...partialArgs) {
|
|
5
|
+
const partialedRight = function (...providedArgs) {
|
|
6
|
+
const placeholderLength = partialArgs.filter(arg => arg === placeholder).length;
|
|
4
7
|
const rangeLength = Math.max(providedArgs.length - placeholderLength, 0);
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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);
|
|
8
|
+
const remainingArgs = providedArgs.slice(0, rangeLength);
|
|
9
|
+
let providedArgsIndex = rangeLength;
|
|
10
|
+
const substitutedArgs = partialArgs
|
|
11
|
+
.slice()
|
|
12
|
+
.map(arg => (arg === placeholder ? providedArgs[providedArgsIndex++] : arg));
|
|
13
|
+
return func.apply(this, remainingArgs.concat(substitutedArgs));
|
|
20
14
|
};
|
|
15
|
+
if (func.prototype) {
|
|
16
|
+
partialedRight.prototype = Object.create(func.prototype);
|
|
17
|
+
}
|
|
18
|
+
return partialedRight;
|
|
21
19
|
}
|
|
22
|
-
const
|
|
23
|
-
partialRight.placeholder =
|
|
20
|
+
const placeholderSymbol = Symbol('partialRight.placeholder');
|
|
21
|
+
partialRight.placeholder = placeholderSymbol;
|
|
24
22
|
|
|
25
|
-
export { partialRight };
|
|
23
|
+
export { partialRight, partialRightImpl };
|
package/dist/index.js
CHANGED
|
@@ -2,33 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const zip = require('./_chunk/zip-_HttSl.js');
|
|
6
5
|
const array_index = require('./array/index.js');
|
|
6
|
+
const zip = require('./_chunk/zip-BJSrRi.js');
|
|
7
7
|
const AbortError = require('./_chunk/AbortError-Cg4ZQ1.js');
|
|
8
8
|
const error_index = require('./error/index.js');
|
|
9
|
-
const unary = require('./_chunk/unary-
|
|
9
|
+
const unary = require('./_chunk/unary-EIEhcF.js');
|
|
10
10
|
const function_index = require('./function/index.js');
|
|
11
11
|
const noop = require('./_chunk/noop-2IwLUk.js');
|
|
12
|
-
const partialRight = require('./_chunk/partialRight-B0_CSB.js');
|
|
13
12
|
const range = require('./_chunk/range-HnEIT7.js');
|
|
14
13
|
const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
15
14
|
const math_index = require('./math/index.js');
|
|
16
|
-
const
|
|
15
|
+
const compat_index = require('./_chunk/toSnakeCaseKeys-DZO2eB.js');
|
|
17
16
|
const object_index = require('./object/index.js');
|
|
18
|
-
const isPromise = require('./_chunk/isPromise-
|
|
17
|
+
const isPromise = require('./_chunk/isPromise-CxqI1v.js');
|
|
19
18
|
const predicate_index = require('./predicate/index.js');
|
|
20
|
-
const isPlainObject = require('./_chunk/isPlainObject-Xaozpc.js');
|
|
21
19
|
const delay = require('./_chunk/delay-_VMfFa.js');
|
|
22
20
|
const promise_index = require('./promise/index.js');
|
|
23
|
-
const
|
|
24
|
-
const reverseString = require('./_chunk/reverseString-D-wK2p.js');
|
|
21
|
+
const reverseString = require('./_chunk/reverseString-BixeGz.js');
|
|
25
22
|
const string_index = require('./string/index.js');
|
|
26
23
|
const util_index = require('./util/index.js');
|
|
27
24
|
const invariant = require('./_chunk/invariant-BfGFfr.js');
|
|
28
25
|
|
|
29
26
|
|
|
30
27
|
|
|
31
|
-
exports.at =
|
|
28
|
+
exports.at = array_index.at;
|
|
29
|
+
exports.flatMap = array_index.flatMap;
|
|
30
|
+
exports.forEachRight = array_index.forEachRight;
|
|
31
|
+
exports.orderBy = array_index.orderBy;
|
|
32
|
+
exports.partition = array_index.partition;
|
|
33
|
+
exports.pullAt = array_index.pullAt;
|
|
34
|
+
exports.sortBy = array_index.sortBy;
|
|
35
|
+
exports.takeRightWhile = array_index.takeRightWhile;
|
|
36
|
+
exports.takeWhile = array_index.takeWhile;
|
|
37
|
+
exports.zipObject = array_index.zipObject;
|
|
38
|
+
exports.zipWith = array_index.zipWith;
|
|
32
39
|
exports.chunk = zip.chunk;
|
|
33
40
|
exports.compact = zip.compact;
|
|
34
41
|
exports.countBy = zip.countBy;
|
|
@@ -40,11 +47,9 @@ exports.dropRight = zip.dropRight;
|
|
|
40
47
|
exports.dropRightWhile = zip.dropRightWhile;
|
|
41
48
|
exports.dropWhile = zip.dropWhile;
|
|
42
49
|
exports.fill = zip.fill;
|
|
43
|
-
exports.flatMap = zip.flatMap;
|
|
44
50
|
exports.flatMapDeep = zip.flatMapDeep;
|
|
45
51
|
exports.flatten = zip.flatten;
|
|
46
52
|
exports.flattenDeep = zip.flattenDeep;
|
|
47
|
-
exports.forEachRight = zip.forEachRight;
|
|
48
53
|
exports.groupBy = zip.groupBy;
|
|
49
54
|
exports.head = zip.head;
|
|
50
55
|
exports.initial = zip.initial;
|
|
@@ -57,9 +62,7 @@ exports.keyBy = zip.keyBy;
|
|
|
57
62
|
exports.last = zip.last;
|
|
58
63
|
exports.maxBy = zip.maxBy;
|
|
59
64
|
exports.minBy = zip.minBy;
|
|
60
|
-
exports.partition = zip.partition;
|
|
61
65
|
exports.pull = zip.pull;
|
|
62
|
-
exports.pullAt = zip.pullAt;
|
|
63
66
|
exports.remove = zip.remove;
|
|
64
67
|
exports.sample = zip.sample;
|
|
65
68
|
exports.sampleSize = zip.sampleSize;
|
|
@@ -82,12 +85,6 @@ exports.xor = zip.xor;
|
|
|
82
85
|
exports.xorBy = zip.xorBy;
|
|
83
86
|
exports.xorWith = zip.xorWith;
|
|
84
87
|
exports.zip = zip.zip;
|
|
85
|
-
exports.orderBy = array_index.orderBy;
|
|
86
|
-
exports.sortBy = array_index.sortBy;
|
|
87
|
-
exports.takeRightWhile = array_index.takeRightWhile;
|
|
88
|
-
exports.takeWhile = array_index.takeWhile;
|
|
89
|
-
exports.zipObject = array_index.zipObject;
|
|
90
|
-
exports.zipWith = array_index.zipWith;
|
|
91
88
|
exports.AbortError = AbortError.AbortError;
|
|
92
89
|
exports.TimeoutError = error_index.TimeoutError;
|
|
93
90
|
exports.after = unary.after;
|
|
@@ -100,6 +97,8 @@ exports.identity = unary.identity;
|
|
|
100
97
|
exports.memoize = unary.memoize;
|
|
101
98
|
exports.negate = unary.negate;
|
|
102
99
|
exports.once = unary.once;
|
|
100
|
+
exports.partial = unary.partial;
|
|
101
|
+
exports.partialRight = unary.partialRight;
|
|
103
102
|
exports.rest = unary.rest;
|
|
104
103
|
exports.retry = unary.retry;
|
|
105
104
|
exports.unary = unary.unary;
|
|
@@ -109,8 +108,6 @@ exports.curryRight = function_index.curryRight;
|
|
|
109
108
|
exports.spread = function_index.spread;
|
|
110
109
|
exports.throttle = function_index.throttle;
|
|
111
110
|
exports.noop = noop.noop;
|
|
112
|
-
exports.partial = partialRight.partial;
|
|
113
|
-
exports.partialRight = partialRight.partialRight;
|
|
114
111
|
exports.clamp = range.clamp;
|
|
115
112
|
exports.inRange = range.inRange;
|
|
116
113
|
exports.mean = range.mean;
|
|
@@ -124,19 +121,19 @@ exports.randomInt = randomInt.randomInt;
|
|
|
124
121
|
exports.rangeRight = math_index.rangeRight;
|
|
125
122
|
exports.round = math_index.round;
|
|
126
123
|
exports.sumBy = math_index.sumBy;
|
|
127
|
-
exports.clone =
|
|
128
|
-
exports.cloneDeep =
|
|
129
|
-
exports.cloneDeepWith =
|
|
130
|
-
exports.findKey =
|
|
131
|
-
exports.flattenObject =
|
|
132
|
-
exports.invert =
|
|
133
|
-
exports.mapKeys =
|
|
134
|
-
exports.mapValues =
|
|
135
|
-
exports.merge =
|
|
136
|
-
exports.omitBy =
|
|
137
|
-
exports.toCamelCaseKeys =
|
|
138
|
-
exports.toMerged =
|
|
139
|
-
exports.toSnakeCaseKeys =
|
|
124
|
+
exports.clone = compat_index.clone;
|
|
125
|
+
exports.cloneDeep = compat_index.cloneDeep;
|
|
126
|
+
exports.cloneDeepWith = compat_index.cloneDeepWith;
|
|
127
|
+
exports.findKey = compat_index.findKey;
|
|
128
|
+
exports.flattenObject = compat_index.flattenObject;
|
|
129
|
+
exports.invert = compat_index.invert;
|
|
130
|
+
exports.mapKeys = compat_index.mapKeys;
|
|
131
|
+
exports.mapValues = compat_index.mapValues;
|
|
132
|
+
exports.merge = compat_index.merge;
|
|
133
|
+
exports.omitBy = compat_index.omitBy;
|
|
134
|
+
exports.toCamelCaseKeys = compat_index.toCamelCaseKeys;
|
|
135
|
+
exports.toMerged = compat_index.toMerged;
|
|
136
|
+
exports.toSnakeCaseKeys = compat_index.toSnakeCaseKeys;
|
|
140
137
|
exports.mergeWith = object_index.mergeWith;
|
|
141
138
|
exports.omit = object_index.omit;
|
|
142
139
|
exports.pick = object_index.pick;
|
|
@@ -160,30 +157,28 @@ exports.isNil = isPromise.isNil;
|
|
|
160
157
|
exports.isNode = isPromise.isNode;
|
|
161
158
|
exports.isNotNil = isPromise.isNotNil;
|
|
162
159
|
exports.isNull = isPromise.isNull;
|
|
160
|
+
exports.isPlainObject = isPromise.isPlainObject;
|
|
161
|
+
exports.isPrimitive = isPromise.isPrimitive;
|
|
163
162
|
exports.isPromise = isPromise.isPromise;
|
|
164
163
|
exports.isRegExp = isPromise.isRegExp;
|
|
165
164
|
exports.isSet = isPromise.isSet;
|
|
166
165
|
exports.isSymbol = isPromise.isSymbol;
|
|
166
|
+
exports.isTypedArray = isPromise.isTypedArray;
|
|
167
167
|
exports.isUndefined = isPromise.isUndefined;
|
|
168
168
|
exports.isWeakMap = isPromise.isWeakMap;
|
|
169
169
|
exports.isWeakSet = isPromise.isWeakSet;
|
|
170
170
|
exports.isBoolean = predicate_index.isBoolean;
|
|
171
171
|
exports.isError = predicate_index.isError;
|
|
172
172
|
exports.isString = predicate_index.isString;
|
|
173
|
-
exports.isPlainObject = isPlainObject.isPlainObject;
|
|
174
|
-
exports.isPrimitive = isPlainObject.isPrimitive;
|
|
175
|
-
exports.isTypedArray = isPlainObject.isTypedArray;
|
|
176
173
|
exports.delay = delay.delay;
|
|
177
174
|
exports.Mutex = promise_index.Mutex;
|
|
178
175
|
exports.Semaphore = promise_index.Semaphore;
|
|
179
176
|
exports.timeout = promise_index.timeout;
|
|
180
177
|
exports.withTimeout = promise_index.withTimeout;
|
|
181
|
-
exports.camelCase =
|
|
182
|
-
exports.capitalize =
|
|
183
|
-
exports.deburr = snakeCase.deburr;
|
|
184
|
-
exports.snakeCase = snakeCase.snakeCase;
|
|
185
|
-
exports.words = snakeCase.words;
|
|
178
|
+
exports.camelCase = reverseString.camelCase;
|
|
179
|
+
exports.capitalize = reverseString.capitalize;
|
|
186
180
|
exports.constantCase = reverseString.constantCase;
|
|
181
|
+
exports.deburr = reverseString.deburr;
|
|
187
182
|
exports.escape = reverseString.escape;
|
|
188
183
|
exports.escapeRegExp = reverseString.escapeRegExp;
|
|
189
184
|
exports.kebabCase = reverseString.kebabCase;
|
|
@@ -192,12 +187,14 @@ exports.lowerFirst = reverseString.lowerFirst;
|
|
|
192
187
|
exports.pad = reverseString.pad;
|
|
193
188
|
exports.pascalCase = reverseString.pascalCase;
|
|
194
189
|
exports.reverseString = reverseString.reverseString;
|
|
190
|
+
exports.snakeCase = reverseString.snakeCase;
|
|
195
191
|
exports.trim = reverseString.trim;
|
|
196
192
|
exports.trimEnd = reverseString.trimEnd;
|
|
197
193
|
exports.trimStart = reverseString.trimStart;
|
|
198
194
|
exports.unescape = reverseString.unescape;
|
|
199
195
|
exports.upperCase = reverseString.upperCase;
|
|
200
196
|
exports.upperFirst = reverseString.upperFirst;
|
|
197
|
+
exports.words = reverseString.words;
|
|
201
198
|
exports.startCase = string_index.startCase;
|
|
202
199
|
exports.attempt = util_index.attempt;
|
|
203
200
|
exports.attemptAsync = invariant.attemptAsync;
|
package/dist/object/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const compat_index = require('../_chunk/toSnakeCaseKeys-DZO2eB.js');
|
|
6
6
|
|
|
7
7
|
function mergeWith(target, source, merge) {
|
|
8
8
|
const sourceKeys = Object.keys(source);
|
|
@@ -17,7 +17,7 @@ function mergeWith(target, source, merge) {
|
|
|
17
17
|
else if (Array.isArray(sourceValue)) {
|
|
18
18
|
target[key] = mergeWith(targetValue ?? [], sourceValue, merge);
|
|
19
19
|
}
|
|
20
|
-
else if (
|
|
20
|
+
else if (compat_index.isObjectLike(targetValue) && compat_index.isObjectLike(sourceValue)) {
|
|
21
21
|
target[key] = mergeWith(targetValue ?? {}, sourceValue, merge);
|
|
22
22
|
}
|
|
23
23
|
else if (targetValue === undefined || sourceValue !== undefined) {
|
|
@@ -60,19 +60,19 @@ function pickBy(obj, shouldPick) {
|
|
|
60
60
|
return result;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
exports.clone =
|
|
64
|
-
exports.cloneDeep =
|
|
65
|
-
exports.cloneDeepWith =
|
|
66
|
-
exports.findKey =
|
|
67
|
-
exports.flattenObject =
|
|
68
|
-
exports.invert =
|
|
69
|
-
exports.mapKeys =
|
|
70
|
-
exports.mapValues =
|
|
71
|
-
exports.merge =
|
|
72
|
-
exports.omitBy =
|
|
73
|
-
exports.toCamelCaseKeys =
|
|
74
|
-
exports.toMerged =
|
|
75
|
-
exports.toSnakeCaseKeys =
|
|
63
|
+
exports.clone = compat_index.clone;
|
|
64
|
+
exports.cloneDeep = compat_index.cloneDeep;
|
|
65
|
+
exports.cloneDeepWith = compat_index.cloneDeepWith;
|
|
66
|
+
exports.findKey = compat_index.findKey;
|
|
67
|
+
exports.flattenObject = compat_index.flattenObject;
|
|
68
|
+
exports.invert = compat_index.invert;
|
|
69
|
+
exports.mapKeys = compat_index.mapKeys;
|
|
70
|
+
exports.mapValues = compat_index.mapValues;
|
|
71
|
+
exports.merge = compat_index.merge;
|
|
72
|
+
exports.omitBy = compat_index.omitBy;
|
|
73
|
+
exports.toCamelCaseKeys = compat_index.toCamelCaseKeys;
|
|
74
|
+
exports.toMerged = compat_index.toMerged;
|
|
75
|
+
exports.toSnakeCaseKeys = compat_index.toSnakeCaseKeys;
|
|
76
76
|
exports.mergeWith = mergeWith;
|
|
77
77
|
exports.omit = omit;
|
|
78
78
|
exports.pick = pick;
|
|
@@ -7,7 +7,10 @@ import '../compat/function/bind.mjs';
|
|
|
7
7
|
import '../compat/function/bindKey.mjs';
|
|
8
8
|
import '../compat/function/curry.mjs';
|
|
9
9
|
import '../compat/function/curryRight.mjs';
|
|
10
|
+
import '../compat/function/partial.mjs';
|
|
11
|
+
import '../compat/function/partialRight.mjs';
|
|
10
12
|
import { isPlainObject } from '../compat/predicate/isPlainObject.mjs';
|
|
13
|
+
import '../compat/toolkit.mjs';
|
|
11
14
|
|
|
12
15
|
function toCamelCaseKeys(obj) {
|
|
13
16
|
if (isArray(obj)) {
|
|
@@ -7,7 +7,10 @@ import '../compat/function/bind.mjs';
|
|
|
7
7
|
import '../compat/function/bindKey.mjs';
|
|
8
8
|
import '../compat/function/curry.mjs';
|
|
9
9
|
import '../compat/function/curryRight.mjs';
|
|
10
|
+
import '../compat/function/partial.mjs';
|
|
11
|
+
import '../compat/function/partialRight.mjs';
|
|
10
12
|
import { isPlainObject } from '../compat/predicate/isPlainObject.mjs';
|
|
13
|
+
import '../compat/toolkit.mjs';
|
|
11
14
|
|
|
12
15
|
function toSnakeCaseKeys(obj) {
|
|
13
16
|
if (isArray(obj)) {
|
package/dist/predicate/index.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const isPromise = require('../_chunk/isPromise-
|
|
6
|
-
const isPlainObject = require('../_chunk/isPlainObject-Xaozpc.js');
|
|
5
|
+
const isPromise = require('../_chunk/isPromise-CxqI1v.js');
|
|
7
6
|
|
|
8
7
|
function isBoolean(x) {
|
|
9
8
|
return typeof x === 'boolean';
|
|
@@ -36,16 +35,16 @@ exports.isNil = isPromise.isNil;
|
|
|
36
35
|
exports.isNode = isPromise.isNode;
|
|
37
36
|
exports.isNotNil = isPromise.isNotNil;
|
|
38
37
|
exports.isNull = isPromise.isNull;
|
|
38
|
+
exports.isPlainObject = isPromise.isPlainObject;
|
|
39
|
+
exports.isPrimitive = isPromise.isPrimitive;
|
|
39
40
|
exports.isPromise = isPromise.isPromise;
|
|
40
41
|
exports.isRegExp = isPromise.isRegExp;
|
|
41
42
|
exports.isSet = isPromise.isSet;
|
|
42
43
|
exports.isSymbol = isPromise.isSymbol;
|
|
44
|
+
exports.isTypedArray = isPromise.isTypedArray;
|
|
43
45
|
exports.isUndefined = isPromise.isUndefined;
|
|
44
46
|
exports.isWeakMap = isPromise.isWeakMap;
|
|
45
47
|
exports.isWeakSet = isPromise.isWeakSet;
|
|
46
|
-
exports.isPlainObject = isPlainObject.isPlainObject;
|
|
47
|
-
exports.isPrimitive = isPlainObject.isPrimitive;
|
|
48
|
-
exports.isTypedArray = isPlainObject.isTypedArray;
|
|
49
48
|
exports.isBoolean = isBoolean;
|
|
50
49
|
exports.isError = isError;
|
|
51
50
|
exports.isString = isString;
|
package/dist/string/index.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const reverseString = require('../_chunk/reverseString-D-wK2p.js');
|
|
5
|
+
const reverseString = require('../_chunk/reverseString-BixeGz.js');
|
|
7
6
|
|
|
8
7
|
function startCase(str) {
|
|
9
|
-
const words =
|
|
8
|
+
const words = reverseString.words(str.trim());
|
|
10
9
|
let result = '';
|
|
11
10
|
for (let i = 0; i < words.length; i++) {
|
|
12
11
|
const word = words[i];
|
|
@@ -18,12 +17,10 @@ function startCase(str) {
|
|
|
18
17
|
return result;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
exports.camelCase =
|
|
22
|
-
exports.capitalize =
|
|
23
|
-
exports.deburr = snakeCase.deburr;
|
|
24
|
-
exports.snakeCase = snakeCase.snakeCase;
|
|
25
|
-
exports.words = snakeCase.words;
|
|
20
|
+
exports.camelCase = reverseString.camelCase;
|
|
21
|
+
exports.capitalize = reverseString.capitalize;
|
|
26
22
|
exports.constantCase = reverseString.constantCase;
|
|
23
|
+
exports.deburr = reverseString.deburr;
|
|
27
24
|
exports.escape = reverseString.escape;
|
|
28
25
|
exports.escapeRegExp = reverseString.escapeRegExp;
|
|
29
26
|
exports.kebabCase = reverseString.kebabCase;
|
|
@@ -32,10 +29,12 @@ exports.lowerFirst = reverseString.lowerFirst;
|
|
|
32
29
|
exports.pad = reverseString.pad;
|
|
33
30
|
exports.pascalCase = reverseString.pascalCase;
|
|
34
31
|
exports.reverseString = reverseString.reverseString;
|
|
32
|
+
exports.snakeCase = reverseString.snakeCase;
|
|
35
33
|
exports.trim = reverseString.trim;
|
|
36
34
|
exports.trimEnd = reverseString.trimEnd;
|
|
37
35
|
exports.trimStart = reverseString.trimStart;
|
|
38
36
|
exports.unescape = reverseString.unescape;
|
|
39
37
|
exports.upperCase = reverseString.upperCase;
|
|
40
38
|
exports.upperFirst = reverseString.upperFirst;
|
|
39
|
+
exports.words = reverseString.words;
|
|
41
40
|
exports.startCase = startCase;
|
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.
|
|
4
|
+
"version": "1.36.0",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function isPrimitive(value) {
|
|
4
|
-
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function isTypedArray(x) {
|
|
8
|
-
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function getSymbols(object) {
|
|
12
|
-
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getTag(value) {
|
|
16
|
-
if (value == null) {
|
|
17
|
-
return value === undefined ? '[object Undefined]' : '[object Null]';
|
|
18
|
-
}
|
|
19
|
-
return Object.prototype.toString.call(value);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const regexpTag = '[object RegExp]';
|
|
23
|
-
const stringTag = '[object String]';
|
|
24
|
-
const numberTag = '[object Number]';
|
|
25
|
-
const booleanTag = '[object Boolean]';
|
|
26
|
-
const argumentsTag = '[object Arguments]';
|
|
27
|
-
const symbolTag = '[object Symbol]';
|
|
28
|
-
const dateTag = '[object Date]';
|
|
29
|
-
const mapTag = '[object Map]';
|
|
30
|
-
const setTag = '[object Set]';
|
|
31
|
-
const arrayTag = '[object Array]';
|
|
32
|
-
const functionTag = '[object Function]';
|
|
33
|
-
const arrayBufferTag = '[object ArrayBuffer]';
|
|
34
|
-
const objectTag = '[object Object]';
|
|
35
|
-
const errorTag = '[object Error]';
|
|
36
|
-
const dataViewTag = '[object DataView]';
|
|
37
|
-
const uint8ArrayTag = '[object Uint8Array]';
|
|
38
|
-
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
|
39
|
-
const uint16ArrayTag = '[object Uint16Array]';
|
|
40
|
-
const uint32ArrayTag = '[object Uint32Array]';
|
|
41
|
-
const bigUint64ArrayTag = '[object BigUint64Array]';
|
|
42
|
-
const int8ArrayTag = '[object Int8Array]';
|
|
43
|
-
const int16ArrayTag = '[object Int16Array]';
|
|
44
|
-
const int32ArrayTag = '[object Int32Array]';
|
|
45
|
-
const bigInt64ArrayTag = '[object BigInt64Array]';
|
|
46
|
-
const float32ArrayTag = '[object Float32Array]';
|
|
47
|
-
const float64ArrayTag = '[object Float64Array]';
|
|
48
|
-
|
|
49
|
-
function isPlainObject(value) {
|
|
50
|
-
if (!value || typeof value !== 'object') {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
const proto = Object.getPrototypeOf(value);
|
|
54
|
-
const hasObjectPrototype = proto === null ||
|
|
55
|
-
proto === Object.prototype ||
|
|
56
|
-
Object.getPrototypeOf(proto) === null;
|
|
57
|
-
if (!hasObjectPrototype) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
exports.argumentsTag = argumentsTag;
|
|
64
|
-
exports.arrayBufferTag = arrayBufferTag;
|
|
65
|
-
exports.arrayTag = arrayTag;
|
|
66
|
-
exports.bigInt64ArrayTag = bigInt64ArrayTag;
|
|
67
|
-
exports.bigUint64ArrayTag = bigUint64ArrayTag;
|
|
68
|
-
exports.booleanTag = booleanTag;
|
|
69
|
-
exports.dataViewTag = dataViewTag;
|
|
70
|
-
exports.dateTag = dateTag;
|
|
71
|
-
exports.errorTag = errorTag;
|
|
72
|
-
exports.float32ArrayTag = float32ArrayTag;
|
|
73
|
-
exports.float64ArrayTag = float64ArrayTag;
|
|
74
|
-
exports.functionTag = functionTag;
|
|
75
|
-
exports.getSymbols = getSymbols;
|
|
76
|
-
exports.getTag = getTag;
|
|
77
|
-
exports.int16ArrayTag = int16ArrayTag;
|
|
78
|
-
exports.int32ArrayTag = int32ArrayTag;
|
|
79
|
-
exports.int8ArrayTag = int8ArrayTag;
|
|
80
|
-
exports.isPlainObject = isPlainObject;
|
|
81
|
-
exports.isPrimitive = isPrimitive;
|
|
82
|
-
exports.isTypedArray = isTypedArray;
|
|
83
|
-
exports.mapTag = mapTag;
|
|
84
|
-
exports.numberTag = numberTag;
|
|
85
|
-
exports.objectTag = objectTag;
|
|
86
|
-
exports.regexpTag = regexpTag;
|
|
87
|
-
exports.setTag = setTag;
|
|
88
|
-
exports.stringTag = stringTag;
|
|
89
|
-
exports.symbolTag = symbolTag;
|
|
90
|
-
exports.uint16ArrayTag = uint16ArrayTag;
|
|
91
|
-
exports.uint32ArrayTag = uint32ArrayTag;
|
|
92
|
-
exports.uint8ArrayTag = uint8ArrayTag;
|
|
93
|
-
exports.uint8ClampedArrayTag = uint8ClampedArrayTag;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function partial(func, ...partialArgs) {
|
|
4
|
-
return function (...providedArgs) {
|
|
5
|
-
const args = [];
|
|
6
|
-
let startIndex = 0;
|
|
7
|
-
for (let i = 0; i < partialArgs.length; i++) {
|
|
8
|
-
const arg = partialArgs[i];
|
|
9
|
-
if (arg === partial.placeholder) {
|
|
10
|
-
args.push(providedArgs[startIndex++]);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
args.push(arg);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
for (let i = startIndex; i < providedArgs.length; i++) {
|
|
17
|
-
args.push(providedArgs[i]);
|
|
18
|
-
}
|
|
19
|
-
return func.apply(this, args);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const partialPlaceholder = Symbol('partial.placeholder');
|
|
23
|
-
partial.placeholder = partialPlaceholder;
|
|
24
|
-
|
|
25
|
-
function partialRight(func, ...partialArgs) {
|
|
26
|
-
return function (...providedArgs) {
|
|
27
|
-
const placeholderLength = partialArgs.filter(arg => arg === partialRightPlaceholder).length;
|
|
28
|
-
const rangeLength = Math.max(providedArgs.length - placeholderLength, 0);
|
|
29
|
-
const args = [];
|
|
30
|
-
let providedIndex = 0;
|
|
31
|
-
for (let i = 0; i < rangeLength; i++) {
|
|
32
|
-
args.push(providedArgs[providedIndex++]);
|
|
33
|
-
}
|
|
34
|
-
for (let i = 0; i < partialArgs.length; i++) {
|
|
35
|
-
const arg = partialArgs[i];
|
|
36
|
-
if (arg === partialRight.placeholder) {
|
|
37
|
-
args.push(providedArgs[providedIndex++]);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
args.push(arg);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return func.apply(this, args);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const partialRightPlaceholder = Symbol('partialRight.placeholder');
|
|
47
|
-
partialRight.placeholder = partialRightPlaceholder;
|
|
48
|
-
|
|
49
|
-
exports.partial = partial;
|
|
50
|
-
exports.partialRight = partialRight;
|