es-toolkit 1.37.0 → 1.37.1

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_chunk/{toSnakeCaseKeys-kqZCyq.js → isPlainObject-DINLyA.js} +0 -98
  3. package/dist/_chunk/{isWeakSet-C2NpfO.js → isWeakSet-403Sh5.js} +0 -92
  4. package/dist/_chunk/{range-HnEIT7.js → range-DSpBDL.js} +0 -21
  5. package/dist/_chunk/{unary-EIEhcF.js → unary-DzPndU.js} +0 -39
  6. package/dist/_chunk/{upperFirst-DbrFSz.js → upperFirst-C7IztG.js} +0 -17
  7. package/dist/_chunk/{zip-DDfXXG.js → zip-CIqPLd.js} +0 -78
  8. package/dist/array/index.js +79 -12
  9. package/dist/browser.global.js +1 -1
  10. package/dist/browser.global.js.map +1 -1
  11. package/dist/compat/array/initial.d.mts +16 -0
  12. package/dist/compat/array/initial.d.ts +16 -0
  13. package/dist/compat/array/initial.mjs +11 -0
  14. package/dist/compat/array/keyBy.d.mts +48 -0
  15. package/dist/compat/array/keyBy.d.ts +48 -0
  16. package/dist/compat/array/keyBy.mjs +21 -0
  17. package/dist/compat/array/shuffle.d.mts +22 -0
  18. package/dist/compat/array/shuffle.d.ts +22 -0
  19. package/dist/compat/array/shuffle.mjs +24 -0
  20. package/dist/compat/array/xorBy.d.mts +108 -0
  21. package/dist/compat/array/xorBy.d.ts +108 -0
  22. package/dist/compat/array/xorBy.mjs +23 -0
  23. package/dist/compat/array/xorWith.d.mts +89 -0
  24. package/dist/compat/array/xorWith.d.ts +89 -0
  25. package/dist/compat/array/xorWith.mjs +21 -0
  26. package/dist/compat/compat.d.mts +19 -54
  27. package/dist/compat/compat.d.ts +19 -54
  28. package/dist/compat/compat.mjs +22 -59
  29. package/dist/compat/function/wrap.d.mts +27 -0
  30. package/dist/compat/function/wrap.d.ts +27 -0
  31. package/dist/compat/function/wrap.mjs +11 -0
  32. package/dist/compat/index.d.mts +19 -54
  33. package/dist/compat/index.d.ts +19 -54
  34. package/dist/compat/index.js +172 -180
  35. package/dist/compat/index.mjs +22 -59
  36. package/dist/function/index.js +39 -3
  37. package/dist/index.js +56 -57
  38. package/dist/math/index.js +22 -3
  39. package/dist/object/index.js +108 -14
  40. package/dist/predicate/index.js +93 -11
  41. package/dist/string/index.js +18 -4
  42. package/dist/util/index.js +19 -4
  43. package/package.json +1 -1
  44. package/dist/_chunk/invariant-BfGFfr.js +0 -21
