es-toolkit 1.12.0 → 1.13.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 +16 -5
- package/dist/array/chunk.mjs +1 -1
- package/dist/array/compact.mjs +1 -1
- package/dist/array/countBy.mjs +1 -1
- package/dist/array/difference.mjs +1 -1
- package/dist/array/differenceBy.mjs +1 -1
- package/dist/array/differenceWith.mjs +1 -1
- package/dist/array/drop.mjs +1 -1
- package/dist/array/dropRight.mjs +1 -1
- package/dist/array/dropRightWhile.mjs +1 -1
- package/dist/array/dropWhile.mjs +1 -1
- package/dist/array/fill.mjs +1 -1
- package/dist/array/flatMap.mjs +1 -1
- package/dist/array/flatten.mjs +1 -1
- package/dist/array/flattenDeep.mjs +1 -1
- package/dist/array/forEachRight.mjs +1 -1
- package/dist/array/groupBy.mjs +1 -1
- package/dist/array/head.mjs +1 -1
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +14 -14
- package/dist/array/initial.mjs +1 -1
- package/dist/array/intersection.mjs +1 -1
- package/dist/array/intersectionBy.mjs +1 -1
- package/dist/array/intersectionWith.mjs +1 -1
- package/dist/array/keyBy.mjs +1 -1
- package/dist/array/last.mjs +1 -1
- package/dist/array/maxBy.mjs +1 -1
- package/dist/array/minBy.mjs +1 -1
- package/dist/array/orderBy.mjs +1 -1
- package/dist/array/partition.mjs +1 -1
- package/dist/array/sample.mjs +1 -1
- package/dist/array/sampleSize.mjs +1 -1
- package/dist/array/shuffle.mjs +1 -1
- package/dist/array/tail.d.mts +24 -0
- package/dist/array/tail.d.ts +24 -0
- package/dist/array/tail.js.map +1 -1
- package/dist/array/tail.mjs +2 -2
- package/dist/array/take.mjs +1 -1
- package/dist/array/takeRight.mjs +1 -1
- package/dist/array/takeRightWhile.mjs +1 -1
- package/dist/array/takeWhile.mjs +1 -1
- package/dist/array/toFilled.mjs +1 -1
- package/dist/array/union.mjs +1 -1
- package/dist/array/unionBy.mjs +1 -1
- package/dist/array/unionWith.mjs +1 -1
- package/dist/array/uniq.mjs +1 -1
- package/dist/array/uniqBy.mjs +1 -1
- package/dist/array/uniqWith.mjs +1 -1
- package/dist/array/unzip.mjs +1 -1
- package/dist/array/unzipWith.mjs +1 -1
- package/dist/array/without.mjs +1 -1
- package/dist/array/xor.mjs +1 -1
- package/dist/array/xorBy.mjs +1 -1
- package/dist/array/xorWith.mjs +1 -1
- package/dist/array/zip.mjs +1 -1
- package/dist/array/zipObject.mjs +1 -1
- package/dist/array/zipWith.mjs +1 -1
- package/dist/browser.d.mts +2 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +1108 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.mjs +108 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/{chunk-424M7IR7.mjs → chunk-24FKGR6U.mjs} +6 -1
- package/dist/chunk-27QMXBLJ.mjs +9 -0
- package/dist/chunk-27QMXBLJ.mjs.map +1 -0
- package/dist/chunk-54TK5BIS.mjs +1 -0
- package/dist/chunk-B645AYL4.mjs +1 -0
- package/dist/{chunk-J3GE7DEU.mjs → chunk-CVVZHOJX.mjs} +2 -2
- package/dist/{chunk-XWPCDIFC.mjs → chunk-IIDZ3KAJ.mjs} +3 -3
- package/dist/chunk-MIGAC7F4.mjs +25 -0
- package/dist/chunk-MIGAC7F4.mjs.map +1 -0
- package/dist/chunk-SPKLWVNJ.mjs +373 -0
- package/dist/chunk-SPKLWVNJ.mjs.map +1 -0
- package/dist/{chunk-OF6NM4G7.mjs → chunk-TJ4Z5I7M.mjs} +1 -1
- package/dist/{chunk-OF6NM4G7.mjs.map → chunk-TJ4Z5I7M.mjs.map} +1 -1
- package/dist/{chunk-U7V3G7CR.mjs → chunk-WFZXCGEG.mjs} +2 -2
- package/dist/chunk-XGQWTHW6.mjs +34 -0
- package/dist/chunk-XGQWTHW6.mjs.map +1 -0
- package/dist/compat/index.d.mts +59 -3
- package/dist/compat/index.d.ts +59 -3
- package/dist/compat/index.js +105 -1
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +105 -51
- package/dist/compat/index.mjs.map +1 -1
- package/dist/error/AbortError.mjs +1 -1
- package/dist/error/TimeoutError.mjs +1 -1
- package/dist/error/index.mjs +1 -1
- package/dist/function/debounce.mjs +1 -1
- package/dist/function/index.mjs +4 -4
- package/dist/function/negate.mjs +1 -1
- package/dist/function/noop.mjs +1 -1
- package/dist/function/once.mjs +1 -1
- package/dist/function/throttle.mjs +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -50
- package/dist/math/clamp.mjs +1 -1
- package/dist/math/inRange.mjs +1 -1
- package/dist/math/index.mjs +7 -7
- package/dist/math/mean.mjs +1 -1
- package/dist/math/meanBy.mjs +1 -1
- package/dist/math/random.mjs +1 -1
- package/dist/math/randomInt.mjs +1 -1
- package/dist/math/range.mjs +1 -1
- package/dist/math/round.mjs +1 -1
- package/dist/math/sum.mjs +1 -1
- package/dist/math/sumBy.mjs +1 -1
- package/dist/object/clone.mjs +1 -1
- package/dist/object/flattenObject.d.mts +28 -0
- package/dist/object/flattenObject.d.ts +28 -0
- package/dist/object/flattenObject.js +77 -0
- package/dist/object/flattenObject.js.map +1 -0
- package/dist/object/flattenObject.mjs +9 -0
- package/dist/object/index.d.mts +1 -0
- package/dist/object/index.d.ts +1 -0
- package/dist/object/index.js +49 -0
- package/dist/object/index.js.map +1 -1
- package/dist/object/index.mjs +14 -9
- package/dist/object/invert.mjs +1 -1
- package/dist/object/omit.mjs +2 -2
- package/dist/object/omitBy.mjs +1 -1
- package/dist/object/pick.mjs +1 -1
- package/dist/object/pickBy.mjs +1 -1
- package/dist/predicate/index.d.mts +2 -0
- package/dist/predicate/index.d.ts +2 -0
- package/dist/predicate/index.js +30 -0
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +15 -7
- package/dist/predicate/isEqual.mjs +1 -1
- package/dist/predicate/isLength.d.mts +3 -0
- package/dist/predicate/isLength.d.ts +3 -0
- package/dist/predicate/isLength.js +33 -0
- package/dist/predicate/isLength.js.map +1 -0
- package/dist/predicate/isLength.mjs +8 -0
- package/dist/predicate/isLength.mjs.map +1 -0
- package/dist/predicate/isNil.mjs +1 -1
- package/dist/predicate/isNotNil.mjs +1 -1
- package/dist/predicate/isNull.mjs +1 -1
- package/dist/predicate/isPlainObject.d.mts +16 -0
- package/dist/predicate/isPlainObject.d.ts +16 -0
- package/dist/predicate/isPlainObject.js +49 -0
- package/dist/predicate/isPlainObject.js.map +1 -0
- package/dist/predicate/isPlainObject.mjs +8 -0
- package/dist/predicate/isPlainObject.mjs.map +1 -0
- package/dist/predicate/isUndefined.mjs +1 -1
- package/dist/promise/delay.mjs +1 -1
- package/dist/promise/index.mjs +3 -3
- package/dist/promise/timeout.mjs +2 -2
- package/dist/promise/withTimeout.mjs +3 -3
- package/dist/string/camelCase.mjs +1 -1
- package/dist/string/capitalize.mjs +1 -1
- package/dist/string/index.mjs +7 -7
- package/dist/string/kebabCase.mjs +1 -1
- package/dist/string/lowerCase.mjs +1 -1
- package/dist/string/snakeCase.mjs +1 -1
- package/dist/string/startCase.mjs +1 -1
- package/package.json +3 -1
- package/umd/browser.global.js +2 -0
- package/dist/chunk-ASJF5D6C.mjs +0 -1
- package/dist/chunk-NKLIE2OI.mjs +0 -1
- package/dist/chunk-OSOLEQLZ.mjs +0 -1
- /package/dist/{chunk-424M7IR7.mjs.map → chunk-24FKGR6U.mjs.map} +0 -0
- /package/dist/{chunk-ASJF5D6C.mjs.map → chunk-54TK5BIS.mjs.map} +0 -0
- /package/dist/{chunk-NKLIE2OI.mjs.map → chunk-B645AYL4.mjs.map} +0 -0
- /package/dist/{chunk-J3GE7DEU.mjs.map → chunk-CVVZHOJX.mjs.map} +0 -0
- /package/dist/{chunk-XWPCDIFC.mjs.map → chunk-IIDZ3KAJ.mjs.map} +0 -0
- /package/dist/{chunk-U7V3G7CR.mjs.map → chunk-WFZXCGEG.mjs.map} +0 -0
- /package/dist/{chunk-OSOLEQLZ.mjs.map → object/flattenObject.mjs.map} +0 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import {
|
|
2
|
+
kebabCase
|
|
3
|
+
} from "./chunk-EYYZQFOP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
lowerCase
|
|
6
|
+
} from "./chunk-5IKVJGHO.mjs";
|
|
7
|
+
import {
|
|
8
|
+
snakeCase
|
|
9
|
+
} from "./chunk-F3WCQQET.mjs";
|
|
10
|
+
import {
|
|
11
|
+
startCase
|
|
12
|
+
} from "./chunk-QXTNZR7B.mjs";
|
|
13
|
+
import {
|
|
14
|
+
withTimeout
|
|
15
|
+
} from "./chunk-IIDZ3KAJ.mjs";
|
|
16
|
+
import {
|
|
17
|
+
delay
|
|
18
|
+
} from "./chunk-O64NE2P4.mjs";
|
|
19
|
+
import {
|
|
20
|
+
camelCase
|
|
21
|
+
} from "./chunk-Y5V7UAZZ.mjs";
|
|
22
|
+
import {
|
|
23
|
+
capitalize
|
|
24
|
+
} from "./chunk-U56ZOM7L.mjs";
|
|
25
|
+
import {
|
|
26
|
+
isNull
|
|
27
|
+
} from "./chunk-AIRSKN47.mjs";
|
|
28
|
+
import {
|
|
29
|
+
isUndefined
|
|
30
|
+
} from "./chunk-VH2PV426.mjs";
|
|
31
|
+
import {
|
|
32
|
+
isEqual
|
|
33
|
+
} from "./chunk-JYSV56US.mjs";
|
|
34
|
+
import {
|
|
35
|
+
isLength
|
|
36
|
+
} from "./chunk-27QMXBLJ.mjs";
|
|
37
|
+
import {
|
|
38
|
+
isNil
|
|
39
|
+
} from "./chunk-WMM7TZLG.mjs";
|
|
40
|
+
import {
|
|
41
|
+
isNotNil
|
|
42
|
+
} from "./chunk-BMRTZMRE.mjs";
|
|
43
|
+
import {
|
|
44
|
+
omitBy
|
|
45
|
+
} from "./chunk-BCTYOXT7.mjs";
|
|
46
|
+
import {
|
|
47
|
+
pick
|
|
48
|
+
} from "./chunk-HPFDYUGP.mjs";
|
|
49
|
+
import {
|
|
50
|
+
pickBy
|
|
51
|
+
} from "./chunk-6CLH5YZ2.mjs";
|
|
52
|
+
import {
|
|
53
|
+
clone
|
|
54
|
+
} from "./chunk-U4JGKZ56.mjs";
|
|
55
|
+
import {
|
|
56
|
+
flattenObject
|
|
57
|
+
} from "./chunk-XGQWTHW6.mjs";
|
|
58
|
+
import {
|
|
59
|
+
isPlainObject
|
|
60
|
+
} from "./chunk-MIGAC7F4.mjs";
|
|
61
|
+
import {
|
|
62
|
+
invert
|
|
63
|
+
} from "./chunk-OLX53VEF.mjs";
|
|
64
|
+
import {
|
|
65
|
+
omit
|
|
66
|
+
} from "./chunk-WFZXCGEG.mjs";
|
|
67
|
+
import {
|
|
68
|
+
round
|
|
69
|
+
} from "./chunk-5PMKOZ2F.mjs";
|
|
70
|
+
import {
|
|
71
|
+
sumBy
|
|
72
|
+
} from "./chunk-5L4VWRFX.mjs";
|
|
73
|
+
import {
|
|
74
|
+
clamp
|
|
75
|
+
} from "./chunk-MLCL773E.mjs";
|
|
76
|
+
import {
|
|
77
|
+
inRange
|
|
78
|
+
} from "./chunk-BH6HLGBA.mjs";
|
|
79
|
+
import {
|
|
80
|
+
meanBy
|
|
81
|
+
} from "./chunk-MY4G7R3I.mjs";
|
|
82
|
+
import {
|
|
83
|
+
mean
|
|
84
|
+
} from "./chunk-5ASRKEB4.mjs";
|
|
85
|
+
import {
|
|
86
|
+
sum
|
|
87
|
+
} from "./chunk-2SLTL4KL.mjs";
|
|
88
|
+
import {
|
|
89
|
+
range
|
|
90
|
+
} from "./chunk-DPH2KE6O.mjs";
|
|
91
|
+
import {
|
|
92
|
+
unzipWith
|
|
93
|
+
} from "./chunk-IFNXROZR.mjs";
|
|
94
|
+
import {
|
|
95
|
+
without
|
|
96
|
+
} from "./chunk-PYEYV7BY.mjs";
|
|
97
|
+
import {
|
|
98
|
+
xor
|
|
99
|
+
} from "./chunk-L7FQX5MN.mjs";
|
|
100
|
+
import {
|
|
101
|
+
xorBy
|
|
102
|
+
} from "./chunk-Q47NGNXT.mjs";
|
|
103
|
+
import {
|
|
104
|
+
xorWith
|
|
105
|
+
} from "./chunk-QRSJBBFY.mjs";
|
|
106
|
+
import {
|
|
107
|
+
zip
|
|
108
|
+
} from "./chunk-IDCUZVJL.mjs";
|
|
109
|
+
import {
|
|
110
|
+
zipObject
|
|
111
|
+
} from "./chunk-6GWEY5EL.mjs";
|
|
112
|
+
import {
|
|
113
|
+
zipWith
|
|
114
|
+
} from "./chunk-4KYXHZ4R.mjs";
|
|
115
|
+
import {
|
|
116
|
+
toFilled
|
|
117
|
+
} from "./chunk-OP4OAKQJ.mjs";
|
|
118
|
+
import {
|
|
119
|
+
union
|
|
120
|
+
} from "./chunk-R6QA7PLZ.mjs";
|
|
121
|
+
import {
|
|
122
|
+
unionBy
|
|
123
|
+
} from "./chunk-NFS7RWWE.mjs";
|
|
124
|
+
import {
|
|
125
|
+
unionWith
|
|
126
|
+
} from "./chunk-2ZCITDMK.mjs";
|
|
127
|
+
import {
|
|
128
|
+
uniq
|
|
129
|
+
} from "./chunk-DVK2N4KC.mjs";
|
|
130
|
+
import {
|
|
131
|
+
uniqBy
|
|
132
|
+
} from "./chunk-B4COTK4K.mjs";
|
|
133
|
+
import {
|
|
134
|
+
uniqWith
|
|
135
|
+
} from "./chunk-237HGSZS.mjs";
|
|
136
|
+
import {
|
|
137
|
+
unzip
|
|
138
|
+
} from "./chunk-UYZKMBDO.mjs";
|
|
139
|
+
import {
|
|
140
|
+
sample
|
|
141
|
+
} from "./chunk-2KNLZB7V.mjs";
|
|
142
|
+
import {
|
|
143
|
+
sampleSize
|
|
144
|
+
} from "./chunk-EHSKB6DF.mjs";
|
|
145
|
+
import {
|
|
146
|
+
randomInt
|
|
147
|
+
} from "./chunk-GIWAOOFY.mjs";
|
|
148
|
+
import {
|
|
149
|
+
random
|
|
150
|
+
} from "./chunk-SYWMYQYJ.mjs";
|
|
151
|
+
import {
|
|
152
|
+
shuffle
|
|
153
|
+
} from "./chunk-G7UQ5PUR.mjs";
|
|
154
|
+
import {
|
|
155
|
+
tail
|
|
156
|
+
} from "./chunk-TJ4Z5I7M.mjs";
|
|
157
|
+
import {
|
|
158
|
+
take
|
|
159
|
+
} from "./chunk-ME352XO7.mjs";
|
|
160
|
+
import {
|
|
161
|
+
takeRight
|
|
162
|
+
} from "./chunk-IQLKIDXF.mjs";
|
|
163
|
+
import {
|
|
164
|
+
takeRightWhile
|
|
165
|
+
} from "./chunk-NTLX2MPV.mjs";
|
|
166
|
+
import {
|
|
167
|
+
takeWhile
|
|
168
|
+
} from "./chunk-2IXFGSUA.mjs";
|
|
169
|
+
import {
|
|
170
|
+
intersectionBy
|
|
171
|
+
} from "./chunk-O6UXZR3U.mjs";
|
|
172
|
+
import {
|
|
173
|
+
intersectionWith
|
|
174
|
+
} from "./chunk-XI7KRD2C.mjs";
|
|
175
|
+
import {
|
|
176
|
+
keyBy
|
|
177
|
+
} from "./chunk-AJKZMN2V.mjs";
|
|
178
|
+
import {
|
|
179
|
+
last
|
|
180
|
+
} from "./chunk-KPBQ7OUY.mjs";
|
|
181
|
+
import {
|
|
182
|
+
maxBy
|
|
183
|
+
} from "./chunk-OOKNBU4V.mjs";
|
|
184
|
+
import {
|
|
185
|
+
minBy
|
|
186
|
+
} from "./chunk-IJD7FE2Z.mjs";
|
|
187
|
+
import {
|
|
188
|
+
orderBy
|
|
189
|
+
} from "./chunk-7B7W36UP.mjs";
|
|
190
|
+
import {
|
|
191
|
+
partition
|
|
192
|
+
} from "./chunk-DN3NOZ3H.mjs";
|
|
193
|
+
import {
|
|
194
|
+
flattenDeep
|
|
195
|
+
} from "./chunk-ML727RRJ.mjs";
|
|
196
|
+
import {
|
|
197
|
+
forEachRight
|
|
198
|
+
} from "./chunk-IEA53J7P.mjs";
|
|
199
|
+
import {
|
|
200
|
+
groupBy
|
|
201
|
+
} from "./chunk-E6E4RZLN.mjs";
|
|
202
|
+
import {
|
|
203
|
+
head
|
|
204
|
+
} from "./chunk-HM2JT2RX.mjs";
|
|
205
|
+
import {
|
|
206
|
+
initial
|
|
207
|
+
} from "./chunk-XPSOKBRZ.mjs";
|
|
208
|
+
import {
|
|
209
|
+
intersection
|
|
210
|
+
} from "./chunk-FVVSE2F2.mjs";
|
|
211
|
+
import {
|
|
212
|
+
differenceBy
|
|
213
|
+
} from "./chunk-LVWX5B43.mjs";
|
|
214
|
+
import {
|
|
215
|
+
differenceWith
|
|
216
|
+
} from "./chunk-6NVQAHXP.mjs";
|
|
217
|
+
import {
|
|
218
|
+
drop
|
|
219
|
+
} from "./chunk-3EZAFZG3.mjs";
|
|
220
|
+
import {
|
|
221
|
+
dropRight
|
|
222
|
+
} from "./chunk-OXZCMC5I.mjs";
|
|
223
|
+
import {
|
|
224
|
+
dropRightWhile
|
|
225
|
+
} from "./chunk-M7SBBYV2.mjs";
|
|
226
|
+
import {
|
|
227
|
+
dropWhile
|
|
228
|
+
} from "./chunk-LJ2C6MVP.mjs";
|
|
229
|
+
import {
|
|
230
|
+
fill
|
|
231
|
+
} from "./chunk-YFN6KOC4.mjs";
|
|
232
|
+
import {
|
|
233
|
+
flatMap
|
|
234
|
+
} from "./chunk-UY76KTPE.mjs";
|
|
235
|
+
import {
|
|
236
|
+
flatten
|
|
237
|
+
} from "./chunk-33MSBDC6.mjs";
|
|
238
|
+
import {
|
|
239
|
+
chunk
|
|
240
|
+
} from "./chunk-E6C5EZQA.mjs";
|
|
241
|
+
import {
|
|
242
|
+
compact
|
|
243
|
+
} from "./chunk-DTJJIMKJ.mjs";
|
|
244
|
+
import {
|
|
245
|
+
countBy
|
|
246
|
+
} from "./chunk-CRSKT4WW.mjs";
|
|
247
|
+
import {
|
|
248
|
+
difference
|
|
249
|
+
} from "./chunk-JPUKH67K.mjs";
|
|
250
|
+
import {
|
|
251
|
+
AbortError
|
|
252
|
+
} from "./chunk-DXB7EZUQ.mjs";
|
|
253
|
+
import {
|
|
254
|
+
TimeoutError
|
|
255
|
+
} from "./chunk-KIOYQRMQ.mjs";
|
|
256
|
+
import {
|
|
257
|
+
negate
|
|
258
|
+
} from "./chunk-BOOQBJN2.mjs";
|
|
259
|
+
import {
|
|
260
|
+
noop
|
|
261
|
+
} from "./chunk-LKXCOLNY.mjs";
|
|
262
|
+
import {
|
|
263
|
+
once
|
|
264
|
+
} from "./chunk-CMBC4MXG.mjs";
|
|
265
|
+
import {
|
|
266
|
+
throttle
|
|
267
|
+
} from "./chunk-QOJGMVVR.mjs";
|
|
268
|
+
import {
|
|
269
|
+
debounce
|
|
270
|
+
} from "./chunk-3IP4JVLL.mjs";
|
|
271
|
+
import {
|
|
272
|
+
__export
|
|
273
|
+
} from "./chunk-24FKGR6U.mjs";
|
|
274
|
+
|
|
275
|
+
// src/index.ts
|
|
276
|
+
var src_exports = {};
|
|
277
|
+
__export(src_exports, {
|
|
278
|
+
AbortError: () => AbortError,
|
|
279
|
+
TimeoutError: () => TimeoutError,
|
|
280
|
+
camelCase: () => camelCase,
|
|
281
|
+
capitalize: () => capitalize,
|
|
282
|
+
chunk: () => chunk,
|
|
283
|
+
clamp: () => clamp,
|
|
284
|
+
clone: () => clone,
|
|
285
|
+
compact: () => compact,
|
|
286
|
+
countBy: () => countBy,
|
|
287
|
+
debounce: () => debounce,
|
|
288
|
+
delay: () => delay,
|
|
289
|
+
difference: () => difference,
|
|
290
|
+
differenceBy: () => differenceBy,
|
|
291
|
+
differenceWith: () => differenceWith,
|
|
292
|
+
drop: () => drop,
|
|
293
|
+
dropRight: () => dropRight,
|
|
294
|
+
dropRightWhile: () => dropRightWhile,
|
|
295
|
+
dropWhile: () => dropWhile,
|
|
296
|
+
fill: () => fill,
|
|
297
|
+
flatMap: () => flatMap,
|
|
298
|
+
flatten: () => flatten,
|
|
299
|
+
flattenDeep: () => flattenDeep,
|
|
300
|
+
flattenObject: () => flattenObject,
|
|
301
|
+
forEachRight: () => forEachRight,
|
|
302
|
+
groupBy: () => groupBy,
|
|
303
|
+
head: () => head,
|
|
304
|
+
inRange: () => inRange,
|
|
305
|
+
initial: () => initial,
|
|
306
|
+
intersection: () => intersection,
|
|
307
|
+
intersectionBy: () => intersectionBy,
|
|
308
|
+
intersectionWith: () => intersectionWith,
|
|
309
|
+
invert: () => invert,
|
|
310
|
+
isEqual: () => isEqual,
|
|
311
|
+
isLength: () => isLength,
|
|
312
|
+
isNil: () => isNil,
|
|
313
|
+
isNotNil: () => isNotNil,
|
|
314
|
+
isNull: () => isNull,
|
|
315
|
+
isPlainObject: () => isPlainObject,
|
|
316
|
+
isUndefined: () => isUndefined,
|
|
317
|
+
kebabCase: () => kebabCase,
|
|
318
|
+
keyBy: () => keyBy,
|
|
319
|
+
last: () => last,
|
|
320
|
+
lowerCase: () => lowerCase,
|
|
321
|
+
maxBy: () => maxBy,
|
|
322
|
+
mean: () => mean,
|
|
323
|
+
meanBy: () => meanBy,
|
|
324
|
+
minBy: () => minBy,
|
|
325
|
+
negate: () => negate,
|
|
326
|
+
noop: () => noop,
|
|
327
|
+
omit: () => omit,
|
|
328
|
+
omitBy: () => omitBy,
|
|
329
|
+
once: () => once,
|
|
330
|
+
orderBy: () => orderBy,
|
|
331
|
+
partition: () => partition,
|
|
332
|
+
pick: () => pick,
|
|
333
|
+
pickBy: () => pickBy,
|
|
334
|
+
random: () => random,
|
|
335
|
+
randomInt: () => randomInt,
|
|
336
|
+
range: () => range,
|
|
337
|
+
round: () => round,
|
|
338
|
+
sample: () => sample,
|
|
339
|
+
sampleSize: () => sampleSize,
|
|
340
|
+
shuffle: () => shuffle,
|
|
341
|
+
snakeCase: () => snakeCase,
|
|
342
|
+
startCase: () => startCase,
|
|
343
|
+
sum: () => sum,
|
|
344
|
+
sumBy: () => sumBy,
|
|
345
|
+
tail: () => tail,
|
|
346
|
+
take: () => take,
|
|
347
|
+
takeRight: () => takeRight,
|
|
348
|
+
takeRightWhile: () => takeRightWhile,
|
|
349
|
+
takeWhile: () => takeWhile,
|
|
350
|
+
throttle: () => throttle,
|
|
351
|
+
toFilled: () => toFilled,
|
|
352
|
+
union: () => union,
|
|
353
|
+
unionBy: () => unionBy,
|
|
354
|
+
unionWith: () => unionWith,
|
|
355
|
+
uniq: () => uniq,
|
|
356
|
+
uniqBy: () => uniqBy,
|
|
357
|
+
uniqWith: () => uniqWith,
|
|
358
|
+
unzip: () => unzip,
|
|
359
|
+
unzipWith: () => unzipWith,
|
|
360
|
+
withTimeout: () => withTimeout,
|
|
361
|
+
without: () => without,
|
|
362
|
+
xor: () => xor,
|
|
363
|
+
xorBy: () => xorBy,
|
|
364
|
+
xorWith: () => xorWith,
|
|
365
|
+
zip: () => zip,
|
|
366
|
+
zipObject: () => zipObject,
|
|
367
|
+
zipWith: () => zipWith
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
export {
|
|
371
|
+
src_exports
|
|
372
|
+
};
|
|
373
|
+
//# sourceMappingURL=chunk-SPKLWVNJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * es-toolkit\n * ====================================\n * A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.\n *\n * es-toolkit is a state-of-the-art, high-performance JavaScript utility library\n * with a small bundle size and strong type annotations.\n *\n * - es-toolkit offers a variety of everyday utility functions with modern implementations, such as [debounce](https://es-toolkit.slash.page/reference/function/debounce.html), [delay](https://es-toolkit.slash.page/reference/promise/delay.html), [chunk](https://es-toolkit.slash.page/reference/array/chunk.html), [sum](https://es-toolkit.slash.page/reference/math/sum.html), and [pick](https://es-toolkit.slash.page/reference/object/pick.html).\n * - Designed with performance in mind, es-toolkit achieves [2-3× better performance](https://es-toolkit.slash.page/performance.html) in modern JavaScript environments.\n * - es-toolkit supports tree shaking out of the box, and [reduces JavaScript code by up to 97%](https://es-toolkit.slash.page/bundle-size.html) compared to other libraries.\n * - es-toolkit includes built-in TypeScript support, with straightforward yet robust types. It also provides useful type guards such as [isNotNil](https://es-toolkit.slash.page/reference/predicate/isNotNil.html).\n * - es-toolkit is battle-tested with 100% test coverage, ensuring reliability and robustness.\n *\n * ## Features\n *\n * Here are some of the features es-toolkit offers:\n *\n * - **Array**: Utilities for array manipulation, such as [uniq](https://es-toolkit.slash.page/reference/array/uniq.html) and [difference](https://es-toolkit.slash.page/reference/array/difference.html).\n * - **Function**: Tools for controlling function execution, including [debounce](https://es-toolkit.slash.page/reference/function/debounce.html) and [throttle](https://es-toolkit.slash.page/reference/function/throttle.html).\n * - **Math**: Numerical utilities like [sum](https://es-toolkit.slash.page/reference/math/sum.html) and [round](https://es-toolkit.slash.page/reference/math/round.html).\n * - **Object**: Tools for manipulating JavaScript objects, such as [pick](https://es-toolkit.slash.page/reference/object/pick.html) and [omit](https://es-toolkit.slash.page/reference/object/omit.html).\n * - **Predicate**: Type guard functions like [isNotNil](https://es-toolkit.slash.page/reference/predicate/isNotNil.html).\n * - **Promise**: Asynchronous utilities like [delay](https://es-toolkit.slash.page/reference/promise/delay.html).\n * - **String**: Utilities for string manipulation, such as [snakeCase](https://es-toolkit.slash.page/reference/string/snakeCase.html)\n *\n * ## Examples\n *\n * ```typescript\n * // import from '@es-toolkit/es-toolkit' in jsr.\n * import { debounce, chunk } from 'es-toolkit';\n *\n * const debouncedLog = debounce(message => {\n * console.log(message);\n * }, 300);\n *\n * // This call will be debounced\n * debouncedLog('Hello, world!');\n *\n * const array = [1, 2, 3, 4, 5, 6];\n * const chunkedArray = chunk(array, 2);\n *\n * console.log(chunkedArray);\n * // Output: [[1, 2], [3, 4], [5, 6]]\n * ```\n *\n * ## Resources\n *\n * If you want to know more about the project, please take a look at the\n * following resources:\n *\n * - [GitHub](https://github.com/toss/es-toolkit)\n * - [Documentation](https://es-toolkit.slash.page)\n *\n * @module\n */\nexport * from './array/index.ts';\nexport * from './error/index.ts';\nexport * from './function/index.ts';\nexport * from './math/index.ts';\nexport * from './object/index.ts';\nexport * from './predicate/index.ts';\nexport * from './promise/index.ts';\nexport * from './string/index.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/array/tail.ts"],"sourcesContent":["/**\n * Returns an empty array when the input is a single-element array.\n *\n * @param {readonly [T]} arr - The single-element array to process.\n * @returns {[]} An empty array.\n *\n * @example\n * const arr = [1];\n * const result = tail(arr);\n * // result will be []\n */\nexport function tail<T>(arr: readonly [T]): [];\n\n/**\n * Returns an empty array when the input is an empty array.\n *\n * @param {readonly []} arr - The empty array to process.\n * @returns {[]} An empty array.\n *\n * @example\n * const arr = [];\n * const result = tail(arr);\n * // result will be []\n */\nexport function tail(arr: readonly []): [];\n\n/**\n * Returns a new array with all elements except for the first when the input is a tuple array.\n *\n * @param {readonly [T, ...U[]]} arr - The tuple array to process.\n * @returns {U[]} A new array containing all elements of the input array except for the first one.\n *\n * @example\n * const arr = [1, 2, 3];\n * const result = tail(arr);\n * // result will be [2, 3]\n */\nexport function tail<T, U>(arr: readonly [T, ...U[]]): U[];\n\n/**\n * Returns a new array with all elements except for the first.\n *\n * This function takes an array and returns a new array containing all the elements\n * except for the first one. If the input array is empty or has only one element,\n * an empty array is returned.\n *\n * @param {readonly T[]} arr - The array to get the tail of.\n * @returns {T[]} A new array containing all elements of the input array except for the first one.\n *\n * @example\n * const arr1 = [1, 2, 3];\n * const result = tail(arr1);\n * // result will be [2, 3]\n *\n * const arr2 = [1];\n * const result2 = tail(arr2);\n * // result2 will be []\n *\n * const arr3 = [];\n * const result3 = tail(arr3);\n * // result3 will be []\n */\nexport function tail<T>(arr: readonly T[]): T[] {\n const len = arr.length;\n if (len <= 1) {\n return [];\n }\n const result = new Array(len - 1);\n for (let i = 1; i < len; i++) {\n result[i - 1] = arr[i];\n }\n return result;\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/array/tail.ts"],"sourcesContent":["/**\n * Returns an empty array when the input is a single-element array.\n *\n * @param {readonly [T]} arr - The single-element array to process.\n * @returns {[]} An empty array.\n *\n * @example\n * const arr = [1];\n * const result = tail(arr);\n * // result will be []\n */\nexport function tail<T>(arr: readonly [T]): [];\n\n/**\n * Returns an empty array when the input is an empty array.\n *\n * @param {readonly []} arr - The empty array to process.\n * @returns {[]} An empty array.\n *\n * @example\n * const arr = [];\n * const result = tail(arr);\n * // result will be []\n */\nexport function tail(arr: readonly []): [];\n\n/**\n * Returns a new array with all elements except for the first when the input is a tuple array.\n *\n * @param {readonly [T, ...U[]]} arr - The tuple array to process.\n * @returns {U[]} A new array containing all elements of the input array except for the first one.\n *\n * @example\n * const arr = [1, 2, 3];\n * const result = tail(arr);\n * // result will be [2, 3]\n */\nexport function tail<T, U>(arr: readonly [T, ...U[]]): U[];\n\n/**\n * Returns a new array with all elements except for the first.\n *\n * This function takes an array and returns a new array containing all the elements\n * except for the first one. If the input array is empty or has only one element,\n * an empty array is returned.\n *\n * @param {readonly T[]} arr - The array to get the tail of.\n * @returns {T[]} A new array containing all elements of the input array except for the first one.\n *\n * @example\n * const arr1 = [1, 2, 3];\n * const result = tail(arr1);\n * // result will be [2, 3]\n *\n * const arr2 = [1];\n * const result2 = tail(arr2);\n * // result2 will be []\n *\n * const arr3 = [];\n * const result3 = tail(arr3);\n * // result3 will be []\n */\nexport function tail<T>(arr: readonly T[]): T[];\n\nexport function tail<T>(arr: readonly T[]): T[] {\n const len = arr.length;\n if (len <= 1) {\n return [];\n }\n const result = new Array(len - 1);\n for (let i = 1; i < len; i++) {\n result[i - 1] = arr[i];\n }\n return result;\n}\n"],"mappings":";AAgEO,SAAS,KAAQ,KAAwB;AAC9C,QAAM,MAAM,IAAI;AAChB,MAAI,OAAO,GAAG;AACZ,WAAO,CAAC;AAAA,EACV;AACA,QAAM,SAAS,IAAI,MAAM,MAAM,CAAC;AAChC,WAAS,IAAI,GAAG,IAAI,KAAK,KAAK;AAC5B,WAAO,IAAI,CAAC,IAAI,IAAI,CAAC;AAAA,EACvB;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__spreadValues
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-24FKGR6U.mjs";
|
|
4
4
|
|
|
5
5
|
// src/object/omit.ts
|
|
6
6
|
function omit(obj, keys) {
|
|
@@ -14,4 +14,4 @@ function omit(obj, keys) {
|
|
|
14
14
|
export {
|
|
15
15
|
omit
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-WFZXCGEG.mjs.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPlainObject
|
|
3
|
+
} from "./chunk-MIGAC7F4.mjs";
|
|
4
|
+
|
|
5
|
+
// src/object/flattenObject.ts
|
|
6
|
+
function flattenObject(object) {
|
|
7
|
+
return flattenObjectImpl(object);
|
|
8
|
+
}
|
|
9
|
+
function flattenObjectImpl(object, prefix = "") {
|
|
10
|
+
const result = {};
|
|
11
|
+
const keys = Object.keys(object);
|
|
12
|
+
for (let i = 0; i < keys.length; i++) {
|
|
13
|
+
const key = keys[i];
|
|
14
|
+
const value = object[key];
|
|
15
|
+
const prefixedKey = prefix ? `${prefix}.${key}` : key;
|
|
16
|
+
if (isPlainObject(value) && Object.keys(value).length > 0) {
|
|
17
|
+
Object.assign(result, flattenObjectImpl(value, prefixedKey));
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
for (let index = 0; index < value.length; index++) {
|
|
22
|
+
result[`${prefixedKey}.${index}`] = value[index];
|
|
23
|
+
}
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
result[prefixedKey] = value;
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
flattenObject
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-XGQWTHW6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/object/flattenObject.ts"],"sourcesContent":["import { isPlainObject } from \"../predicate/isPlainObject.ts\";\n\n/**\n * Flattens a nested object into a single level object with dot-separated keys.\n * \n * @param {object} object - The object to flatten.\n * @returns {Record<string, any>} - The flattened object.\n * \n * @example\n * const nestedObject = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: [2, 3]\n * };\n * \n * const flattened = flattenObject(nestedObject);\n * console.log(flattened); \n * // Output:\n * // {\n * // 'a.b.c': 1,\n * // 'd.0': 2,\n * // 'd.1': 3\n * // }\n */\nexport function flattenObject(object: object): Record<string, any> {\n return flattenObjectImpl(object);\n}\n\nfunction flattenObjectImpl(object: object, prefix = ''): Record<string, any> {\n const result: Record<string, any> = {};\n const keys = Object.keys(object);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = (object as any)[key];\n\n const prefixedKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(value) && Object.keys(value).length > 0) {\n Object.assign(result, flattenObjectImpl(value, prefixedKey));\n continue;\n }\n\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) {\n result[`${prefixedKey}.${index}`] = value[index];\n }\n continue;\n }\n\n result[prefixedKey] = value;\n }\n\n return result;\n}"],"mappings":";;;;;AA2BO,SAAS,cAAc,QAAqC;AACjE,SAAO,kBAAkB,MAAM;AACjC;AAEA,SAAS,kBAAkB,QAAgB,SAAS,IAAyB;AAC3E,QAAM,SAA8B,CAAC;AACrC,QAAM,OAAO,OAAO,KAAK,MAAM;AAE/B,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,MAAM,KAAK,CAAC;AAClB,UAAM,QAAS,OAAe,GAAG;AAEjC,UAAM,cAAc,SAAS,GAAG,MAAM,IAAI,GAAG,KAAK;AAElD,QAAI,cAAc,KAAK,KAAK,OAAO,KAAK,KAAK,EAAE,SAAS,GAAG;AACzD,aAAO,OAAO,QAAQ,kBAAkB,OAAO,WAAW,CAAC;AAC3D;AAAA,IACF;AAEA,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,eAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,eAAO,GAAG,WAAW,IAAI,KAAK,EAAE,IAAI,MAAM,KAAK;AAAA,MACjD;AACA;AAAA,IACF;AAEA,WAAO,WAAW,IAAI;AAAA,EACxB;AAEA,SAAO;AACT;","names":[]}
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { compact } from '../array/compact.mjs';
|
|
2
2
|
export { countBy } from '../array/countBy.mjs';
|
|
3
|
-
export { difference } from '../array/difference.mjs';
|
|
4
3
|
export { differenceBy } from '../array/differenceBy.mjs';
|
|
5
4
|
export { differenceWith } from '../array/differenceWith.mjs';
|
|
6
5
|
export { drop } from '../array/drop.mjs';
|
|
@@ -43,7 +42,7 @@ export { zip } from '../array/zip.mjs';
|
|
|
43
42
|
export { zipObject } from '../array/zipObject.mjs';
|
|
44
43
|
export { zipWith } from '../array/zipWith.mjs';
|
|
45
44
|
export { without } from '../array/without.mjs';
|
|
46
|
-
export { head } from '../array/head.mjs';
|
|
45
|
+
export { head as first, head } from '../array/head.mjs';
|
|
47
46
|
export { tail } from '../array/tail.mjs';
|
|
48
47
|
export { toFilled } from '../array/toFilled.mjs';
|
|
49
48
|
export { last } from '../array/last.mjs';
|
|
@@ -71,11 +70,13 @@ export { pick } from '../object/pick.mjs';
|
|
|
71
70
|
export { pickBy } from '../object/pickBy.mjs';
|
|
72
71
|
export { invert } from '../object/invert.mjs';
|
|
73
72
|
export { clone } from '../object/clone.mjs';
|
|
73
|
+
export { flattenObject } from '../object/flattenObject.mjs';
|
|
74
74
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
75
75
|
export { isNil } from '../predicate/isNil.mjs';
|
|
76
76
|
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
77
77
|
export { isNull } from '../predicate/isNull.mjs';
|
|
78
78
|
export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
79
|
+
export { isLength } from '../predicate/isLength.mjs';
|
|
79
80
|
export { delay } from '../promise/delay.mjs';
|
|
80
81
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
81
82
|
export { camelCase } from '../string/camelCase.mjs';
|
|
@@ -110,6 +111,37 @@ export { capitalize } from '../string/capitalize.mjs';
|
|
|
110
111
|
*/
|
|
111
112
|
declare function chunk<T>(arr: readonly T[], size?: number): T[][];
|
|
112
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Concatenates multiple arrays and values into a single array.
|
|
116
|
+
*
|
|
117
|
+
* @template T The type of elements in the array.
|
|
118
|
+
* @param {...(T | readonly T[])} values - The values and/or arrays to concatenate.
|
|
119
|
+
* @returns {T[]} A new array containing all the input values.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* // Concatenate individual values
|
|
123
|
+
* concat(1, 2, 3);
|
|
124
|
+
* // returns [1, 2, 3]
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* // Concatenate arrays of values
|
|
128
|
+
* concat([1, 2], [3, 4]);
|
|
129
|
+
* // returns [1, 2, 3, 4]
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* // Concatenate a mix of individual values and arrays
|
|
133
|
+
* concat(1, [2, 3], 4);
|
|
134
|
+
* // returns [1, 2, 3, 4]
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* // Concatenate nested arrays
|
|
138
|
+
* concat([1, [2, 3]], 4);
|
|
139
|
+
* // returns [1, [2, 3], 4]
|
|
140
|
+
*/
|
|
141
|
+
declare function concat<T>(...values: Array<T | readonly T[]>): T[];
|
|
142
|
+
|
|
143
|
+
declare function difference<T>(arr: readonly T[], ...values: Array<readonly T[]>): T[];
|
|
144
|
+
|
|
113
145
|
/**
|
|
114
146
|
* Creates a deeply nested object given arrays of paths and values.
|
|
115
147
|
*
|
|
@@ -427,6 +459,30 @@ declare function get(object: unknown, path: PropertyKey | readonly PropertyKey[]
|
|
|
427
459
|
*/
|
|
428
460
|
declare function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;
|
|
429
461
|
|
|
462
|
+
/**
|
|
463
|
+
* Checks if a given value is a plain object.
|
|
464
|
+
*
|
|
465
|
+
* A plain object is an object created by the `{}` literal, `new Object()`, or
|
|
466
|
+
* `Object.create(null)`.
|
|
467
|
+
*
|
|
468
|
+
* This function also handles objects with custom
|
|
469
|
+
* `Symbol.toStringTag` properties.
|
|
470
|
+
*
|
|
471
|
+
* `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the
|
|
472
|
+
* default string description of objects.
|
|
473
|
+
*
|
|
474
|
+
* @param {unknown} [object] - The value to check.
|
|
475
|
+
* @returns {boolean} - True if the value is a plain object, otherwise false.
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* console.log(isPlainObject({})); // true
|
|
479
|
+
* console.log(isPlainObject([])); // false
|
|
480
|
+
* console.log(isPlainObject(null)); // false
|
|
481
|
+
* console.log(isPlainObject(Object.create(null))); // true
|
|
482
|
+
* console.log(isPlainObject(new Map())); // false
|
|
483
|
+
*/
|
|
484
|
+
declare function isPlainObject(object?: unknown): boolean;
|
|
485
|
+
|
|
430
486
|
/**
|
|
431
487
|
* Checks if a string contains another string at the beginning of the string.
|
|
432
488
|
*
|
|
@@ -497,4 +553,4 @@ declare function max<T>(items?: readonly T[]): T;
|
|
|
497
553
|
*/
|
|
498
554
|
declare function min<T>(items?: readonly T[]): T;
|
|
499
555
|
|
|
500
|
-
export { chunk, endsWith, get, max, min, set, startsWith, zipObjectDeep };
|
|
556
|
+
export { chunk, concat, difference, endsWith, get, isPlainObject, max, min, set, startsWith, zipObjectDeep };
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { compact } from '../array/compact.js';
|
|
2
2
|
export { countBy } from '../array/countBy.js';
|
|
3
|
-
export { difference } from '../array/difference.js';
|
|
4
3
|
export { differenceBy } from '../array/differenceBy.js';
|
|
5
4
|
export { differenceWith } from '../array/differenceWith.js';
|
|
6
5
|
export { drop } from '../array/drop.js';
|
|
@@ -43,7 +42,7 @@ export { zip } from '../array/zip.js';
|
|
|
43
42
|
export { zipObject } from '../array/zipObject.js';
|
|
44
43
|
export { zipWith } from '../array/zipWith.js';
|
|
45
44
|
export { without } from '../array/without.js';
|
|
46
|
-
export { head } from '../array/head.js';
|
|
45
|
+
export { head as first, head } from '../array/head.js';
|
|
47
46
|
export { tail } from '../array/tail.js';
|
|
48
47
|
export { toFilled } from '../array/toFilled.js';
|
|
49
48
|
export { last } from '../array/last.js';
|
|
@@ -71,11 +70,13 @@ export { pick } from '../object/pick.js';
|
|
|
71
70
|
export { pickBy } from '../object/pickBy.js';
|
|
72
71
|
export { invert } from '../object/invert.js';
|
|
73
72
|
export { clone } from '../object/clone.js';
|
|
73
|
+
export { flattenObject } from '../object/flattenObject.js';
|
|
74
74
|
export { isEqual } from '../predicate/isEqual.js';
|
|
75
75
|
export { isNil } from '../predicate/isNil.js';
|
|
76
76
|
export { isNotNil } from '../predicate/isNotNil.js';
|
|
77
77
|
export { isNull } from '../predicate/isNull.js';
|
|
78
78
|
export { isUndefined } from '../predicate/isUndefined.js';
|
|
79
|
+
export { isLength } from '../predicate/isLength.js';
|
|
79
80
|
export { delay } from '../promise/delay.js';
|
|
80
81
|
export { withTimeout } from '../promise/withTimeout.js';
|
|
81
82
|
export { camelCase } from '../string/camelCase.js';
|
|
@@ -110,6 +111,37 @@ export { capitalize } from '../string/capitalize.js';
|
|
|
110
111
|
*/
|
|
111
112
|
declare function chunk<T>(arr: readonly T[], size?: number): T[][];
|
|
112
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Concatenates multiple arrays and values into a single array.
|
|
116
|
+
*
|
|
117
|
+
* @template T The type of elements in the array.
|
|
118
|
+
* @param {...(T | readonly T[])} values - The values and/or arrays to concatenate.
|
|
119
|
+
* @returns {T[]} A new array containing all the input values.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* // Concatenate individual values
|
|
123
|
+
* concat(1, 2, 3);
|
|
124
|
+
* // returns [1, 2, 3]
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* // Concatenate arrays of values
|
|
128
|
+
* concat([1, 2], [3, 4]);
|
|
129
|
+
* // returns [1, 2, 3, 4]
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* // Concatenate a mix of individual values and arrays
|
|
133
|
+
* concat(1, [2, 3], 4);
|
|
134
|
+
* // returns [1, 2, 3, 4]
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* // Concatenate nested arrays
|
|
138
|
+
* concat([1, [2, 3]], 4);
|
|
139
|
+
* // returns [1, [2, 3], 4]
|
|
140
|
+
*/
|
|
141
|
+
declare function concat<T>(...values: Array<T | readonly T[]>): T[];
|
|
142
|
+
|
|
143
|
+
declare function difference<T>(arr: readonly T[], ...values: Array<readonly T[]>): T[];
|
|
144
|
+
|
|
113
145
|
/**
|
|
114
146
|
* Creates a deeply nested object given arrays of paths and values.
|
|
115
147
|
*
|
|
@@ -427,6 +459,30 @@ declare function get(object: unknown, path: PropertyKey | readonly PropertyKey[]
|
|
|
427
459
|
*/
|
|
428
460
|
declare function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;
|
|
429
461
|
|
|
462
|
+
/**
|
|
463
|
+
* Checks if a given value is a plain object.
|
|
464
|
+
*
|
|
465
|
+
* A plain object is an object created by the `{}` literal, `new Object()`, or
|
|
466
|
+
* `Object.create(null)`.
|
|
467
|
+
*
|
|
468
|
+
* This function also handles objects with custom
|
|
469
|
+
* `Symbol.toStringTag` properties.
|
|
470
|
+
*
|
|
471
|
+
* `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the
|
|
472
|
+
* default string description of objects.
|
|
473
|
+
*
|
|
474
|
+
* @param {unknown} [object] - The value to check.
|
|
475
|
+
* @returns {boolean} - True if the value is a plain object, otherwise false.
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* console.log(isPlainObject({})); // true
|
|
479
|
+
* console.log(isPlainObject([])); // false
|
|
480
|
+
* console.log(isPlainObject(null)); // false
|
|
481
|
+
* console.log(isPlainObject(Object.create(null))); // true
|
|
482
|
+
* console.log(isPlainObject(new Map())); // false
|
|
483
|
+
*/
|
|
484
|
+
declare function isPlainObject(object?: unknown): boolean;
|
|
485
|
+
|
|
430
486
|
/**
|
|
431
487
|
* Checks if a string contains another string at the beginning of the string.
|
|
432
488
|
*
|
|
@@ -497,4 +553,4 @@ declare function max<T>(items?: readonly T[]): T;
|
|
|
497
553
|
*/
|
|
498
554
|
declare function min<T>(items?: readonly T[]): T;
|
|
499
555
|
|
|
500
|
-
export { chunk, endsWith, get, max, min, set, startsWith, zipObjectDeep };
|
|
556
|
+
export { chunk, concat, difference, endsWith, get, isPlainObject, max, min, set, startsWith, zipObjectDeep };
|