es-toolkit 1.12.0-dev.286 → 1.12.0-dev.288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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.mjs +13 -13
- 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.mjs +1 -1
- 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-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-UTBNEZQX.mjs +373 -0
- package/dist/chunk-UTBNEZQX.mjs.map +1 -0
- package/dist/{chunk-U7V3G7CR.mjs → chunk-WFZXCGEG.mjs} +2 -2
- package/dist/{chunk-32AEPQYI.mjs → chunk-Y5V7UAZZ.mjs} +4 -4
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +7 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +45 -41
- 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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -41
- 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.mjs +1 -1
- package/dist/object/index.mjs +5 -5
- 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 +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +7 -0
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +9 -5
- 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/isNil.mjs +1 -1
- package/dist/predicate/isNotNil.mjs +1 -1
- package/dist/predicate/isNull.mjs +1 -1
- package/dist/predicate/isPlainObject.mjs +1 -1
- 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 +3 -3
- package/dist/string/capitalize.mjs +1 -1
- package/dist/string/index.mjs +3 -3
- 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-NKLIE2OI.mjs +0 -1
- package/dist/chunk-WGX4WINP.mjs +0 -1
- /package/dist/{chunk-424M7IR7.mjs.map → chunk-24FKGR6U.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-32AEPQYI.mjs.map → chunk-Y5V7UAZZ.mjs.map} +0 -0
- /package/dist/{chunk-WGX4WINP.mjs.map → predicate/isLength.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import "./chunk-4OIZM4HS.mjs";
|
|
3
|
-
import {
|
|
4
|
-
withTimeout
|
|
5
|
-
} from "./chunk-XWPCDIFC.mjs";
|
|
6
|
-
import "./chunk-J3GE7DEU.mjs";
|
|
7
|
-
import {
|
|
8
|
-
delay
|
|
9
|
-
} from "./chunk-O64NE2P4.mjs";
|
|
1
|
+
import "./chunk-UTBNEZQX.mjs";
|
|
10
2
|
import "./chunk-XT74R35S.mjs";
|
|
11
3
|
import {
|
|
12
4
|
kebabCase
|
|
@@ -20,30 +12,44 @@ import {
|
|
|
20
12
|
import {
|
|
21
13
|
startCase
|
|
22
14
|
} from "./chunk-QXTNZR7B.mjs";
|
|
15
|
+
import "./chunk-4OIZM4HS.mjs";
|
|
16
|
+
import {
|
|
17
|
+
withTimeout
|
|
18
|
+
} from "./chunk-IIDZ3KAJ.mjs";
|
|
19
|
+
import "./chunk-CVVZHOJX.mjs";
|
|
20
|
+
import {
|
|
21
|
+
delay
|
|
22
|
+
} from "./chunk-O64NE2P4.mjs";
|
|
23
23
|
import {
|
|
24
24
|
camelCase
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-WVQ7YVRK.mjs";
|
|
25
|
+
} from "./chunk-Y5V7UAZZ.mjs";
|
|
27
26
|
import {
|
|
28
27
|
capitalize
|
|
29
28
|
} from "./chunk-U56ZOM7L.mjs";
|
|
30
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-WVQ7YVRK.mjs";
|
|
30
|
+
import "./chunk-B645AYL4.mjs";
|
|
31
|
+
import {
|
|
32
|
+
isNull
|
|
33
|
+
} from "./chunk-AIRSKN47.mjs";
|
|
31
34
|
import {
|
|
32
35
|
isUndefined
|
|
33
36
|
} from "./chunk-VH2PV426.mjs";
|
|
34
37
|
import {
|
|
35
38
|
isEqual
|
|
36
39
|
} from "./chunk-JYSV56US.mjs";
|
|
40
|
+
import {
|
|
41
|
+
isLength
|
|
42
|
+
} from "./chunk-27QMXBLJ.mjs";
|
|
37
43
|
import {
|
|
38
44
|
isNil
|
|
39
45
|
} from "./chunk-WMM7TZLG.mjs";
|
|
40
46
|
import {
|
|
41
47
|
isNotNil
|
|
42
48
|
} from "./chunk-BMRTZMRE.mjs";
|
|
43
|
-
import {
|
|
44
|
-
isNull
|
|
45
|
-
} from "./chunk-AIRSKN47.mjs";
|
|
46
49
|
import "./chunk-54TK5BIS.mjs";
|
|
50
|
+
import {
|
|
51
|
+
omitBy
|
|
52
|
+
} from "./chunk-BCTYOXT7.mjs";
|
|
47
53
|
import {
|
|
48
54
|
pick
|
|
49
55
|
} from "./chunk-HPFDYUGP.mjs";
|
|
@@ -64,14 +70,17 @@ import {
|
|
|
64
70
|
} from "./chunk-OLX53VEF.mjs";
|
|
65
71
|
import {
|
|
66
72
|
omit
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import {
|
|
69
|
-
omitBy
|
|
70
|
-
} from "./chunk-BCTYOXT7.mjs";
|
|
73
|
+
} from "./chunk-WFZXCGEG.mjs";
|
|
71
74
|
import "./chunk-FUS75PJ7.mjs";
|
|
75
|
+
import {
|
|
76
|
+
round
|
|
77
|
+
} from "./chunk-5PMKOZ2F.mjs";
|
|
72
78
|
import {
|
|
73
79
|
sumBy
|
|
74
80
|
} from "./chunk-5L4VWRFX.mjs";
|
|
81
|
+
import {
|
|
82
|
+
clamp
|
|
83
|
+
} from "./chunk-MLCL773E.mjs";
|
|
75
84
|
import {
|
|
76
85
|
inRange
|
|
77
86
|
} from "./chunk-BH6HLGBA.mjs";
|
|
@@ -87,13 +96,10 @@ import {
|
|
|
87
96
|
import {
|
|
88
97
|
range
|
|
89
98
|
} from "./chunk-DPH2KE6O.mjs";
|
|
90
|
-
import {
|
|
91
|
-
round
|
|
92
|
-
} from "./chunk-5PMKOZ2F.mjs";
|
|
93
|
-
import {
|
|
94
|
-
clamp
|
|
95
|
-
} from "./chunk-MLCL773E.mjs";
|
|
96
99
|
import "./chunk-DDH7K4QM.mjs";
|
|
100
|
+
import {
|
|
101
|
+
unzipWith
|
|
102
|
+
} from "./chunk-IFNXROZR.mjs";
|
|
97
103
|
import {
|
|
98
104
|
without
|
|
99
105
|
} from "./chunk-PYEYV7BY.mjs";
|
|
@@ -115,6 +121,9 @@ import {
|
|
|
115
121
|
import {
|
|
116
122
|
zipWith
|
|
117
123
|
} from "./chunk-4KYXHZ4R.mjs";
|
|
124
|
+
import {
|
|
125
|
+
toFilled
|
|
126
|
+
} from "./chunk-OP4OAKQJ.mjs";
|
|
118
127
|
import {
|
|
119
128
|
union
|
|
120
129
|
} from "./chunk-R6QA7PLZ.mjs";
|
|
@@ -137,8 +146,8 @@ import {
|
|
|
137
146
|
unzip
|
|
138
147
|
} from "./chunk-UYZKMBDO.mjs";
|
|
139
148
|
import {
|
|
140
|
-
|
|
141
|
-
} from "./chunk-
|
|
149
|
+
sample
|
|
150
|
+
} from "./chunk-2KNLZB7V.mjs";
|
|
142
151
|
import {
|
|
143
152
|
sampleSize
|
|
144
153
|
} from "./chunk-EHSKB6DF.mjs";
|
|
@@ -167,8 +176,8 @@ import {
|
|
|
167
176
|
takeWhile
|
|
168
177
|
} from "./chunk-2IXFGSUA.mjs";
|
|
169
178
|
import {
|
|
170
|
-
|
|
171
|
-
} from "./chunk-
|
|
179
|
+
intersectionBy
|
|
180
|
+
} from "./chunk-O6UXZR3U.mjs";
|
|
172
181
|
import {
|
|
173
182
|
intersectionWith
|
|
174
183
|
} from "./chunk-XI7KRD2C.mjs";
|
|
@@ -190,9 +199,6 @@ import {
|
|
|
190
199
|
import {
|
|
191
200
|
partition
|
|
192
201
|
} from "./chunk-DN3NOZ3H.mjs";
|
|
193
|
-
import {
|
|
194
|
-
sample
|
|
195
|
-
} from "./chunk-2KNLZB7V.mjs";
|
|
196
202
|
import {
|
|
197
203
|
flattenDeep
|
|
198
204
|
} from "./chunk-ML727RRJ.mjs";
|
|
@@ -212,8 +218,8 @@ import {
|
|
|
212
218
|
intersection
|
|
213
219
|
} from "./chunk-FVVSE2F2.mjs";
|
|
214
220
|
import {
|
|
215
|
-
|
|
216
|
-
} from "./chunk-
|
|
221
|
+
differenceBy
|
|
222
|
+
} from "./chunk-LVWX5B43.mjs";
|
|
217
223
|
import {
|
|
218
224
|
differenceWith
|
|
219
225
|
} from "./chunk-6NVQAHXP.mjs";
|
|
@@ -250,9 +256,6 @@ import {
|
|
|
250
256
|
import {
|
|
251
257
|
difference
|
|
252
258
|
} from "./chunk-JPUKH67K.mjs";
|
|
253
|
-
import {
|
|
254
|
-
differenceBy
|
|
255
|
-
} from "./chunk-LVWX5B43.mjs";
|
|
256
259
|
import "./chunk-F47GLYUU.mjs";
|
|
257
260
|
import {
|
|
258
261
|
AbortError
|
|
@@ -261,6 +264,9 @@ import {
|
|
|
261
264
|
TimeoutError
|
|
262
265
|
} from "./chunk-KIOYQRMQ.mjs";
|
|
263
266
|
import "./chunk-236H5JZJ.mjs";
|
|
267
|
+
import {
|
|
268
|
+
negate
|
|
269
|
+
} from "./chunk-BOOQBJN2.mjs";
|
|
264
270
|
import {
|
|
265
271
|
noop
|
|
266
272
|
} from "./chunk-LKXCOLNY.mjs";
|
|
@@ -273,10 +279,7 @@ import {
|
|
|
273
279
|
import {
|
|
274
280
|
debounce
|
|
275
281
|
} from "./chunk-3IP4JVLL.mjs";
|
|
276
|
-
import
|
|
277
|
-
negate
|
|
278
|
-
} from "./chunk-BOOQBJN2.mjs";
|
|
279
|
-
import "./chunk-424M7IR7.mjs";
|
|
282
|
+
import "./chunk-24FKGR6U.mjs";
|
|
280
283
|
export {
|
|
281
284
|
AbortError,
|
|
282
285
|
TimeoutError,
|
|
@@ -311,6 +314,7 @@ export {
|
|
|
311
314
|
intersectionWith,
|
|
312
315
|
invert,
|
|
313
316
|
isEqual,
|
|
317
|
+
isLength,
|
|
314
318
|
isNil,
|
|
315
319
|
isNotNil,
|
|
316
320
|
isNull,
|
package/dist/math/clamp.mjs
CHANGED
package/dist/math/inRange.mjs
CHANGED
package/dist/math/index.mjs
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import "../chunk-FUS75PJ7.mjs";
|
|
2
|
+
import {
|
|
3
|
+
round
|
|
4
|
+
} from "../chunk-5PMKOZ2F.mjs";
|
|
2
5
|
import {
|
|
3
6
|
sumBy
|
|
4
7
|
} from "../chunk-5L4VWRFX.mjs";
|
|
8
|
+
import {
|
|
9
|
+
clamp
|
|
10
|
+
} from "../chunk-MLCL773E.mjs";
|
|
5
11
|
import {
|
|
6
12
|
inRange
|
|
7
13
|
} from "../chunk-BH6HLGBA.mjs";
|
|
@@ -17,19 +23,13 @@ import {
|
|
|
17
23
|
import {
|
|
18
24
|
range
|
|
19
25
|
} from "../chunk-DPH2KE6O.mjs";
|
|
20
|
-
import {
|
|
21
|
-
round
|
|
22
|
-
} from "../chunk-5PMKOZ2F.mjs";
|
|
23
|
-
import {
|
|
24
|
-
clamp
|
|
25
|
-
} from "../chunk-MLCL773E.mjs";
|
|
26
26
|
import {
|
|
27
27
|
randomInt
|
|
28
28
|
} from "../chunk-GIWAOOFY.mjs";
|
|
29
29
|
import {
|
|
30
30
|
random
|
|
31
31
|
} from "../chunk-SYWMYQYJ.mjs";
|
|
32
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-24FKGR6U.mjs";
|
|
33
33
|
export {
|
|
34
34
|
clamp,
|
|
35
35
|
inRange,
|
package/dist/math/mean.mjs
CHANGED
package/dist/math/meanBy.mjs
CHANGED
package/dist/math/random.mjs
CHANGED
package/dist/math/randomInt.mjs
CHANGED
package/dist/math/range.mjs
CHANGED
package/dist/math/round.mjs
CHANGED
package/dist/math/sum.mjs
CHANGED
package/dist/math/sumBy.mjs
CHANGED
package/dist/object/clone.mjs
CHANGED
package/dist/object/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import "../chunk-54TK5BIS.mjs";
|
|
2
|
+
import {
|
|
3
|
+
omitBy
|
|
4
|
+
} from "../chunk-BCTYOXT7.mjs";
|
|
2
5
|
import {
|
|
3
6
|
pick
|
|
4
7
|
} from "../chunk-HPFDYUGP.mjs";
|
|
@@ -17,11 +20,8 @@ import {
|
|
|
17
20
|
} from "../chunk-OLX53VEF.mjs";
|
|
18
21
|
import {
|
|
19
22
|
omit
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import
|
|
22
|
-
omitBy
|
|
23
|
-
} from "../chunk-BCTYOXT7.mjs";
|
|
24
|
-
import "../chunk-424M7IR7.mjs";
|
|
23
|
+
} from "../chunk-WFZXCGEG.mjs";
|
|
24
|
+
import "../chunk-24FKGR6U.mjs";
|
|
25
25
|
export {
|
|
26
26
|
clone,
|
|
27
27
|
flattenObject,
|
package/dist/object/invert.mjs
CHANGED
package/dist/object/omit.mjs
CHANGED
package/dist/object/omitBy.mjs
CHANGED
package/dist/object/pick.mjs
CHANGED
package/dist/object/pickBy.mjs
CHANGED
package/dist/predicate/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var predicate_exports = {};
|
|
22
22
|
__export(predicate_exports, {
|
|
23
23
|
isEqual: () => isEqual,
|
|
24
|
+
isLength: () => isLength,
|
|
24
25
|
isNil: () => isNil,
|
|
25
26
|
isNotNil: () => isNotNil,
|
|
26
27
|
isNull: () => isNull,
|
|
@@ -92,6 +93,11 @@ function isUndefined(x) {
|
|
|
92
93
|
return x === void 0;
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
// src/predicate/isLength.ts
|
|
97
|
+
function isLength(value) {
|
|
98
|
+
return typeof value === "number" && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;
|
|
99
|
+
}
|
|
100
|
+
|
|
95
101
|
// src/predicate/isPlainObject.ts
|
|
96
102
|
function isPlainObject(object) {
|
|
97
103
|
if (typeof object !== "object") {
|
|
@@ -115,6 +121,7 @@ function isPlainObject(object) {
|
|
|
115
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
116
122
|
0 && (module.exports = {
|
|
117
123
|
isEqual,
|
|
124
|
+
isLength,
|
|
118
125
|
isNil,
|
|
119
126
|
isNotNil,
|
|
120
127
|
isNull,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/predicate/index.ts","../../src/array/uniq.ts","../../src/array/union.ts","../../src/predicate/isEqual.ts","../../src/predicate/isNil.ts","../../src/predicate/isNotNil.ts","../../src/predicate/isNull.ts","../../src/predicate/isUndefined.ts","../../src/predicate/isPlainObject.ts"],"sourcesContent":["export { isEqual } from './isEqual.ts';\nexport { isNil } from './isNil.ts';\nexport { isNotNil } from './isNotNil.ts';\nexport { isNull } from './isNull.ts';\nexport { isUndefined } from './isUndefined.ts';\nexport { isPlainObject } from './isPlainObject.ts'
|
|
1
|
+
{"version":3,"sources":["../../src/predicate/index.ts","../../src/array/uniq.ts","../../src/array/union.ts","../../src/predicate/isEqual.ts","../../src/predicate/isNil.ts","../../src/predicate/isNotNil.ts","../../src/predicate/isNull.ts","../../src/predicate/isUndefined.ts","../../src/predicate/isLength.ts","../../src/predicate/isPlainObject.ts"],"sourcesContent":["export { isEqual } from './isEqual.ts';\nexport { isNil } from './isNil.ts';\nexport { isNotNil } from './isNotNil.ts';\nexport { isNull } from './isNull.ts';\nexport { isUndefined } from './isUndefined.ts';\nexport { isLength } from './isLength.ts';\nexport { isPlainObject } from './isPlainObject.ts';\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n","import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n","import { union } from \"../array/union.ts\";\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @param {unknown} a - The first value to compare.\n * @param {unknown} b - The second value to compare.\n * @returns {boolean} `true` if the values are equal, otherwise `false`.\n *\n * @example\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n\n const aKeys = Object.keys(a as object);\n const bKeys = Object.keys(b as object);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n // check if all keys in both arrays match\n if (union(aKeys, bKeys).length !== aKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const propKey = aKeys[i];\n const aProp = (a as any)[propKey];\n const bProp = (b as any)[propKey];\n \n if (!isEqual(aProp, bProp)) {\n return false;\n }\n }\n\n return true;\n}\n","/**\n * Checks if a given value is null or undefined.\n *\n * This function tests whether the provided value is either `null` or `undefined`.\n * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.\n *\n * @param {unknown} x - The value to test for null or undefined.\n * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * const result1 = isNil(value1); // true\n * const result2 = isNil(value2); // true\n * const result3 = isNil(value3); // false\n */\nexport function isNil(x: unknown): x is null | undefined {\n return x == null;\n}\n","/**\n * Checks if the given value is not null nor undefined.\n *\n * The main use of this function is to be used with TypeScript as a type predicate.\n *\n * @template T - The type of value.\n * @param {T | null | undefined} x - The value to test if it is not null nor undefined.\n * @returns {x is T} True if the value is not null nor undefined, false otherwise.\n *\n * @example\n * // Here the type of `arr` is (number | undefined)[]\n * const arr = [1, undefined, 3];\n * // Here the type of `result` is number[]\n * const result = arr.filter(isNotNil);\n * // result will be [1, 3]\n */\nexport function isNotNil<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n","/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`.\n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n *\n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n *\n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n","/**\n * Checks if the given value is undefined.\n *\n * This function tests whether the provided value is strictly equal to `undefined`.\n * It returns `true` if the value is `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.\n *\n * @param {unknown} x - The value to test if it is undefined.\n * @returns {x is undefined} true if the value is undefined, false otherwise.\n *\n * @example\n * const value1 = undefined;\n * const value2 = null;\n * const value3 = 42;\n *\n * console.log(isUndefined(value1)); // true\n * console.log(isUndefined(value2)); // false\n * console.log(isUndefined(value3)); // false\n */\nexport function isUndefined(x: unknown): x is undefined {\n return x === undefined;\n}\n","export function isLength(value: unknown): value is number {\n return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;\n}\n","/**\n * Checks if a given value is a plain object.\n * \n * @param {object} object - The value to check.\n * @returns {boolean} - True if the value is a plain object, otherwise false.\n * \n * @example\n * console.log(isPlainObject({})); // true\n * console.log(isPlainObject([])); // false\n * console.log(isPlainObject(null)); // false\n * console.log(isPlainObject(Object.create(null))); // true\n * console.log(Buffer.from('hello, world')); // false\n */\nexport function isPlainObject(object: object): boolean {\n if (typeof object !== 'object') {\n return false;\n }\n\n if (object == null) {\n return false;\n }\n\n if (Object.getPrototypeOf(object) === null) {\n return true;\n }\n\n if (object.toString() !== '[object Object]') {\n return false;\n }\n\n let proto = object;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(object) === proto;\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;;;ACEO,SAAS,MAAS,MAAoB,MAAyB;AACpE,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;;;ACLO,SAAS,QAAQ,GAAY,GAAqB;AACvD,MAAI,OAAO,GAAG,GAAG,CAAC,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,QAAQ,aAAa,MAAM;AAC1C,WAAO,EAAE,QAAQ,MAAM,EAAE,QAAQ;AAAA,EACnC;AAEA,MAAI,aAAa,UAAU,aAAa,QAAQ;AAC9C,WAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;AAAA,EAChD;AAEA,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC9E,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,OAAO,KAAK,CAAW;AACrC,QAAM,QAAQ,OAAO,KAAK,CAAW;AAErC,MAAI,MAAM,WAAW,MAAM,QAAQ;AACjC,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,OAAO,KAAK,EAAE,WAAW,MAAM,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,UAAU,MAAM,CAAC;AACvB,UAAM,QAAS,EAAU,OAAO;AAChC,UAAM,QAAS,EAAU,OAAO;AAEhC,QAAI,CAAC,QAAQ,OAAO,KAAK,GAAG;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;;;ACrCO,SAAS,MAAM,GAAmC;AACvD,SAAO,KAAK;AACd;;;ACLO,SAAS,SAAY,GAAiC;AAC3D,SAAO,MAAM,QAAQ,MAAM;AAC7B;;;ACEO,SAAS,OAAO,GAAuB;AAC5C,SAAO,MAAM;AACf;;;ACFO,SAAS,YAAY,GAA4B;AACtD,SAAO,MAAM;AACf;;;ACtBO,SAAS,SAAS,OAAiC;AACxD,SAAO,OAAO,UAAU,YAAY,QAAQ,MAAM,QAAQ,MAAM,KAAK,SAAS,OAAO;AACvF;;;ACWO,SAAS,cAAc,QAAyB;AACrD,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,UAAU,MAAM;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,MAAM,MAAM,MAAM;AAC1C,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,MAAM,mBAAmB;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ;AAEZ,SAAO,OAAO,eAAe,KAAK,MAAM,MAAM;AAC5C,YAAQ,OAAO,eAAe,KAAK;AAAA,EACrC;AAEA,SAAO,OAAO,eAAe,MAAM,MAAM;AAC3C;","names":[]}
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-B645AYL4.mjs";
|
|
2
|
+
import {
|
|
3
|
+
isNull
|
|
4
|
+
} from "../chunk-AIRSKN47.mjs";
|
|
2
5
|
import {
|
|
3
6
|
isUndefined
|
|
4
7
|
} from "../chunk-VH2PV426.mjs";
|
|
5
8
|
import {
|
|
6
9
|
isEqual
|
|
7
10
|
} from "../chunk-JYSV56US.mjs";
|
|
11
|
+
import {
|
|
12
|
+
isLength
|
|
13
|
+
} from "../chunk-27QMXBLJ.mjs";
|
|
8
14
|
import {
|
|
9
15
|
isNil
|
|
10
16
|
} from "../chunk-WMM7TZLG.mjs";
|
|
11
17
|
import {
|
|
12
18
|
isNotNil
|
|
13
19
|
} from "../chunk-BMRTZMRE.mjs";
|
|
14
|
-
import {
|
|
15
|
-
isNull
|
|
16
|
-
} from "../chunk-AIRSKN47.mjs";
|
|
17
20
|
import {
|
|
18
21
|
isPlainObject
|
|
19
22
|
} from "../chunk-MIGAC7F4.mjs";
|
|
20
23
|
import "../chunk-R6QA7PLZ.mjs";
|
|
21
24
|
import "../chunk-DVK2N4KC.mjs";
|
|
22
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-24FKGR6U.mjs";
|
|
23
26
|
export {
|
|
24
27
|
isEqual,
|
|
28
|
+
isLength,
|
|
25
29
|
isNil,
|
|
26
30
|
isNotNil,
|
|
27
31
|
isNull,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/predicate/isLength.ts
|
|
21
|
+
var isLength_exports = {};
|
|
22
|
+
__export(isLength_exports, {
|
|
23
|
+
isLength: () => isLength
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(isLength_exports);
|
|
26
|
+
function isLength(value) {
|
|
27
|
+
return typeof value === "number" && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isLength
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=isLength.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/predicate/isLength.ts"],"sourcesContent":["export function isLength(value: unknown): value is number {\n return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,SAAS,OAAiC;AACxD,SAAO,OAAO,UAAU,YAAY,QAAQ,MAAM,QAAQ,MAAM,KAAK,SAAS,OAAO;AACvF;","names":[]}
|
package/dist/predicate/isNil.mjs
CHANGED