@@ -0,0 +1,11 @@
1
+ import { identity } from '../../function/identity.mjs';
2
+ import { isFunction } from '../../predicate/isFunction.mjs';
3
+
4
+ function wrap(value, wrapper) {
5
+ return function (...args) {
6
+ const wrapFn = isFunction(wrapper) ? wrapper : identity;
7
+ return wrapFn.apply(this, [value, ...args]);
8
+ };
9
+ }
10
+
11
+ export { wrap };
@@ -1,57 +1,3 @@
1
- export { countBy } from '../array/countBy.mjs';
2
- export { flatMapDeep } from '../array/flatMapDeep.mjs';
3
- export { initial } from '../array/initial.mjs';
4
- export { isSubset } from '../array/isSubset.mjs';
5
- export { isSubsetWith } from '../array/isSubsetWith.mjs';
6
- export { keyBy } from '../array/keyBy.mjs';
7
- export { shuffle } from '../array/shuffle.mjs';
8
- export { toFilled } from '../array/toFilled.mjs';
9
- export { windowed } from '../array/windowed.mjs';
10
- export { xorBy } from '../array/xorBy.mjs';
11
- export { xorWith } from '../array/xorWith.mjs';
12
- export { AbortError } from '../error/AbortError.mjs';
13
- export { TimeoutError } from '../error/TimeoutError.mjs';
14
- export { asyncNoop } from '../function/asyncNoop.mjs';
15
- export { identity } from '../function/identity.mjs';
16
- export { MemoizeCache, memoize } from '../function/memoize.mjs';
17
- export { noop } from '../function/noop.mjs';
18
- export { once } from '../function/once.mjs';
19
- export { retry } from '../function/retry.mjs';
20
- export { ThrottledFunction } from '../function/throttle.mjs';
21
- export { unary } from '../function/unary.mjs';
22
- export { median } from '../math/median.mjs';
23
- export { medianBy } from '../math/medianBy.mjs';
24
- export { randomInt } from '../math/randomInt.mjs';
25
- export { clone } from '../object/clone.mjs';
26
- export { flattenObject } from '../object/flattenObject.mjs';
27
- export { invert } from '../object/invert.mjs';
28
- export { toCamelCaseKeys } from '../object/toCamelCaseKeys.mjs';
29
- export { toMerged } from '../object/toMerged.mjs';
30
- export { toSnakeCaseKeys } from '../object/toSnakeCaseKeys.mjs';
31
- export { isBlob } from '../predicate/isBlob.mjs';
32
- export { isBrowser } from '../predicate/isBrowser.mjs';
33
- export { isEqual } from '../predicate/isEqual.mjs';
34
- export { isFile } from '../predicate/isFile.mjs';
35
- export { isFunction } from '../predicate/isFunction.mjs';
36
- export { isJSON } from '../predicate/isJSON.mjs';
37
- export { isJSONArray, isJSONObject, isJSONValue } from '../predicate/isJSONValue.mjs';
38
- export { isLength } from '../predicate/isLength.mjs';
39
- export { isNode } from '../predicate/isNode.mjs';
40
- export { isNotNil } from '../predicate/isNotNil.mjs';
41
- export { isNull } from '../predicate/isNull.mjs';
42
- export { isPrimitive } from '../predicate/isPrimitive.mjs';
43
- export { isPromise } from '../predicate/isPromise.mjs';
44
- export { isUndefined } from '../predicate/isUndefined.mjs';
45
- export { Mutex } from '../promise/mutex.mjs';
46
- export { Semaphore } from '../promise/semaphore.mjs';
47
- export { timeout } from '../promise/timeout.mjs';
48
- export { withTimeout } from '../promise/withTimeout.mjs';
49
- export { capitalize } from '../string/capitalize.mjs';
50
- export { constantCase } from '../string/constantCase.mjs';
51
- export { pascalCase } from '../string/pascalCase.mjs';
52
- export { reverseString } from '../string/reverseString.mjs';
53
- export { attemptAsync } from '../util/attemptAsync.mjs';
54
- export { invariant } from '../util/invariant.mjs';
55
1
  export { castArray } from './array/castArray.mjs';
56
2
  export { chunk } from './array/chunk.mjs';
57
3
  export { compact } from './array/compact.mjs';
@@ -80,10 +26,12 @@ export { groupBy } from './array/groupBy.mjs';
80
26
  export { head as first, head } from './array/head.mjs';
81
27
  export { includes } from './array/includes.mjs';
82
28
  export { indexOf } from './array/indexOf.mjs';
29
+ export { initial } from './array/initial.mjs';
83
30
  export { intersection } from './array/intersection.mjs';
84
31
  export { intersectionBy } from './array/intersectionBy.mjs';
85
32
  export { intersectionWith } from './array/intersectionWith.mjs';
86
33
  export { join } from './array/join.mjs';
34
+ export { keyBy } from './array/keyBy.mjs';
87
35
  export { last } from './array/last.mjs';
88
36
  export { lastIndexOf } from './array/lastIndexOf.mjs';
89
37
  export { map } from './array/map.mjs';
@@ -102,6 +50,7 @@ export { remove } from './array/remove.mjs';
102
50
  export { reverse } from './array/reverse.mjs';
103
51
  export { sample } from './array/sample.mjs';
104
52
  export { sampleSize } from './array/sampleSize.mjs';
53
+ export { shuffle } from './array/shuffle.mjs';
105
54
  export { size } from './array/size.mjs';
106
55
  export { slice } from './array/slice.mjs';
107
56
  export { some } from './array/some.mjs';
@@ -126,6 +75,8 @@ export { unzip } from './array/unzip.mjs';
126
75
  export { unzipWith } from './array/unzipWith.mjs';
127
76
  export { without } from './array/without.mjs';
128
77
  export { xor } from './array/xor.mjs';
