es-toolkit 1.13.1-dev.320 → 1.13.1-dev.322
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.d.mts +1 -1
- package/dist/array/compact.d.ts +1 -1
- package/dist/array/compact.js.map +1 -1
- package/dist/array/compact.mjs +2 -2
- package/dist/array/countBy.js +1 -2
- package/dist/array/countBy.js.map +1 -1
- package/dist/array/countBy.mjs +2 -2
- 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.d.mts +1 -0
- package/dist/array/fill.d.ts +1 -0
- package/dist/array/fill.js.map +1 -1
- package/dist/array/fill.mjs +2 -2
- 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.d.mts +1 -0
- package/dist/array/head.d.ts +1 -0
- package/dist/array/head.js.map +1 -1
- package/dist/array/head.mjs +2 -2
- package/dist/array/index.js +1 -2
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +56 -56
- 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.d.mts +1 -0
- package/dist/array/last.d.ts +1 -0
- package/dist/array/last.js.map +1 -1
- package/dist/array/last.mjs +2 -2
- 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 +9 -4
- package/dist/array/tail.d.ts +9 -4
- 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.d.mts +2 -0
- package/dist/array/toFilled.d.ts +2 -0
- package/dist/array/toFilled.js.map +1 -1
- package/dist/array/toFilled.mjs +2 -2
- 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.d.mts +3 -2
- package/dist/array/unzip.d.ts +3 -2
- package/dist/array/unzip.js.map +1 -1
- package/dist/array/unzip.mjs +2 -2
- 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.d.mts +5 -0
- package/dist/array/zipWith.d.ts +5 -0
- package/dist/array/zipWith.js.map +1 -1
- package/dist/array/zipWith.mjs +2 -2
- package/dist/browser.js +22 -58
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +54 -53
- package/dist/browser.mjs.map +1 -1
- package/dist/{chunk-QXTNZR7B.mjs → chunk-3SBT6WDU.mjs} +2 -2
- package/dist/{chunk-O64NE2P4.mjs → chunk-4DFAGGIM.mjs} +3 -3
- package/dist/{chunk-O64NE2P4.mjs.map → chunk-4DFAGGIM.mjs.map} +1 -1
- package/dist/{chunk-Y5V7UAZZ.mjs → chunk-4ZES5T6V.mjs} +4 -4
- package/dist/{chunk-TJ4Z5I7M.mjs → chunk-DLS7UJKJ.mjs} +1 -1
- package/dist/chunk-DLS7UJKJ.mjs.map +1 -0
- package/dist/{chunk-KPBQ7OUY.mjs → chunk-DTTKJ3VC.mjs} +1 -1
- package/dist/chunk-DTTKJ3VC.mjs.map +1 -0
- package/dist/{chunk-YNJH6GEG.mjs → chunk-EEHJ656S.mjs} +95 -92
- package/dist/chunk-EEHJ656S.mjs.map +1 -0
- package/dist/{chunk-EYYZQFOP.mjs → chunk-ET33L3MQ.mjs} +2 -2
- package/dist/chunk-EZYYB34V.mjs +17 -0
- package/dist/{chunk-CVVZHOJX.mjs.map → chunk-EZYYB34V.mjs.map} +1 -1
- package/dist/{chunk-HM2JT2RX.mjs → chunk-FZZNWXDM.mjs} +1 -1
- package/dist/chunk-FZZNWXDM.mjs.map +1 -0
- package/dist/{chunk-YFN6KOC4.mjs → chunk-GTFDDKZ2.mjs} +1 -1
- package/dist/chunk-GTFDDKZ2.mjs.map +1 -0
- package/dist/{chunk-F3WCQQET.mjs → chunk-IWXZI3QT.mjs} +2 -2
- package/dist/chunk-J5LGTIGS.mjs +10 -0
- package/dist/{chunk-UYZKMBDO.mjs → chunk-JCRY7ZYS.mjs} +1 -1
- package/dist/chunk-JCRY7ZYS.mjs.map +1 -0
- package/dist/{chunk-5CPXZFCB.mjs → chunk-K5WL54BY.mjs} +2 -2
- package/dist/{chunk-5CPXZFCB.mjs.map → chunk-K5WL54BY.mjs.map} +1 -1
- package/dist/{chunk-4KYXHZ4R.mjs → chunk-MJ7LNBI6.mjs} +1 -1
- package/dist/chunk-MJ7LNBI6.mjs.map +1 -0
- package/dist/{chunk-3IP4JVLL.mjs → chunk-MSHSKENG.mjs} +3 -3
- package/dist/{chunk-3IP4JVLL.mjs.map → chunk-MSHSKENG.mjs.map} +1 -1
- package/dist/{chunk-WVQ7YVRK.mjs → chunk-OG2RLT5U.mjs} +2 -3
- package/dist/{chunk-WVQ7YVRK.mjs.map → chunk-OG2RLT5U.mjs.map} +1 -1
- package/dist/{chunk-DTJJIMKJ.mjs → chunk-PJPGJ2O6.mjs} +1 -1
- package/dist/chunk-PJPGJ2O6.mjs.map +1 -0
- package/dist/chunk-R6GLTTAB.mjs +9 -0
- package/dist/chunk-R6GLTTAB.mjs.map +1 -0
- package/dist/{chunk-5IKVJGHO.mjs → chunk-RTFTLCF3.mjs} +2 -2
- package/dist/{chunk-OP4OAKQJ.mjs → chunk-XHSIT5DL.mjs} +1 -1
- package/dist/chunk-XHSIT5DL.mjs.map +1 -0
- package/dist/{chunk-WFZXCGEG.mjs → chunk-YOPFSFTD.mjs} +2 -6
- package/dist/{chunk-WFZXCGEG.mjs.map → chunk-YOPFSFTD.mjs.map} +1 -1
- package/dist/chunk-YXD3AQAK.mjs +1 -0
- package/dist/{chunk-CRSKT4WW.mjs → chunk-Z7HWEOQX.mjs} +2 -3
- package/dist/{chunk-CRSKT4WW.mjs.map → chunk-Z7HWEOQX.mjs.map} +1 -1
- package/dist/chunk-ZPNX2QDE.mjs +13 -0
- package/dist/{chunk-IIDZ3KAJ.mjs.map → chunk-ZPNX2QDE.mjs.map} +1 -1
- package/dist/compat/index.d.mts +3 -1
- package/dist/compat/index.d.ts +3 -1
- package/dist/compat/index.js +23 -57
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +98 -94
- package/dist/error/AbortError.mjs +1 -1
- package/dist/error/TimeoutError.mjs +1 -1
- package/dist/error/index.mjs +4 -4
- package/dist/function/after.mjs +1 -1
- package/dist/function/debounce.js +2 -2
- package/dist/function/debounce.js.map +1 -1
- package/dist/function/debounce.mjs +2 -2
- package/dist/function/index.js +2 -2
- package/dist/function/index.js.map +1 -1
- package/dist/function/index.mjs +10 -10
- 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 +20 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -93
- package/dist/math/clamp.mjs +1 -1
- package/dist/math/inRange.mjs +1 -1
- package/dist/math/index.mjs +1 -1
- 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/cloneDeep.js +1 -1
- package/dist/object/cloneDeep.js.map +1 -1
- package/dist/object/cloneDeep.mjs +2 -2
- package/dist/object/flattenObject.mjs +1 -1
- package/dist/object/index.js +2 -16
- package/dist/object/index.js.map +1 -1
- package/dist/object/index.mjs +3 -3
- package/dist/object/invert.mjs +1 -1
- package/dist/object/omit.js +1 -15
- package/dist/object/omit.js.map +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/isArrayLike.mjs +1 -1
- package/dist/predicate/isEqual.mjs +1 -1
- package/dist/predicate/isFunction.mjs +1 -1
- package/dist/predicate/isLength.mjs +1 -1
- 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/isPrimitive.d.mts +17 -0
- package/dist/predicate/isPrimitive.d.ts +17 -0
- package/dist/predicate/isPrimitive.js +33 -0
- package/dist/predicate/isPrimitive.js.map +1 -0
- package/dist/predicate/isPrimitive.mjs +8 -0
- package/dist/predicate/isPrimitive.mjs.map +1 -0
- package/dist/predicate/isTypedArray.mjs +1 -1
- package/dist/predicate/isUndefined.mjs +1 -1
- package/dist/promise/delay.js +2 -2
- package/dist/promise/delay.js.map +1 -1
- package/dist/promise/delay.mjs +2 -2
- package/dist/promise/index.js +7 -31
- package/dist/promise/index.js.map +1 -1
- package/dist/promise/index.mjs +5 -5
- package/dist/promise/timeout.js +5 -27
- package/dist/promise/timeout.js.map +1 -1
- package/dist/promise/timeout.mjs +4 -4
- package/dist/promise/withTimeout.js +7 -31
- package/dist/promise/withTimeout.js.map +1 -1
- package/dist/promise/withTimeout.mjs +5 -5
- package/dist/string/camelCase.js +1 -2
- package/dist/string/camelCase.js.map +1 -1
- package/dist/string/camelCase.mjs +3 -3
- package/dist/string/capitalize.mjs +1 -1
- package/dist/string/index.js +1 -2
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +9 -9
- package/dist/string/kebabCase.js +1 -2
- package/dist/string/kebabCase.js.map +1 -1
- package/dist/string/kebabCase.mjs +3 -3
- package/dist/string/lowerCase.js +1 -2
- package/dist/string/lowerCase.js.map +1 -1
- package/dist/string/lowerCase.mjs +3 -3
- package/dist/string/snakeCase.js +1 -2
- package/dist/string/snakeCase.js.map +1 -1
- package/dist/string/snakeCase.mjs +3 -3
- package/dist/string/startCase.js +1 -2
- package/dist/string/startCase.js.map +1 -1
- package/dist/string/startCase.mjs +3 -3
- package/package.json +1 -1
- package/umd/browser.global.js +1 -1
- package/dist/chunk-24FKGR6U.mjs +0 -47
- package/dist/chunk-4KYXHZ4R.mjs.map +0 -1
- package/dist/chunk-CVVZHOJX.mjs +0 -22
- package/dist/chunk-DTJJIMKJ.mjs.map +0 -1
- package/dist/chunk-HM2JT2RX.mjs.map +0 -1
- package/dist/chunk-IIDZ3KAJ.mjs +0 -18
- package/dist/chunk-KPBQ7OUY.mjs.map +0 -1
- package/dist/chunk-OP4OAKQJ.mjs.map +0 -1
- package/dist/chunk-STL6TD3L.mjs +0 -1
- package/dist/chunk-TJ4Z5I7M.mjs.map +0 -1
- package/dist/chunk-UYZKMBDO.mjs.map +0 -1
- package/dist/chunk-YFN6KOC4.mjs.map +0 -1
- package/dist/chunk-YNJH6GEG.mjs.map +0 -1
- /package/dist/{chunk-QXTNZR7B.mjs.map → chunk-3SBT6WDU.mjs.map} +0 -0
- /package/dist/{chunk-Y5V7UAZZ.mjs.map → chunk-4ZES5T6V.mjs.map} +0 -0
- /package/dist/{chunk-EYYZQFOP.mjs.map → chunk-ET33L3MQ.mjs.map} +0 -0
- /package/dist/{chunk-F3WCQQET.mjs.map → chunk-IWXZI3QT.mjs.map} +0 -0
- /package/dist/{chunk-24FKGR6U.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/{chunk-5IKVJGHO.mjs.map → chunk-RTFTLCF3.mjs.map} +0 -0
- /package/dist/{chunk-STL6TD3L.mjs.map → chunk-YXD3AQAK.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -2,32 +2,35 @@ import "./chunk-NKLIE2OI.mjs";
|
|
|
2
2
|
import "./chunk-4OIZM4HS.mjs";
|
|
3
3
|
import {
|
|
4
4
|
withTimeout
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-ZPNX2QDE.mjs";
|
|
6
|
+
import "./chunk-EZYYB34V.mjs";
|
|
7
7
|
import {
|
|
8
8
|
delay
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4DFAGGIM.mjs";
|
|
10
10
|
import "./chunk-XT74R35S.mjs";
|
|
11
|
+
import {
|
|
12
|
+
kebabCase
|
|
13
|
+
} from "./chunk-ET33L3MQ.mjs";
|
|
11
14
|
import {
|
|
12
15
|
lowerCase
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RTFTLCF3.mjs";
|
|
14
17
|
import {
|
|
15
18
|
snakeCase
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IWXZI3QT.mjs";
|
|
17
20
|
import {
|
|
18
21
|
startCase
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3SBT6WDU.mjs";
|
|
20
23
|
import {
|
|
21
24
|
camelCase
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-4ZES5T6V.mjs";
|
|
26
|
+
import "./chunk-OG2RLT5U.mjs";
|
|
23
27
|
import {
|
|
24
28
|
capitalize
|
|
25
29
|
} from "./chunk-U56ZOM7L.mjs";
|
|
30
|
+
import "./chunk-YXD3AQAK.mjs";
|
|
26
31
|
import {
|
|
27
|
-
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-WVQ7YVRK.mjs";
|
|
30
|
-
import "./chunk-STL6TD3L.mjs";
|
|
32
|
+
isUndefined
|
|
33
|
+
} from "./chunk-VH2PV426.mjs";
|
|
31
34
|
import {
|
|
32
35
|
isFunction
|
|
33
36
|
} from "./chunk-74CREQXW.mjs";
|
|
@@ -40,12 +43,12 @@ import {
|
|
|
40
43
|
import {
|
|
41
44
|
isNull
|
|
42
45
|
} from "./chunk-AIRSKN47.mjs";
|
|
46
|
+
import {
|
|
47
|
+
isPrimitive
|
|
48
|
+
} from "./chunk-R6GLTTAB.mjs";
|
|
43
49
|
import {
|
|
44
50
|
isTypedArray
|
|
45
51
|
} from "./chunk-SXFMQQ6F.mjs";
|
|
46
|
-
import {
|
|
47
|
-
isUndefined
|
|
48
|
-
} from "./chunk-VH2PV426.mjs";
|
|
49
52
|
import {
|
|
50
53
|
isArrayLike
|
|
51
54
|
} from "./chunk-LPZZIY5Z.mjs";
|
|
@@ -61,7 +64,7 @@ import {
|
|
|
61
64
|
} from "./chunk-OLX53VEF.mjs";
|
|
62
65
|
import {
|
|
63
66
|
omit
|
|
64
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-YOPFSFTD.mjs";
|
|
65
68
|
import {
|
|
66
69
|
omitBy
|
|
67
70
|
} from "./chunk-BCTYOXT7.mjs";
|
|
@@ -76,7 +79,7 @@ import {
|
|
|
76
79
|
} from "./chunk-VRUTBJYS.mjs";
|
|
77
80
|
import {
|
|
78
81
|
cloneDeep
|
|
79
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-K5WL54BY.mjs";
|
|
80
83
|
import {
|
|
81
84
|
flattenObject
|
|
82
85
|
} from "./chunk-XGQWTHW6.mjs";
|
|
@@ -108,33 +111,19 @@ import {
|
|
|
108
111
|
import {
|
|
109
112
|
sum
|
|
110
113
|
} from "./chunk-2SLTL4KL.mjs";
|
|
111
|
-
import "./chunk-
|
|
112
|
-
import {
|
|
113
|
-
TimeoutError
|
|
114
|
-
} from "./chunk-KIOYQRMQ.mjs";
|
|
115
|
-
import "./chunk-ZA2XI3OV.mjs";
|
|
116
|
-
import {
|
|
117
|
-
throttle
|
|
118
|
-
} from "./chunk-QOJGMVVR.mjs";
|
|
119
|
-
import {
|
|
120
|
-
after
|
|
121
|
-
} from "./chunk-OGZMEWPR.mjs";
|
|
122
|
-
import {
|
|
123
|
-
debounce
|
|
124
|
-
} from "./chunk-3IP4JVLL.mjs";
|
|
114
|
+
import "./chunk-DDH7K4QM.mjs";
|
|
125
115
|
import {
|
|
126
|
-
|
|
127
|
-
} from "./chunk-
|
|
116
|
+
zipWith
|
|
117
|
+
} from "./chunk-MJ7LNBI6.mjs";
|
|
128
118
|
import {
|
|
129
|
-
|
|
130
|
-
} from "./chunk-
|
|
119
|
+
unzip
|
|
120
|
+
} from "./chunk-JCRY7ZYS.mjs";
|
|
131
121
|
import {
|
|
132
|
-
|
|
133
|
-
} from "./chunk-
|
|
122
|
+
unzipWith
|
|
123
|
+
} from "./chunk-IFNXROZR.mjs";
|
|
134
124
|
import {
|
|
135
|
-
|
|
136
|
-
} from "./chunk-
|
|
137
|
-
import "./chunk-DDH7K4QM.mjs";
|
|
125
|
+
without
|
|
126
|
+
} from "./chunk-PYEYV7BY.mjs";
|
|
138
127
|
import {
|
|
139
128
|
xor
|
|
140
129
|
} from "./chunk-L7FQX5MN.mjs";
|
|
@@ -151,14 +140,23 @@ import {
|
|
|
151
140
|
zipObject
|
|
152
141
|
} from "./chunk-6GWEY5EL.mjs";
|
|
153
142
|
import {
|
|
154
|
-
|
|
155
|
-
} from "./chunk-
|
|
143
|
+
takeWhile
|
|
144
|
+
} from "./chunk-2IXFGSUA.mjs";
|
|
145
|
+
import {
|
|
146
|
+
toFilled
|
|
147
|
+
} from "./chunk-XHSIT5DL.mjs";
|
|
148
|
+
import {
|
|
149
|
+
union
|
|
150
|
+
} from "./chunk-R6QA7PLZ.mjs";
|
|
156
151
|
import {
|
|
157
152
|
unionBy
|
|
158
153
|
} from "./chunk-NFS7RWWE.mjs";
|
|
159
154
|
import {
|
|
160
155
|
unionWith
|
|
161
156
|
} from "./chunk-2ZCITDMK.mjs";
|
|
157
|
+
import {
|
|
158
|
+
uniq
|
|
159
|
+
} from "./chunk-DVK2N4KC.mjs";
|
|
162
160
|
import {
|
|
163
161
|
uniqBy
|
|
164
162
|
} from "./chunk-B4COTK4K.mjs";
|
|
@@ -166,20 +164,26 @@ import {
|
|
|
166
164
|
uniqWith
|
|
167
165
|
} from "./chunk-237HGSZS.mjs";
|
|
168
166
|
import {
|
|
169
|
-
|
|
170
|
-
} from "./chunk-
|
|
167
|
+
partition
|
|
168
|
+
} from "./chunk-DN3NOZ3H.mjs";
|
|
171
169
|
import {
|
|
172
|
-
|
|
173
|
-
} from "./chunk-
|
|
170
|
+
sample
|
|
171
|
+
} from "./chunk-2KNLZB7V.mjs";
|
|
174
172
|
import {
|
|
175
|
-
|
|
176
|
-
} from "./chunk-
|
|
173
|
+
sampleSize
|
|
174
|
+
} from "./chunk-EHSKB6DF.mjs";
|
|
175
|
+
import {
|
|
176
|
+
randomInt
|
|
177
|
+
} from "./chunk-GIWAOOFY.mjs";
|
|
178
|
+
import {
|
|
179
|
+
random
|
|
180
|
+
} from "./chunk-SYWMYQYJ.mjs";
|
|
177
181
|
import {
|
|
178
182
|
shuffle
|
|
179
183
|
} from "./chunk-G7UQ5PUR.mjs";
|
|
180
184
|
import {
|
|
181
185
|
tail
|
|
182
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-DLS7UJKJ.mjs";
|
|
183
187
|
import {
|
|
184
188
|
take
|
|
185
189
|
} from "./chunk-ME352XO7.mjs";
|
|
@@ -190,23 +194,20 @@ import {
|
|
|
190
194
|
takeRightWhile
|
|
191
195
|
} from "./chunk-NTLX2MPV.mjs";
|
|
192
196
|
import {
|
|
193
|
-
|
|
194
|
-
} from "./chunk-
|
|
195
|
-
import {
|
|
196
|
-
toFilled
|
|
197
|
-
} from "./chunk-OP4OAKQJ.mjs";
|
|
197
|
+
intersection
|
|
198
|
+
} from "./chunk-FVVSE2F2.mjs";
|
|
198
199
|
import {
|
|
199
|
-
|
|
200
|
-
} from "./chunk-
|
|
200
|
+
intersectionBy
|
|
201
|
+
} from "./chunk-O6UXZR3U.mjs";
|
|
201
202
|
import {
|
|
202
|
-
|
|
203
|
-
} from "./chunk-
|
|
203
|
+
intersectionWith
|
|
204
|
+
} from "./chunk-XI7KRD2C.mjs";
|
|
204
205
|
import {
|
|
205
206
|
keyBy
|
|
206
207
|
} from "./chunk-AJKZMN2V.mjs";
|
|
207
208
|
import {
|
|
208
209
|
last
|
|
209
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-DTTKJ3VC.mjs";
|
|
210
211
|
import {
|
|
211
212
|
maxBy
|
|
212
213
|
} from "./chunk-OOKNBU4V.mjs";
|
|
@@ -217,20 +218,14 @@ import {
|
|
|
217
218
|
orderBy
|
|
218
219
|
} from "./chunk-7B7W36UP.mjs";
|
|
219
220
|
import {
|
|
220
|
-
|
|
221
|
-
} from "./chunk-
|
|
222
|
-
import {
|
|
223
|
-
sample
|
|
224
|
-
} from "./chunk-2KNLZB7V.mjs";
|
|
225
|
-
import {
|
|
226
|
-
sampleSize
|
|
227
|
-
} from "./chunk-EHSKB6DF.mjs";
|
|
221
|
+
flatMap
|
|
222
|
+
} from "./chunk-UY76KTPE.mjs";
|
|
228
223
|
import {
|
|
229
|
-
|
|
230
|
-
} from "./chunk-
|
|
224
|
+
flattenDeep
|
|
225
|
+
} from "./chunk-ML727RRJ.mjs";
|
|
231
226
|
import {
|
|
232
|
-
|
|
233
|
-
} from "./chunk-
|
|
227
|
+
flatten
|
|
228
|
+
} from "./chunk-33MSBDC6.mjs";
|
|
234
229
|
import {
|
|
235
230
|
forEachRight
|
|
236
231
|
} from "./chunk-IEA53J7P.mjs";
|
|
@@ -239,19 +234,19 @@ import {
|
|
|
239
234
|
} from "./chunk-E6E4RZLN.mjs";
|
|
240
235
|
import {
|
|
241
236
|
head
|
|
242
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-FZZNWXDM.mjs";
|
|
243
238
|
import {
|
|
244
239
|
initial
|
|
245
240
|
} from "./chunk-XPSOKBRZ.mjs";
|
|
246
241
|
import {
|
|
247
|
-
|
|
248
|
-
} from "./chunk-
|
|
242
|
+
difference
|
|
243
|
+
} from "./chunk-JPUKH67K.mjs";
|
|
249
244
|
import {
|
|
250
|
-
|
|
251
|
-
} from "./chunk-
|
|
245
|
+
differenceBy
|
|
246
|
+
} from "./chunk-LVWX5B43.mjs";
|
|
252
247
|
import {
|
|
253
|
-
|
|
254
|
-
} from "./chunk-
|
|
248
|
+
differenceWith
|
|
249
|
+
} from "./chunk-6NVQAHXP.mjs";
|
|
255
250
|
import {
|
|
256
251
|
drop
|
|
257
252
|
} from "./chunk-3EZAFZG3.mjs";
|
|
@@ -266,35 +261,43 @@ import {
|
|
|
266
261
|
} from "./chunk-LJ2C6MVP.mjs";
|
|
267
262
|
import {
|
|
268
263
|
fill
|
|
269
|
-
} from "./chunk-
|
|
264
|
+
} from "./chunk-GTFDDKZ2.mjs";
|
|
265
|
+
import "./chunk-ZA2XI3OV.mjs";
|
|
270
266
|
import {
|
|
271
|
-
|
|
272
|
-
} from "./chunk-
|
|
267
|
+
negate
|
|
268
|
+
} from "./chunk-BOOQBJN2.mjs";
|
|
273
269
|
import {
|
|
274
|
-
|
|
275
|
-
} from "./chunk-
|
|
270
|
+
noop
|
|
271
|
+
} from "./chunk-LKXCOLNY.mjs";
|
|
276
272
|
import {
|
|
277
|
-
|
|
278
|
-
} from "./chunk-
|
|
273
|
+
once
|
|
274
|
+
} from "./chunk-CMBC4MXG.mjs";
|
|
275
|
+
import {
|
|
276
|
+
throttle
|
|
277
|
+
} from "./chunk-QOJGMVVR.mjs";
|
|
279
278
|
import {
|
|
280
279
|
chunk
|
|
281
280
|
} from "./chunk-E6C5EZQA.mjs";
|
|
282
281
|
import {
|
|
283
282
|
compact
|
|
284
|
-
} from "./chunk-
|
|
283
|
+
} from "./chunk-PJPGJ2O6.mjs";
|
|
285
284
|
import {
|
|
286
285
|
countBy
|
|
287
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-Z7HWEOQX.mjs";
|
|
287
|
+
import "./chunk-F47GLYUU.mjs";
|
|
288
288
|
import {
|
|
289
|
-
|
|
290
|
-
} from "./chunk-
|
|
289
|
+
AbortError
|
|
290
|
+
} from "./chunk-DXB7EZUQ.mjs";
|
|
291
291
|
import {
|
|
292
|
-
|
|
293
|
-
} from "./chunk-
|
|
292
|
+
TimeoutError
|
|
293
|
+
} from "./chunk-KIOYQRMQ.mjs";
|
|
294
294
|
import {
|
|
295
|
-
|
|
296
|
-
} from "./chunk-
|
|
297
|
-
import
|
|
295
|
+
after
|
|
296
|
+
} from "./chunk-OGZMEWPR.mjs";
|
|
297
|
+
import {
|
|
298
|
+
debounce
|
|
299
|
+
} from "./chunk-MSHSKENG.mjs";
|
|
300
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
298
301
|
export {
|
|
299
302
|
AbortError,
|
|
300
303
|
TimeoutError,
|
|
@@ -338,6 +341,7 @@ export {
|
|
|
338
341
|
isNotNil,
|
|
339
342
|
isNull,
|
|
340
343
|
isPlainObject,
|
|
344
|
+
isPrimitive,
|
|
341
345
|
isTypedArray,
|
|
342
346
|
isUndefined,
|
|
343
347
|
kebabCase,
|
package/dist/math/clamp.mjs
CHANGED
package/dist/math/inRange.mjs
CHANGED
package/dist/math/index.mjs
CHANGED
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/cloneDeep.js
CHANGED
|
@@ -101,7 +101,7 @@ function cloneDeepHelper(obj, clonedObj) {
|
|
|
101
101
|
for (const key in obj) {
|
|
102
102
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
103
103
|
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
104
|
-
if ((
|
|
104
|
+
if ((descriptor?.writable || descriptor?.set) && typeof descriptor?.value !== "function") {
|
|
105
105
|
clonedObj[key] = cloneDeep(obj[key]);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/object/cloneDeep.ts"],"sourcesContent":["/**\n * Creates a deep clone of the given object.\n *\n * @template T - The type of the object.\n * @param {T} obj - The object to clone.\n * @returns {T} - A deep clone of the given object.\n *\n * @example\n * // Clone a primitive values\n * const num = 29;\n * const clonedNum = clone(num);\n * console.log(clonedNum); // 29\n * console.log(clonedNum === num) ; // true\n *\n * @example\n * // Clone an array\n * const arr = [1, 2, 3];\n * const clonedArr = clone(arr);\n * console.log(clonedArr); // [1, 2, 3]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an array with nested objects\n * const arr = [1, { a: 1 }, [1, 2, 3]];\n * const clonedArr = clone(arr);\n * arr[1].a = 2;\n * console.log(arr); // [2, { a: 2 }, [1, 2, 3]]\n * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an object\n * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };\n * const clonedObj = clone(obj);\n * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }\n * console.log(clonedObj === obj); // false\n *\n * @example\n * // Clone an object with nested objects\n * const obj = { a: 1, b: { c: 1 } };\n * const clonedObj = clone(obj);\n * obj.b.c = 2;\n * console.log(obj); // { a: 1, b: { c: 2 } }\n * console.log(clonedObj); // { a: 1, b: { c: 1 } }\n * console.log(clonedObj === obj); // false\n */\nexport function cloneDeep<T>(obj: T): Resolved<T> {\n if (isPrimitive(obj)) {\n return obj as Resolved<T>;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => cloneDeep(item)) as Resolved<T>;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as Resolved<T>;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as Resolved<T>;\n }\n\n if (obj instanceof Map) {\n const result = new Map();\n for (const [key, value] of obj.entries()) {\n result.set(key, cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof Set) {\n const result = new Set();\n for (const value of obj.values()) {\n result.add(cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (isTypedArray(obj)) {\n const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);\n for (let i = 0; i < obj.length; i++) {\n result[i] = cloneDeep(obj[i]);\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof ArrayBuffer || obj instanceof SharedArrayBuffer) {\n return obj.slice(0) as Resolved<T>;\n }\n\n if (obj instanceof DataView) {\n const result = new DataView(obj.buffer.slice(0));\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n // For legacy NodeJS support\n if (typeof File !== 'undefined' && obj instanceof File) {\n const result = new File([obj], obj.name, { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Blob) {\n const result = new Blob([obj], { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Error) {\n const result = new (obj.constructor as { new (): Error })();\n result.message = obj.message;\n result.name = obj.name;\n result.stack = obj.stack;\n result.cause = obj.cause;\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const result = {};\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'function') {\n return void 0 as Resolved<T>;\n }\n\n return obj as Resolved<T>;\n}\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\nfunction isPrimitive(value: unknown): value is Primitive {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n\n// eslint-disable-next-line\nfunction cloneDeepHelper(obj: any, clonedObj: any): void {\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, key);\n if ((descriptor?.writable || descriptor?.set) && typeof descriptor?.value !== 'function') {\n clonedObj[key] = cloneDeep(obj[key]);\n }\n }\n }\n}\n\nfunction isTypedArray(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n obj: any\n): obj is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n obj instanceof Uint8Array ||\n obj instanceof Uint8ClampedArray ||\n obj instanceof Uint16Array ||\n obj instanceof Uint32Array ||\n obj instanceof BigUint64Array ||\n obj instanceof Int8Array ||\n obj instanceof Int16Array ||\n obj instanceof Int32Array ||\n obj instanceof BigInt64Array ||\n obj instanceof Float32Array ||\n obj instanceof Float64Array\n );\n}\n\nexport type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;\n\ntype Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;\n\ntype ResolvedMain<T> = T extends [never]\n ? never // (special trick for jsonable | null) type\n : ValueOf<T> extends boolean | number | bigint | string\n ? ValueOf<T>\n : T extends (...args: any[]) => any\n ? never\n : T extends object\n ? ResolvedObject<T>\n : ValueOf<T>;\n\ntype ResolvedObject<T extends object> =\n T extends Array<infer U>\n ? IsTuple<T> extends true\n ? ResolvedTuple<T>\n : Array<ResolvedMain<U>>\n : T extends Set<infer U>\n ? Set<ResolvedMain<U>>\n : T extends Map<infer K, infer V>\n ? Map<ResolvedMain<K>, ResolvedMain<V>>\n : T extends WeakSet<any> | WeakMap<any, any>\n ? never\n : T extends\n | Date\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array\n | ArrayBuffer\n | SharedArrayBuffer\n | DataView\n | Blob\n | File\n ? T\n : {\n [P in keyof T]: ResolvedMain<T[P]>;\n };\n\ntype ResolvedTuple<T extends readonly any[]> = T extends []\n ? []\n : T extends [infer F]\n ? [ResolvedMain<F>]\n : T extends [infer F, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]\n : T extends [(infer F)?]\n ? [ResolvedMain<F>?]\n : T extends [(infer F)?, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]\n : [];\n\ntype IsTuple<T extends readonly any[] | { length: number }> = [T] extends [never]\n ? false\n : T extends readonly any[]\n ? number extends T['length']\n ? false\n : true\n : false;\n\ntype ValueOf<Instance> =\n IsValueOf<Instance, boolean> extends true\n ? boolean\n : IsValueOf<Instance, number> extends true\n ? number\n : IsValueOf<Instance, string> extends true\n ? string\n : Instance;\n\ntype IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O\n ? O extends IValueOf<infer Primitive>\n ? Instance extends Primitive\n ? false\n : true // not Primitive, but Object\n : false // cannot be\n : false;\n\ninterface IValueOf<T> {\n valueOf(): T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CO,SAAS,UAAa,KAAqB;AAChD,MAAI,YAAY,GAAG,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,UAAQ,UAAU,IAAI,CAAC;AAAA,EACxC;AAEA,MAAI,eAAe,MAAM;AACvB,WAAO,IAAI,KAAK,IAAI,QAAQ,CAAC;AAAA,EAC/B;AAEA,MAAI,eAAe,QAAQ;AACzB,WAAO,IAAI,OAAO,IAAI,QAAQ,IAAI,KAAK;AAAA,EACzC;AAEA,MAAI,eAAe,KAAK;AACtB,UAAM,SAAS,oBAAI,IAAI;AACvB,eAAW,CAAC,KAAK,KAAK,KAAK,IAAI,QAAQ,GAAG;AACxC,aAAO,IAAI,KAAK,UAAU,KAAK,CAAC;AAAA,IAClC;AACA,WAAO;AAAA,EACT;AAEA,MAAI,eAAe,KAAK;AACtB,UAAM,SAAS,oBAAI,IAAI;AACvB,eAAW,SAAS,IAAI,OAAO,GAAG;AAChC,aAAO,IAAI,UAAU,KAAK,CAAC;AAAA,IAC7B;AACA,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,GAAG,GAAG;AACrB,UAAM,SAAS,KAAK,OAAO,eAAe,GAAG,GAAE,YAAa,IAAI,MAAM;AACtE,aAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,aAAO,CAAC,IAAI,UAAU,IAAI,CAAC,CAAC;AAAA,IAC9B;AACA,WAAO;AAAA,EACT;AAEA,MAAI,eAAe,eAAe,eAAe,mBAAmB;AAClE,WAAO,IAAI,MAAM,CAAC;AAAA,EACpB;AAEA,MAAI,eAAe,UAAU;AAC3B,UAAM,SAAS,IAAI,SAAS,IAAI,OAAO,MAAM,CAAC,CAAC;AAC/C,oBAAgB,KAAK,MAAM;AAC3B,WAAO;AAAA,EACT;AAGA,MAAI,OAAO,SAAS,eAAe,eAAe,MAAM;AACtD,UAAM,SAAS,IAAI,KAAK,CAAC,GAAG,GAAG,IAAI,MAAM,EAAE,MAAM,IAAI,KAAK,CAAC;AAC3D,oBAAgB,KAAK,MAAM;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,eAAe,MAAM;AACvB,UAAM,SAAS,IAAI,KAAK,CAAC,GAAG,GAAG,EAAE,MAAM,IAAI,KAAK,CAAC;AACjD,oBAAgB,KAAK,MAAM;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,eAAe,OAAO;AACxB,UAAM,SAAS,IAAK,IAAI,YAAkC;AAC1D,WAAO,UAAU,IAAI;AACrB,WAAO,OAAO,IAAI;AAClB,WAAO,QAAQ,IAAI;AACnB,WAAO,QAAQ,IAAI;AACnB,oBAAgB,KAAK,MAAM;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;AAC3C,UAAM,SAAS,CAAC;AAChB,oBAAgB,KAAK,MAAM;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,QAAQ,YAAY;AAC7B,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGA,SAAS,YAAY,OAAoC;AACvD,SAAO,SAAS,QAAS,OAAO,UAAU,YAAY,OAAO,UAAU;AACzE;AAGA,SAAS,gBAAgB,KAAU,WAAsB;AACvD,aAAW,OAAO,KAAK;AACrB,QAAI,OAAO,UAAU,eAAe,KAAK,KAAK,GAAG,GAAG;AAClD,YAAM,aAAa,OAAO,yBAAyB,KAAK,GAAG;AAC3D,
|
|
1
|
+
{"version":3,"sources":["../../src/object/cloneDeep.ts"],"sourcesContent":["/**\n * Creates a deep clone of the given object.\n *\n * @template T - The type of the object.\n * @param {T} obj - The object to clone.\n * @returns {T} - A deep clone of the given object.\n *\n * @example\n * // Clone a primitive values\n * const num = 29;\n * const clonedNum = clone(num);\n * console.log(clonedNum); // 29\n * console.log(clonedNum === num) ; // true\n *\n * @example\n * // Clone an array\n * const arr = [1, 2, 3];\n * const clonedArr = clone(arr);\n * console.log(clonedArr); // [1, 2, 3]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an array with nested objects\n * const arr = [1, { a: 1 }, [1, 2, 3]];\n * const clonedArr = clone(arr);\n * arr[1].a = 2;\n * console.log(arr); // [2, { a: 2 }, [1, 2, 3]]\n * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an object\n * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };\n * const clonedObj = clone(obj);\n * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }\n * console.log(clonedObj === obj); // false\n *\n * @example\n * // Clone an object with nested objects\n * const obj = { a: 1, b: { c: 1 } };\n * const clonedObj = clone(obj);\n * obj.b.c = 2;\n * console.log(obj); // { a: 1, b: { c: 2 } }\n * console.log(clonedObj); // { a: 1, b: { c: 1 } }\n * console.log(clonedObj === obj); // false\n */\nexport function cloneDeep<T>(obj: T): Resolved<T> {\n if (isPrimitive(obj)) {\n return obj as Resolved<T>;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => cloneDeep(item)) as Resolved<T>;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as Resolved<T>;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as Resolved<T>;\n }\n\n if (obj instanceof Map) {\n const result = new Map();\n for (const [key, value] of obj.entries()) {\n result.set(key, cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof Set) {\n const result = new Set();\n for (const value of obj.values()) {\n result.add(cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (isTypedArray(obj)) {\n const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);\n for (let i = 0; i < obj.length; i++) {\n result[i] = cloneDeep(obj[i]);\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof ArrayBuffer || obj instanceof SharedArrayBuffer) {\n return obj.slice(0) as Resolved<T>;\n }\n\n if (obj instanceof DataView) {\n const result = new DataView(obj.buffer.slice(0));\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n // For legacy NodeJS support\n if (typeof File !== 'undefined' && obj instanceof File) {\n const result = new File([obj], obj.name, { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Blob) {\n const result = new Blob([obj], { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Error) {\n const result = new (obj.constructor as { new (): Error })();\n result.message = obj.message;\n result.name = obj.name;\n result.stack = obj.stack;\n result.cause = obj.cause;\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const result = {};\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'function') {\n return void 0 as Resolved<T>;\n }\n\n return obj as Resolved<T>;\n}\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\nfunction isPrimitive(value: unknown): value is Primitive {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n\n// eslint-disable-next-line\nfunction cloneDeepHelper(obj: any, clonedObj: any): void {\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, key);\n if ((descriptor?.writable || descriptor?.set) && typeof descriptor?.value !== 'function') {\n clonedObj[key] = cloneDeep(obj[key]);\n }\n }\n }\n}\n\nfunction isTypedArray(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n obj: any\n): obj is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n obj instanceof Uint8Array ||\n obj instanceof Uint8ClampedArray ||\n obj instanceof Uint16Array ||\n obj instanceof Uint32Array ||\n obj instanceof BigUint64Array ||\n obj instanceof Int8Array ||\n obj instanceof Int16Array ||\n obj instanceof Int32Array ||\n obj instanceof BigInt64Array ||\n obj instanceof Float32Array ||\n obj instanceof Float64Array\n );\n}\n\nexport type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;\n\ntype Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;\n\ntype ResolvedMain<T> = T extends [never]\n ? never // (special trick for jsonable | null) type\n : ValueOf<T> extends boolean | number | bigint | string\n ? ValueOf<T>\n : T extends (...args: any[]) => any\n ? never\n : T extends object\n ? ResolvedObject<T>\n : ValueOf<T>;\n\ntype ResolvedObject<T extends object> =\n T extends Array<infer U>\n ? IsTuple<T> extends true\n ? ResolvedTuple<T>\n : Array<ResolvedMain<U>>\n : T extends Set<infer U>\n ? Set<ResolvedMain<U>>\n : T extends Map<infer K, infer V>\n ? Map<ResolvedMain<K>, ResolvedMain<V>>\n : T extends WeakSet<any> | WeakMap<any, any>\n ? never\n : T extends\n | Date\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array\n | ArrayBuffer\n | SharedArrayBuffer\n | DataView\n | Blob\n | File\n ? T\n : {\n [P in keyof T]: ResolvedMain<T[P]>;\n };\n\ntype ResolvedTuple<T extends readonly any[]> = T extends []\n ? []\n : T extends [infer F]\n ? [ResolvedMain<F>]\n : T extends [infer F, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]\n : T extends [(infer F)?]\n ? [ResolvedMain<F>?]\n : T extends [(infer F)?, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]\n : [];\n\ntype IsTuple<T extends readonly any[] | { length: number }> = [T] extends [never]\n ? false\n : T extends readonly any[]\n ? number extends T['length']\n ? false\n : true\n : false;\n\ntype ValueOf<Instance> =\n IsValueOf<Instance, boolean> extends true\n ? boolean\n : IsValueOf<Instance, number> extends true\n ? number\n : IsValueOf<Instance, string> extends true\n ? string\n : Instance;\n\ntype IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O\n ? O extends IValueOf<infer Primitive>\n ? Instance extends Primitive\n ? false\n : true // not Primitive, but Object\n : false // cannot be\n : false;\n\ninterface IValueOf<T> {\n valueOf(): T;\n}\n"],"mappings":"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","names":[]}
|
package/dist/object/index.js
CHANGED
|
@@ -2,21 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
6
|
var __export = (target, all) => {
|
|
21
7
|
for (var name in all)
|
|
22
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -47,7 +33,7 @@ module.exports = __toCommonJS(object_exports);
|
|
|
47
33
|
|
|
48
34
|
// src/object/omit.ts
|
|
49
35
|
function omit(obj, keys) {
|
|
50
|
-
const result =
|
|
36
|
+
const result = { ...obj };
|
|
51
37
|
for (const key of keys) {
|
|
52
38
|
delete result[key];
|
|
53
39
|
}
|
|
@@ -217,7 +203,7 @@ function cloneDeepHelper(obj, clonedObj) {
|
|
|
217
203
|
for (const key in obj) {
|
|
218
204
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
219
205
|
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
220
|
-
if ((
|
|
206
|
+
if ((descriptor?.writable || descriptor?.set) && typeof descriptor?.value !== "function") {
|
|
221
207
|
clonedObj[key] = cloneDeep(obj[key]);
|
|
222
208
|
}
|
|
223
209
|
}
|