78
+ export { xorBy } from './array/xorBy.mjs';
79
+ export { xorWith } from './array/xorWith.mjs';
129
80
  export { zip } from './array/zip.mjs';
130
81
  export { zipObject } from './array/zipObject.mjs';
131
82
  export { zipObjectDeep } from './array/zipObjectDeep.mjs';
@@ -144,14 +95,18 @@ export { delay } from './function/delay.mjs';
144
95
  export { flip } from './function/flip.mjs';
145
96
  export { flow } from './function/flow.mjs';
146
97
  export { flowRight } from './function/flowRight.mjs';
98
+ export { memoize } from '../function/memoize.mjs';
147
99
  export { negate } from './function/negate.mjs';
148
100
  export { nthArg } from './function/nthArg.mjs';
101
+ export { once } from '../function/once.mjs';
149
102
  export { partial } from './function/partial.mjs';
150
103
  export { partialRight } from './function/partialRight.mjs';
151
104
  export { rearg } from './function/rearg.mjs';
152
105
  export { rest } from './function/rest.mjs';
153
106
  export { spread } from './function/spread.mjs';
154
107
  export { throttle } from './function/throttle.mjs';
108
+ export { unary } from '../function/unary.mjs';
109
+ export { wrap } from './function/wrap.mjs';
155
110
  export { add } from './math/add.mjs';
156
111
  export { ceil } from './math/ceil.mjs';
157
112
  export { clamp } from './math/clamp.mjs';
@@ -178,11 +133,13 @@ export { assignIn, assignIn as extend } from './object/assignIn.mjs';
178
133
  export { assignInWith, assignInWith as extendWith } from './object/assignInWith.mjs';
179
134
  export { assignWith } from './object/assignWith.mjs';
180
135
  export { at } from './object/at.mjs';
136
+ export { clone } from '../object/clone.mjs';
181
137
  export { cloneDeep } from './object/cloneDeep.mjs';
182
138
  export { cloneDeepWith } from './object/cloneDeepWith.mjs';
183
139
  export { create } from './object/create.mjs';
184
140
  export { defaults } from './object/defaults.mjs';
185
141
  export { findKey } from './object/findKey.mjs';
142
+ export { identity } from '../function/identity.mjs';
186
143
  export { forIn } from './object/forIn.mjs';
187
144
  export { forInRight } from './object/forInRight.mjs';
188
145
  export { forOwn } from './object/forOwn.mjs';
@@ -193,13 +150,20 @@ export { functionsIn } from './object/functionsIn.mjs';
193
150
  export { get } from './object/get.mjs';
194
151
  export { has } from './object/has.mjs';
195
152
  export { hasIn } from './object/hasIn.mjs';
153
+ export { invert } from '../object/invert.mjs';
196
154
  export { invertBy } from './object/invertBy.mjs';
155
+ export { isEqual } from '../predicate/isEqual.mjs';
156
+ export { isFunction } from '../predicate/isFunction.mjs';
157
+ export { isLength } from '../predicate/isLength.mjs';
158
+ export { isNull } from '../predicate/isNull.mjs';
159
+ export { isUndefined } from '../predicate/isUndefined.mjs';
197
160
  export { keys } from './object/keys.mjs';
198
161
  export { keysIn } from './object/keysIn.mjs';
199
162
  export { mapKeys } from './object/mapKeys.mjs';
200
163
  export { mapValues } from './object/mapValues.mjs';
201
164
  export { merge } from './object/merge.mjs';
202
165
  export { mergeWith } from './object/mergeWith.mjs';
166
+ export { noop } from '../function/noop.mjs';
203
167
  export { omit } from './object/omit.mjs';
204
168
  export { omitBy } from './object/omitBy.mjs';
205
169
  export { pick } from './object/pick.mjs';
@@ -217,6 +181,7 @@ export { update } from './object/update.mjs';
217
181
  export { updateWith } from './object/updateWith.mjs';
218
182
  export { values } from './object/values.mjs';
219
183
  export { valuesIn } from './object/valuesIn.mjs';
184
+ export { capitalize } from '../string/capitalize.mjs';
220
185
  export { conforms } from './predicate/conforms.mjs';
221
186
  export { conformsTo } from './predicate/conformsTo.mjs';
222
187
  export { isArguments } from './predicate/isArguments.mjs';
@@ -1,57 +1,3 @@
1
- export { countBy } from '../array/countBy.js';
2
- export { flatMapDeep } from '../array/flatMapDeep.js';
3
- export { initial } from '../array/initial.js';
4
- export { isSubset } from '../array/isSubset.js';
5
- export { isSubsetWith } from '../array/isSubsetWith.js';
6
- export { keyBy } from '../array/keyBy.js';
7
- export { shuffle } from '../array/shuffle.js';
8
- export { toFilled } from '../array/toFilled.js';
9
- export { windowed } from '../array/windowed.js';
10
- export { xorBy } from '../array/xorBy.js';
11
- export { xorWith } from '../array/xorWith.js';
12
- export { AbortError } from '../error/AbortError.js';
13
- export { TimeoutError } from '../error/TimeoutError.js';
14
- export { asyncNoop } from '../function/asyncNoop.js';
15
- export { identity } from '../function/identity.js';
16
- export { MemoizeCache, memoize } from '../function/memoize.js';
17
- export { noop } from '../function/noop.js';
18
- export { once } from '../function/once.js';
19
- export { retry } from '../function/retry.js';
20
- export { ThrottledFunction } from '../function/throttle.js';
21
- export { unary } from '../function/unary.js';
22
- export { median } from '../math/median.js';
23
- export { medianBy } from '../math/medianBy.js';
24
- export { randomInt } from '../math/randomInt.js';
25
- export { clone } from '../object/clone.js';
26
- export { flattenObject } from '../object/flattenObject.js';
27
- export { invert } from '../object/invert.js';
28
- export { toCamelCaseKeys } from '../object/toCamelCaseKeys.js';
29
- export { toMerged } from '../object/toMerged.js';
30
- export { toSnakeCaseKeys } from '../object/toSnakeCaseKeys.js';
31
- export { isBlob } from '../predicate/isBlob.js';
32
- export { isBrowser } from '../predicate/isBrowser.js';
33
- export { isEqual } from '../predicate/isEqual.js';
34
- export { isFile } from '../predicate/isFile.js';
35
- export { isFunction } from '../predicate/isFunction.js';
36
- export { isJSON } from '../predicate/isJSON.js';
37
- export { isJSONArray, isJSONObject, isJSONValue } from '../predicate/isJSONValue.js';
38
- export { isLength } from '../predicate/isLength.js';
39
- export { isNode } from '../predicate/isNode.js';
40
- export { isNotNil } from '../predicate/isNotNil.js';
41
- export { isNull } from '../predicate/isNull.js';
42
- export { isPrimitive } from '../predicate/isPrimitive.js';
43
- export { isPromise } from '../predicate/isPromise.js';
44
- export { isUndefined } from '../predicate/isUndefined.js';
45
- export { Mutex } from '../promise/mutex.js';
46
- export { Semaphore } from '../promise/semaphore.js';
47
- export { timeout } from '../promise/timeout.js';
48
- export { withTimeout } from '../promise/withTimeout.js';
49
- export { capitalize } from '../string/capitalize.js';
50
- export { constantCase } from '../string/constantCase.js';
51
- export { pascalCase } from '../string/pascalCase.js';
52
- export { reverseString } from '../string/reverseString.js';
53
- export { attemptAsync } from '../util/attemptAsync.js';
54
- export { invariant } from '../util/invariant.js';
55
1
  export { castArray } from './array/castArray.js';
56
2
  export { chunk } from './array/chunk.js';
57
3
  export { compact } from './array/compact.js';
@@ -80,10 +26,12 @@ export { groupBy } from './array/groupBy.js';
80
26
  export { head as first, head } from './array/head.js';
81
27
  export { includes } from './array/includes.js';
82
28
  export { indexOf } from './array/indexOf.js';
29
+ export { initial } from './array/initial.js';
83
30
  export { intersection } from './array/intersection.js';
84
31
  export { intersectionBy } from './array/intersectionBy.js';
85
32
  export { intersectionWith } from './array/intersectionWith.js';
86
33
  export { join } from './array/join.js';
34
+ export { keyBy } from './array/keyBy.js';
87
35
  export { last } from './array/last.js';
88
36
  export { lastIndexOf } from './array/lastIndexOf.js';
89
37
  export { map } from './array/map.js';
@@ -102,6 +50,7 @@ export { remove } from './array/remove.js';
102
50
  export { reverse } from './array/reverse.js';
103
51
  export { sample } from './array/sample.js';
104
52
  export { sampleSize } from './array/sampleSize.js';
53
+ export { shuffle } from './array/shuffle.js';
105
54
  export { size } from './array/size.js';
106
55
  export { slice } from './array/slice.js';
107
56
  export { some } from './array/some.js';
@@ -126,6 +75,8 @@ export { unzip } from './array/unzip.js';
126
75
  export { unzipWith } from './array/unzipWith.js';
127
76
  export { without } from './array/without.js';
128
77
  export { xor } from './array/xor.js';
78
+ export { xorBy } from './array/xorBy.js';
79
+ export { xorWith } from './array/xorWith.js';
129
80
  export { zip } from './array/zip.js';
130
81
  export { zipObject } from './array/zipObject.js';
131
82
  export { zipObjectDeep } from './array/zipObjectDeep.js';
@@ -144,14 +95,18 @@ export { delay } from './function/delay.js';
144
95
  export { flip } from './function/flip.js';
145
96
  export { flow } from './function/flow.js';
146
97
  export { flowRight } from './function/flowRight.js';
98
+ export { memoize } from '../function/memoize.js';
147
99
  export { negate } from './function/negate.js';
148
100
  export { nthArg } from './function/nthArg.js';
101
+ export { once } from '../function/once.js';
149
102
  export { partial } from './function/partial.js';
150
103
  export { partialRight } from './function/partialRight.js';
151
104
  export { rearg } from './function/rearg.js';
152
105
  export { rest } from './function/rest.js';
153
106
  export { spread } from './function/spread.js';
154
107
  export { throttle } from './function/throttle.js';
108
+ export { unary } from '../function/unary.js';
109
+ export { wrap } from './function/wrap.js';
155
110
  export { add } from './math/add.js';
156
111
  export { ceil } from './math/ceil.js';
157
112
  export { clamp } from './math/clamp.js';
@@ -178,11 +133,13 @@ export { assignIn, assignIn as extend } from './object/assignIn.js';
178
133
  export { assignInWith, assignInWith as extendWith } from './object/assignInWith.js';
179
134
  export { assignWith } from './object/assignWith.js';
180
135
  export { at } from './object/at.js';
136
+ export { clone } from '../object/clone.js';
181
137
  export { cloneDeep } from './object/cloneDeep.js';
182
138
  export { cloneDeepWith } from './object/cloneDeepWith.js';
183
139
  export { create } from './object/create.js';
184
140
  export { defaults } from './object/defaults.js';
185
141
  export { findKey } from './object/findKey.js';
142
+ export { identity } from '../function/identity.js';
186
143
  export { forIn } from './object/forIn.js';
187
144
  export { forInRight } from './object/forInRight.js';
188
145
  export { forOwn } from './object/forOwn.js';
@@ -193,13 +150,20 @@ export { functionsIn } from './object/functionsIn.js';
193
150
  export { get } from './object/get.js';
194
151
  export { has } from './object/has.js';
195
152
  export { hasIn } from './object/hasIn.js';
153
+ export { invert } from '../object/invert.js';
196
154
  export { invertBy } from './object/invertBy.js';
155
+ export { isEqual } from '../predicate/isEqual.js';
156
+ export { isFunction } from '../predicate/isFunction.js';
157
+ export { isLength } from '../predicate/isLength.js';
158
+ export { isNull } from '../predicate/isNull.js';
159
+ export { isUndefined } from '../predicate/isUndefined.js';
197
160
  export { keys } from './object/keys.js';
198
161
  export { keysIn } from './object/keysIn.js';
199
162
  export { mapKeys } from './object/mapKeys.js';
200
163
  export { mapValues } from './object/mapValues.js';
201
164
  export { merge } from './object/merge.js';
202
165
  export { mergeWith } from './object/mergeWith.js';
166
+ export { noop } from '../function/noop.js';
203
167
  export { omit } from './object/omit.js';
204
168
  export { omitBy } from './object/omitBy.js';
205
169
  export { pick } from './object/pick.js';
@@ -217,6 +181,7 @@ export { update } from './object/update.js';
217
181
  export { updateWith } from './object/updateWith.js';
218
182
  export { values } from './object/values.js';
219
183
  export { valuesIn } from './object/valuesIn.js';
184
+ export { capitalize } from '../string/capitalize.js';
220
185
  export { conforms } from './predicate/conforms.js';
221
186
  export { conformsTo } from './predicate/conformsTo.js';
222
187
  export { isArguments } from './predicate/isArguments.js';