es-toolkit 1.6.1-dev.137 → 1.6.1-dev.139
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/compact.d.mts +1 -0
- package/dist/array/compact.d.ts +1 -0
- package/dist/array/compact.js.map +1 -1
- package/dist/array/compact.mjs +1 -1
- package/dist/array/drop.d.mts +1 -0
- package/dist/array/drop.d.ts +1 -0
- package/dist/array/drop.js.map +1 -1
- package/dist/array/drop.mjs +1 -1
- package/dist/array/dropRight.d.mts +1 -0
- package/dist/array/dropRight.d.ts +1 -0
- package/dist/array/dropRight.js.map +1 -1
- package/dist/array/dropRight.mjs +1 -1
- package/dist/array/dropRightWhile.d.mts +1 -0
- package/dist/array/dropRightWhile.d.ts +1 -0
- package/dist/array/dropRightWhile.js.map +1 -1
- package/dist/array/dropRightWhile.mjs +2 -2
- package/dist/array/dropWhile.d.mts +1 -0
- package/dist/array/dropWhile.d.ts +1 -0
- package/dist/array/dropWhile.js.map +1 -1
- package/dist/array/dropWhile.mjs +1 -1
- package/dist/array/fill.d.mts +29 -0
- package/dist/array/fill.d.ts +29 -0
- package/dist/array/fill.js +38 -0
- package/dist/array/fill.js.map +1 -0
- package/dist/array/fill.mjs +8 -0
- package/dist/array/groupBy.d.mts +2 -0
- package/dist/array/groupBy.d.ts +2 -0
- package/dist/array/groupBy.js.map +1 -1
- package/dist/array/groupBy.mjs +1 -1
- package/dist/array/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +12 -0
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +71 -67
- package/dist/array/intersection.d.mts +1 -0
- package/dist/array/intersection.d.ts +1 -0
- package/dist/array/intersection.js.map +1 -1
- package/dist/array/intersection.mjs +1 -1
- package/dist/array/intersectionBy.d.mts +2 -0
- package/dist/array/intersectionBy.d.ts +2 -0
- package/dist/array/intersectionBy.js.map +1 -1
- package/dist/array/intersectionBy.mjs +1 -1
- package/dist/array/intersectionWith.d.mts +1 -0
- package/dist/array/intersectionWith.d.ts +1 -0
- package/dist/array/intersectionWith.js.map +1 -1
- package/dist/array/intersectionWith.mjs +1 -1
- package/dist/array/keyBy.d.mts +2 -0
- package/dist/array/keyBy.d.ts +2 -0
- package/dist/array/keyBy.js.map +1 -1
- package/dist/array/keyBy.mjs +1 -1
- package/dist/array/maxBy.d.mts +1 -0
- package/dist/array/maxBy.d.ts +1 -0
- package/dist/array/maxBy.js.map +1 -1
- package/dist/array/maxBy.mjs +1 -1
- package/dist/array/minBy.d.mts +1 -0
- package/dist/array/minBy.d.ts +1 -0
- package/dist/array/minBy.js.map +1 -1
- package/dist/array/minBy.mjs +1 -1
- package/dist/array/partition.d.mts +1 -0
- package/dist/array/partition.d.ts +1 -0
- package/dist/array/partition.js.map +1 -1
- package/dist/array/partition.mjs +1 -1
- package/dist/array/sample.d.mts +1 -0
- package/dist/array/sample.d.ts +1 -0
- package/dist/array/sample.js.map +1 -1
- package/dist/array/sample.mjs +1 -1
- package/dist/array/sampleSize.d.mts +1 -0
- package/dist/array/sampleSize.d.ts +1 -0
- package/dist/array/sampleSize.js.map +1 -1
- package/dist/array/sampleSize.mjs +3 -3
- package/dist/array/shuffle.d.mts +1 -0
- package/dist/array/shuffle.d.ts +1 -0
- package/dist/array/shuffle.js.map +1 -1
- package/dist/array/shuffle.mjs +1 -1
- package/dist/array/takeRight.d.mts +1 -0
- package/dist/array/takeRight.d.ts +1 -0
- package/dist/array/takeRight.js.map +1 -1
- package/dist/array/takeRight.mjs +1 -1
- package/dist/array/union.d.mts +1 -0
- package/dist/array/union.d.ts +1 -0
- package/dist/array/union.js.map +1 -1
- package/dist/array/union.mjs +2 -2
- package/dist/array/unionBy.d.mts +2 -0
- package/dist/array/unionBy.d.ts +2 -0
- package/dist/array/unionBy.js.map +1 -1
- package/dist/array/unionBy.mjs +1 -1
- package/dist/array/unionWith.d.mts +1 -0
- package/dist/array/unionWith.d.ts +1 -0
- package/dist/array/unionWith.js.map +1 -1
- package/dist/array/unionWith.mjs +2 -2
- package/dist/array/uniq.d.mts +1 -0
- package/dist/array/uniq.d.ts +1 -0
- package/dist/array/uniq.js.map +1 -1
- package/dist/array/uniq.mjs +1 -1
- package/dist/array/uniqBy.d.mts +2 -0
- package/dist/array/uniqBy.d.ts +2 -0
- package/dist/array/uniqBy.js.map +1 -1
- package/dist/array/uniqBy.mjs +1 -1
- package/dist/array/uniqWith.d.mts +1 -0
- package/dist/array/uniqWith.d.ts +1 -0
- package/dist/array/uniqWith.js.map +1 -1
- package/dist/array/uniqWith.mjs +1 -1
- package/dist/array/xor.d.mts +1 -0
- package/dist/array/xor.d.ts +1 -0
- package/dist/array/xor.js.map +1 -1
- package/dist/array/xor.mjs +4 -4
- package/dist/array/xorBy.js.map +1 -1
- package/dist/array/xorBy.mjs +3 -3
- package/dist/array/xorWith.js.map +1 -1
- package/dist/array/xorWith.mjs +4 -4
- package/dist/array/zipObject.d.mts +2 -0
- package/dist/array/zipObject.d.ts +2 -0
- package/dist/array/zipObject.js.map +1 -1
- package/dist/array/zipObject.mjs +1 -1
- package/dist/{chunk-2PFDLYQC.mjs → chunk-237HGSZS.mjs} +1 -1
- package/dist/chunk-237HGSZS.mjs.map +1 -0
- package/dist/chunk-23O4IK6D.mjs +1 -0
- package/dist/chunk-23O4IK6D.mjs.map +1 -0
- package/dist/{chunk-DOOIIHT3.mjs → chunk-2KNLZB7V.mjs} +1 -1
- package/dist/chunk-2KNLZB7V.mjs.map +1 -0
- package/dist/{chunk-OUTSP4VR.mjs → chunk-2ZCITDMK.mjs} +2 -2
- package/dist/chunk-2ZCITDMK.mjs.map +1 -0
- package/dist/{chunk-G42NUGNE.mjs → chunk-3IP4JVLL.mjs} +1 -1
- package/dist/chunk-3IP4JVLL.mjs.map +1 -0
- package/dist/{chunk-MQWVBKUT.mjs → chunk-6CLH5YZ2.mjs} +1 -1
- package/dist/chunk-6CLH5YZ2.mjs.map +1 -0
- package/dist/{chunk-DA7GSKQ5.mjs → chunk-6GWEY5EL.mjs} +1 -1
- package/dist/chunk-6GWEY5EL.mjs.map +1 -0
- package/dist/{chunk-KSXWREB5.mjs → chunk-AJKZMN2V.mjs} +1 -1
- package/dist/chunk-AJKZMN2V.mjs.map +1 -0
- package/dist/{chunk-A67NF2C7.mjs → chunk-BCTYOXT7.mjs} +1 -1
- package/dist/chunk-BCTYOXT7.mjs.map +1 -0
- package/dist/{chunk-ZQNAZPSK.mjs → chunk-BMRTZMRE.mjs} +1 -1
- package/dist/chunk-BMRTZMRE.mjs.map +1 -0
- package/dist/chunk-C4WE4GLC.mjs +14 -0
- package/dist/chunk-C4WE4GLC.mjs.map +1 -0
- package/dist/{chunk-UFAA5WKR.mjs → chunk-CMBC4MXG.mjs} +1 -1
- package/dist/chunk-CMBC4MXG.mjs.map +1 -0
- package/dist/{chunk-JGNFYNYU.mjs → chunk-CXGIXTSH.mjs} +1 -1
- package/dist/chunk-CXGIXTSH.mjs.map +1 -0
- package/dist/{chunk-5L2V7WD3.mjs → chunk-DN3NOZ3H.mjs} +1 -1
- package/dist/chunk-DN3NOZ3H.mjs.map +1 -0
- package/dist/{chunk-NKTBEEIT.mjs → chunk-DTJJIMKJ.mjs} +1 -1
- package/dist/chunk-DTJJIMKJ.mjs.map +1 -0
- package/dist/{chunk-XFCW7XJ4.mjs → chunk-DVK2N4KC.mjs} +1 -1
- package/dist/chunk-DVK2N4KC.mjs.map +1 -0
- package/dist/{chunk-Q5XXJXXQ.mjs → chunk-DXB7EZUQ.mjs} +1 -1
- package/dist/chunk-DXB7EZUQ.mjs.map +1 -0
- package/dist/{chunk-H5YR3ZV4.mjs → chunk-E6E4RZLN.mjs} +1 -1
- package/dist/chunk-E6E4RZLN.mjs.map +1 -0
- package/dist/{chunk-PYLGHB3F.mjs → chunk-FVVSE2F2.mjs} +1 -1
- package/dist/chunk-FVVSE2F2.mjs.map +1 -0
- package/dist/{chunk-DPLJQQFX.mjs → chunk-G7UQ5PUR.mjs} +1 -1
- package/dist/chunk-G7UQ5PUR.mjs.map +1 -0
- package/dist/{chunk-OFWKFUFZ.mjs → chunk-HPFDYUGP.mjs} +1 -1
- package/dist/chunk-HPFDYUGP.mjs.map +1 -0
- package/dist/{chunk-OIHARMNM.mjs → chunk-IJD7FE2Z.mjs} +1 -1
- package/dist/chunk-IJD7FE2Z.mjs.map +1 -0
- package/dist/{chunk-XDKEPIUV.mjs → chunk-IQLKIDXF.mjs} +1 -1
- package/dist/chunk-IQLKIDXF.mjs.map +1 -0
- package/dist/{chunk-GTVOVGGZ.mjs → chunk-JE6JKZU3.mjs} +2 -2
- package/dist/chunk-JE6JKZU3.mjs.map +1 -0
- package/dist/{chunk-Q75KEFW5.mjs → chunk-JEKUA56R.mjs} +1 -1
- package/dist/chunk-JEKUA56R.mjs.map +1 -0
- package/dist/{chunk-VKM3R5T5.mjs → chunk-L7FQX5MN.mjs} +3 -3
- package/dist/chunk-L7FQX5MN.mjs.map +1 -0
- package/dist/{chunk-K2BAFL2T.mjs → chunk-LJ2C6MVP.mjs} +1 -1
- package/dist/chunk-LJ2C6MVP.mjs.map +1 -0
- package/dist/{chunk-4MRXVNGG.mjs → chunk-LUIKU43M.mjs} +1 -1
- package/dist/chunk-LUIKU43M.mjs.map +1 -0
- package/dist/{chunk-NRNKP6JF.mjs → chunk-NFS7RWWE.mjs} +1 -1
- package/dist/chunk-NFS7RWWE.mjs.map +1 -0
- package/dist/{chunk-H2FV6Z5X.mjs → chunk-O64NE2P4.mjs} +2 -2
- package/dist/{chunk-GNSJP2AB.mjs → chunk-O6UXZR3U.mjs} +1 -1
- package/dist/chunk-O6UXZR3U.mjs.map +1 -0
- package/dist/{chunk-FXOABQRO.mjs → chunk-OOKNBU4V.mjs} +1 -1
- package/dist/chunk-OOKNBU4V.mjs.map +1 -0
- package/dist/{chunk-WPDDOUQT.mjs → chunk-OXAZEEGP.mjs} +1 -1
- package/dist/chunk-OXAZEEGP.mjs.map +1 -0
- package/dist/{chunk-E54CCWDL.mjs → chunk-Q47NGNXT.mjs} +3 -3
- package/dist/{chunk-OEOAJOLQ.mjs → chunk-QOJGMVVR.mjs} +1 -1
- package/dist/chunk-QOJGMVVR.mjs.map +1 -0
- package/dist/{chunk-JSS4FXUD.mjs → chunk-QRSJBBFY.mjs} +3 -3
- package/dist/{chunk-PLTO44KM.mjs → chunk-QZITBKWX.mjs} +1 -1
- package/dist/chunk-QZITBKWX.mjs.map +1 -0
- package/dist/{chunk-UPJXHWSJ.mjs → chunk-R6QA7PLZ.mjs} +2 -2
- package/dist/chunk-R6QA7PLZ.mjs.map +1 -0
- package/dist/{chunk-ACFP3XMB.mjs → chunk-S3CORED5.mjs} +1 -1
- package/dist/chunk-S3CORED5.mjs.map +1 -0
- package/dist/{chunk-2EFS3VA3.mjs → chunk-XI7KRD2C.mjs} +1 -1
- package/dist/chunk-XI7KRD2C.mjs.map +1 -0
- package/dist/error/AbortError.d.mts +1 -1
- package/dist/error/AbortError.d.ts +1 -1
- package/dist/error/AbortError.js.map +1 -1
- package/dist/error/AbortError.mjs +1 -1
- package/dist/error/index.js.map +1 -1
- package/dist/error/index.mjs +1 -1
- package/dist/function/debounce.d.mts +1 -0
- package/dist/function/debounce.d.ts +1 -0
- package/dist/function/debounce.js.map +1 -1
- package/dist/function/debounce.mjs +1 -1
- package/dist/function/index.js.map +1 -1
- package/dist/function/index.mjs +3 -3
- package/dist/function/once.d.mts +1 -0
- package/dist/function/once.d.ts +1 -0
- package/dist/function/once.js.map +1 -1
- package/dist/function/once.mjs +1 -1
- package/dist/function/throttle.d.mts +1 -0
- package/dist/function/throttle.d.ts +1 -0
- package/dist/function/throttle.js.map +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 +12 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -102
- package/dist/math/index.js.map +1 -1
- package/dist/math/index.mjs +6 -6
- package/dist/math/meanBy.d.mts +1 -0
- package/dist/math/meanBy.d.ts +1 -0
- package/dist/math/meanBy.js.map +1 -1
- package/dist/math/meanBy.mjs +1 -1
- package/dist/object/index.js.map +1 -1
- package/dist/object/index.mjs +6 -6
- package/dist/object/omit.d.mts +2 -0
- package/dist/object/omit.d.ts +2 -0
- package/dist/object/omit.js.map +1 -1
- package/dist/object/omit.mjs +1 -1
- package/dist/object/omitBy.d.mts +1 -0
- package/dist/object/omitBy.d.ts +1 -0
- package/dist/object/omitBy.js.map +1 -1
- package/dist/object/omitBy.mjs +1 -1
- package/dist/object/pick.d.mts +2 -0
- package/dist/object/pick.d.ts +2 -0
- package/dist/object/pick.js.map +1 -1
- package/dist/object/pick.mjs +1 -1
- package/dist/object/pickBy.d.mts +1 -0
- package/dist/object/pickBy.d.ts +1 -0
- package/dist/object/pickBy.js.map +1 -1
- package/dist/object/pickBy.mjs +1 -1
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +4 -4
- package/dist/predicate/isNotNil.d.mts +1 -0
- package/dist/predicate/isNotNil.d.ts +1 -0
- package/dist/predicate/isNotNil.js.map +1 -1
- package/dist/predicate/isNotNil.mjs +1 -1
- package/dist/promise/delay.js.map +1 -1
- package/dist/promise/delay.mjs +2 -2
- package/dist/promise/index.js.map +1 -1
- package/dist/promise/index.mjs +2 -2
- package/package.json +2 -1
- package/dist/chunk-2EFS3VA3.mjs.map +0 -1
- package/dist/chunk-2PFDLYQC.mjs.map +0 -1
- package/dist/chunk-4MRXVNGG.mjs.map +0 -1
- package/dist/chunk-5L2V7WD3.mjs.map +0 -1
- package/dist/chunk-A67NF2C7.mjs.map +0 -1
- package/dist/chunk-ACFP3XMB.mjs.map +0 -1
- package/dist/chunk-D735JOLS.mjs +0 -1
- package/dist/chunk-DA7GSKQ5.mjs.map +0 -1
- package/dist/chunk-DOOIIHT3.mjs.map +0 -1
- package/dist/chunk-DPLJQQFX.mjs.map +0 -1
- package/dist/chunk-FXOABQRO.mjs.map +0 -1
- package/dist/chunk-G42NUGNE.mjs.map +0 -1
- package/dist/chunk-GNSJP2AB.mjs.map +0 -1
- package/dist/chunk-GTVOVGGZ.mjs.map +0 -1
- package/dist/chunk-H5YR3ZV4.mjs.map +0 -1
- package/dist/chunk-JGNFYNYU.mjs.map +0 -1
- package/dist/chunk-K2BAFL2T.mjs.map +0 -1
- package/dist/chunk-KSXWREB5.mjs.map +0 -1
- package/dist/chunk-MQWVBKUT.mjs.map +0 -1
- package/dist/chunk-NKTBEEIT.mjs.map +0 -1
- package/dist/chunk-NRNKP6JF.mjs.map +0 -1
- package/dist/chunk-OEOAJOLQ.mjs.map +0 -1
- package/dist/chunk-OFWKFUFZ.mjs.map +0 -1
- package/dist/chunk-OIHARMNM.mjs.map +0 -1
- package/dist/chunk-OUTSP4VR.mjs.map +0 -1
- package/dist/chunk-PLTO44KM.mjs.map +0 -1
- package/dist/chunk-PYLGHB3F.mjs.map +0 -1
- package/dist/chunk-Q5XXJXXQ.mjs.map +0 -1
- package/dist/chunk-Q75KEFW5.mjs.map +0 -1
- package/dist/chunk-UFAA5WKR.mjs.map +0 -1
- package/dist/chunk-UPJXHWSJ.mjs.map +0 -1
- package/dist/chunk-VKM3R5T5.mjs.map +0 -1
- package/dist/chunk-WPDDOUQT.mjs.map +0 -1
- package/dist/chunk-XDKEPIUV.mjs.map +0 -1
- package/dist/chunk-XFCW7XJ4.mjs.map +0 -1
- package/dist/chunk-ZQNAZPSK.mjs.map +0 -1
- /package/dist/{chunk-D735JOLS.mjs.map → array/fill.mjs.map} +0 -0
- /package/dist/{chunk-H2FV6Z5X.mjs.map → chunk-O64NE2P4.mjs.map} +0 -0
- /package/dist/{chunk-E54CCWDL.mjs.map → chunk-Q47NGNXT.mjs.map} +0 -0
- /package/dist/{chunk-JSS4FXUD.mjs.map → chunk-QRSJBBFY.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,184 +1,187 @@
|
|
|
1
1
|
import "./chunk-ARZ5BDR6.mjs";
|
|
2
2
|
import {
|
|
3
3
|
delay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O64NE2P4.mjs";
|
|
5
5
|
import "./chunk-MAJSPFA6.mjs";
|
|
6
|
+
import {
|
|
7
|
+
isUndefined
|
|
8
|
+
} from "./chunk-VH2PV426.mjs";
|
|
6
9
|
import {
|
|
7
10
|
isNil
|
|
8
11
|
} from "./chunk-OHQAR5AU.mjs";
|
|
9
12
|
import {
|
|
10
13
|
isNotNil
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BMRTZMRE.mjs";
|
|
12
15
|
import {
|
|
13
16
|
isNull
|
|
14
17
|
} from "./chunk-AIRSKN47.mjs";
|
|
18
|
+
import "./chunk-N6EM6ETS.mjs";
|
|
15
19
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-T5JCRGXA.mjs";
|
|
20
|
+
debounce
|
|
21
|
+
} from "./chunk-3IP4JVLL.mjs";
|
|
19
22
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
noop
|
|
24
|
+
} from "./chunk-LKXCOLNY.mjs";
|
|
22
25
|
import {
|
|
23
|
-
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
once
|
|
27
|
+
} from "./chunk-CMBC4MXG.mjs";
|
|
25
28
|
import {
|
|
26
|
-
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
throttle
|
|
30
|
+
} from "./chunk-QOJGMVVR.mjs";
|
|
31
|
+
import "./chunk-T5JCRGXA.mjs";
|
|
28
32
|
import {
|
|
29
33
|
omit
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-D735JOLS.mjs";
|
|
34
|
+
} from "./chunk-QZITBKWX.mjs";
|
|
32
35
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
omitBy
|
|
37
|
+
} from "./chunk-BCTYOXT7.mjs";
|
|
35
38
|
import {
|
|
36
|
-
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
pick
|
|
40
|
+
} from "./chunk-HPFDYUGP.mjs";
|
|
38
41
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./chunk-
|
|
42
|
+
pickBy
|
|
43
|
+
} from "./chunk-6CLH5YZ2.mjs";
|
|
44
|
+
import "./chunk-23O4IK6D.mjs";
|
|
41
45
|
import {
|
|
42
46
|
zipObject
|
|
43
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-6GWEY5EL.mjs";
|
|
44
48
|
import {
|
|
45
49
|
zipWith
|
|
46
50
|
} from "./chunk-4KYXHZ4R.mjs";
|
|
47
|
-
import {
|
|
48
|
-
takeWhile
|
|
49
|
-
} from "./chunk-2IXFGSUA.mjs";
|
|
50
|
-
import {
|
|
51
|
-
unionBy
|
|
52
|
-
} from "./chunk-NRNKP6JF.mjs";
|
|
53
|
-
import {
|
|
54
|
-
unionWith
|
|
55
|
-
} from "./chunk-OUTSP4VR.mjs";
|
|
56
51
|
import {
|
|
57
52
|
uniqBy
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import {
|
|
60
|
-
uniqWith
|
|
61
|
-
} from "./chunk-2PFDLYQC.mjs";
|
|
53
|
+
} from "./chunk-OXAZEEGP.mjs";
|
|
62
54
|
import {
|
|
63
55
|
xor
|
|
64
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-L7FQX5MN.mjs";
|
|
65
57
|
import {
|
|
66
|
-
|
|
67
|
-
} from "./chunk-
|
|
58
|
+
xorBy
|
|
59
|
+
} from "./chunk-Q47NGNXT.mjs";
|
|
68
60
|
import {
|
|
69
|
-
|
|
70
|
-
} from "./chunk-
|
|
61
|
+
xorWith
|
|
62
|
+
} from "./chunk-QRSJBBFY.mjs";
|
|
71
63
|
import {
|
|
72
|
-
|
|
73
|
-
} from "./chunk-
|
|
64
|
+
unionWith
|
|
65
|
+
} from "./chunk-2ZCITDMK.mjs";
|
|
74
66
|
import {
|
|
75
|
-
|
|
76
|
-
} from "./chunk-
|
|
67
|
+
uniqWith
|
|
68
|
+
} from "./chunk-237HGSZS.mjs";
|
|
77
69
|
import {
|
|
78
|
-
|
|
79
|
-
} from "./chunk-
|
|
70
|
+
zip
|
|
71
|
+
} from "./chunk-IDCUZVJL.mjs";
|
|
80
72
|
import {
|
|
81
73
|
sampleSize
|
|
82
|
-
} from "./chunk-
|
|
83
|
-
import "./chunk-TZE6EDCX.mjs";
|
|
84
|
-
import {
|
|
85
|
-
meanBy
|
|
86
|
-
} from "./chunk-JGNFYNYU.mjs";
|
|
87
|
-
import {
|
|
88
|
-
randomInt
|
|
89
|
-
} from "./chunk-GIWAOOFY.mjs";
|
|
90
|
-
import {
|
|
91
|
-
random
|
|
92
|
-
} from "./chunk-SYWMYQYJ.mjs";
|
|
93
|
-
import {
|
|
94
|
-
range
|
|
95
|
-
} from "./chunk-UNLX2F2Y.mjs";
|
|
96
|
-
import {
|
|
97
|
-
round
|
|
98
|
-
} from "./chunk-5PMKOZ2F.mjs";
|
|
99
|
-
import {
|
|
100
|
-
clamp
|
|
101
|
-
} from "./chunk-MLCL773E.mjs";
|
|
102
|
-
import {
|
|
103
|
-
mean
|
|
104
|
-
} from "./chunk-LT6E4Y4Z.mjs";
|
|
105
|
-
import {
|
|
106
|
-
sum
|
|
107
|
-
} from "./chunk-NOFHNJ5C.mjs";
|
|
74
|
+
} from "./chunk-LUIKU43M.mjs";
|
|
108
75
|
import {
|
|
109
76
|
shuffle
|
|
110
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-G7UQ5PUR.mjs";
|
|
111
78
|
import {
|
|
112
79
|
take
|
|
113
80
|
} from "./chunk-ME352XO7.mjs";
|
|
114
81
|
import {
|
|
115
82
|
takeRight
|
|
116
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-IQLKIDXF.mjs";
|
|
117
84
|
import {
|
|
118
85
|
takeRightWhile
|
|
119
86
|
} from "./chunk-NTLX2MPV.mjs";
|
|
120
87
|
import {
|
|
121
|
-
|
|
122
|
-
} from "./chunk-
|
|
88
|
+
takeWhile
|
|
89
|
+
} from "./chunk-2IXFGSUA.mjs";
|
|
90
|
+
import {
|
|
91
|
+
union
|
|
92
|
+
} from "./chunk-R6QA7PLZ.mjs";
|
|
93
|
+
import {
|
|
94
|
+
uniq
|
|
95
|
+
} from "./chunk-DVK2N4KC.mjs";
|
|
96
|
+
import {
|
|
97
|
+
unionBy
|
|
98
|
+
} from "./chunk-NFS7RWWE.mjs";
|
|
123
99
|
import {
|
|
124
100
|
intersection
|
|
125
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-FVVSE2F2.mjs";
|
|
126
102
|
import {
|
|
127
103
|
intersectionBy
|
|
128
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-O6UXZR3U.mjs";
|
|
129
105
|
import {
|
|
130
106
|
intersectionWith
|
|
131
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-XI7KRD2C.mjs";
|
|
132
108
|
import {
|
|
133
109
|
keyBy
|
|
134
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-AJKZMN2V.mjs";
|
|
135
111
|
import {
|
|
136
112
|
maxBy
|
|
137
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-OOKNBU4V.mjs";
|
|
138
114
|
import {
|
|
139
|
-
|
|
140
|
-
} from "./chunk-
|
|
141
|
-
import {
|
|
142
|
-
compact
|
|
143
|
-
} from "./chunk-NKTBEEIT.mjs";
|
|
115
|
+
minBy
|
|
116
|
+
} from "./chunk-IJD7FE2Z.mjs";
|
|
144
117
|
import {
|
|
145
|
-
|
|
146
|
-
} from "./chunk-
|
|
118
|
+
partition
|
|
119
|
+
} from "./chunk-DN3NOZ3H.mjs";
|
|
147
120
|
import {
|
|
148
|
-
|
|
149
|
-
} from "./chunk-
|
|
121
|
+
sample
|
|
122
|
+
} from "./chunk-2KNLZB7V.mjs";
|
|
150
123
|
import {
|
|
151
124
|
differenceWith
|
|
152
125
|
} from "./chunk-6NVQAHXP.mjs";
|
|
153
126
|
import {
|
|
154
127
|
drop
|
|
155
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-S3CORED5.mjs";
|
|
156
129
|
import {
|
|
157
130
|
dropRight
|
|
158
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-JEKUA56R.mjs";
|
|
159
132
|
import {
|
|
160
133
|
dropRightWhile
|
|
161
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-JE6JKZU3.mjs";
|
|
162
135
|
import {
|
|
163
136
|
dropWhile
|
|
164
|
-
} from "./chunk-
|
|
165
|
-
import "./chunk-N6EM6ETS.mjs";
|
|
137
|
+
} from "./chunk-LJ2C6MVP.mjs";
|
|
166
138
|
import {
|
|
167
|
-
|
|
168
|
-
} from "./chunk-
|
|
139
|
+
fill
|
|
140
|
+
} from "./chunk-C4WE4GLC.mjs";
|
|
169
141
|
import {
|
|
170
|
-
|
|
171
|
-
} from "./chunk-
|
|
142
|
+
groupBy
|
|
143
|
+
} from "./chunk-E6E4RZLN.mjs";
|
|
172
144
|
import {
|
|
173
|
-
|
|
174
|
-
} from "./chunk-
|
|
145
|
+
chunk
|
|
146
|
+
} from "./chunk-E6C5EZQA.mjs";
|
|
175
147
|
import {
|
|
176
|
-
|
|
177
|
-
} from "./chunk-
|
|
148
|
+
compact
|
|
149
|
+
} from "./chunk-DTJJIMKJ.mjs";
|
|
150
|
+
import {
|
|
151
|
+
difference
|
|
152
|
+
} from "./chunk-JPUKH67K.mjs";
|
|
153
|
+
import {
|
|
154
|
+
differenceBy
|
|
155
|
+
} from "./chunk-LVWX5B43.mjs";
|
|
178
156
|
import "./chunk-FZEZH22H.mjs";
|
|
179
157
|
import {
|
|
180
158
|
AbortError
|
|
181
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-DXB7EZUQ.mjs";
|
|
160
|
+
import "./chunk-TZE6EDCX.mjs";
|
|
161
|
+
import {
|
|
162
|
+
randomInt
|
|
163
|
+
} from "./chunk-GIWAOOFY.mjs";
|
|
164
|
+
import {
|
|
165
|
+
range
|
|
166
|
+
} from "./chunk-UNLX2F2Y.mjs";
|
|
167
|
+
import {
|
|
168
|
+
round
|
|
169
|
+
} from "./chunk-5PMKOZ2F.mjs";
|
|
170
|
+
import {
|
|
171
|
+
clamp
|
|
172
|
+
} from "./chunk-MLCL773E.mjs";
|
|
173
|
+
import {
|
|
174
|
+
meanBy
|
|
175
|
+
} from "./chunk-CXGIXTSH.mjs";
|
|
176
|
+
import {
|
|
177
|
+
mean
|
|
178
|
+
} from "./chunk-LT6E4Y4Z.mjs";
|
|
179
|
+
import {
|
|
180
|
+
sum
|
|
181
|
+
} from "./chunk-NOFHNJ5C.mjs";
|
|
182
|
+
import {
|
|
183
|
+
random
|
|
184
|
+
} from "./chunk-SYWMYQYJ.mjs";
|
|
182
185
|
import "./chunk-2MM5EJJX.mjs";
|
|
183
186
|
export {
|
|
184
187
|
AbortError,
|
|
@@ -194,6 +197,7 @@ export {
|
|
|
194
197
|
dropRight,
|
|
195
198
|
dropRightWhile,
|
|
196
199
|
dropWhile,
|
|
200
|
+
fill,
|
|
197
201
|
groupBy,
|
|
198
202
|
intersection,
|
|
199
203
|
intersectionBy,
|
package/dist/math/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/math/index.ts","../../src/math/clamp.ts","../../src/math/sum.ts","../../src/math/mean.ts","../../src/math/meanBy.ts","../../src/math/random.ts","../../src/math/randomInt.ts","../../src/math/round.ts","../../src/math/range.ts"],"sourcesContent":["export { clamp } from './clamp.ts';\nexport { mean } from './mean.ts';\nexport { meanBy } from './meanBy.ts';\nexport { random } from './random.ts';\nexport { randomInt } from './randomInt.ts';\nexport { round } from './round.ts';\nexport { sum } from './sum.ts';\nexport { range } from './range.ts';\n","/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","import { mean } from './mean';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\
|
|
1
|
+
{"version":3,"sources":["../../src/math/index.ts","../../src/math/clamp.ts","../../src/math/sum.ts","../../src/math/mean.ts","../../src/math/meanBy.ts","../../src/math/random.ts","../../src/math/randomInt.ts","../../src/math/round.ts","../../src/math/range.ts"],"sourcesContent":["export { clamp } from './clamp.ts';\nexport { mean } from './mean.ts';\nexport { meanBy } from './meanBy.ts';\nexport { random } from './random.ts';\nexport { randomInt } from './randomInt.ts';\nexport { round } from './round.ts';\nexport { sum } from './sum.ts';\nexport { range } from './range.ts';\n","/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","import { mean } from './mean';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Generate a random number within the given range.\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result1 = random(0, 5); // Returns a random number between 0 and 5.\n * const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown\n * const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.\n */\nexport function random(maximum: number): number;\nexport function random(minimum: number, maximum: number): number;\nexport function random(minimum: number, maximum?: number): number {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n","import { random } from './random.ts';\n\n/**\n * Generates a random integer between minimum (inclusive) and maximum (exclusive).\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)\n * const result2 = randomInt(5, 0); // This will throw an error\n */\nexport function randomInt(maximum: number): number;\nexport function randomInt(minimum: number, maximum: number): number;\nexport function randomInt(minimum: number, maximum?: number): number {\n return Math.floor(random(minimum, maximum!));\n}\n","/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n","/**\n * Returns an array of numbers from `start` to `end`, incrementing by `step`.\n *\n * If `step` is not provided, it defaults to `1` for an\n * ascending range and `-1` for a descending range.\n *\n * @param {number} start - The starting number of the range.\n * @param {number} [end] - The end number of the range.\n * @param {number} [step] - The step value for the range.\n * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.\n *\n * @example\n * // Returns [0, 1, 2, 3]\n * range(4);\n *\n * @example\n * // Returns [0, 5, 10, 15]\n * range(0, 20, 5);\n *\n * @example\n * // Returns []\n * range(0, -4, -1);\n *\n * @example\n * // Throws an error: The step value must be a non-zero integer.\n * range(1, 4, 0);\n */\nexport function range(end: number): number[];\nexport function range(start: number, end: number): number[];\nexport function range(start: number, end: number, step: number): number[];\nexport function range(start: number, end?: number, step?: number): number[] {\n if (end == null) {\n end = start;\n start = 0;\n }\n\n if (step == null) {\n step = 1;\n }\n\n if (!Number.isInteger(step) || step === 0) {\n throw new Error(`The step value must be a non-zero integer.`);\n }\n\n const length = Math.max(Math.ceil((end - start) / step), 0);\n const result = new Array(length);\n\n for (let i = 0; i < length; i++) {\n result[i] = start + i * step;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,SAAS,MAAM,OAAe,QAAgB,QAAyB;AAC5E,MAAI,UAAU,MAAM;AAClB,WAAO,KAAK,IAAI,OAAO,MAAM;AAAA,EAC/B;AAEA,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,MAAM,GAAG,MAAM;AACjD;;;ACZO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;ACAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;;;ACJO,SAAS,OAAO,SAAiB,SAA0B;AAChE,MAAI,WAAW,MAAM;AACnB,cAAU;AACV,cAAU;AAAA,EACZ;AAEA,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AAEA,SAAO,KAAK,OAAO,KAAK,UAAU,WAAW;AAC/C;;;ACVO,SAAS,UAAU,SAAiB,SAA0B;AACnE,SAAO,KAAK,MAAM,OAAO,SAAS,OAAQ,CAAC;AAC7C;;;ACHO,SAAS,MAAM,OAAe,YAAY,GAAW;AAC1D,MAAI,CAAC,OAAO,UAAU,SAAS,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;;;ACOO,SAAS,MAAM,OAAe,KAAc,MAAyB;AAC1E,MAAI,OAAO,MAAM;AACf,UAAM;AACN,YAAQ;AAAA,EACV;AAEA,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,SAAS,GAAG;AACzC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,SAAS,KAAK,IAAI,KAAK,MAAM,MAAM,SAAS,IAAI,GAAG,CAAC;AAC1D,QAAM,SAAS,IAAI,MAAM,MAAM;AAE/B,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,WAAO,CAAC,IAAI,QAAQ,IAAI;AAAA,EAC1B;AAEA,SAAO;AACT;","names":[]}
|
package/dist/math/index.mjs
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import "../chunk-TZE6EDCX.mjs";
|
|
2
|
-
import {
|
|
3
|
-
meanBy
|
|
4
|
-
} from "../chunk-JGNFYNYU.mjs";
|
|
5
2
|
import {
|
|
6
3
|
randomInt
|
|
7
4
|
} from "../chunk-GIWAOOFY.mjs";
|
|
8
|
-
import {
|
|
9
|
-
random
|
|
10
|
-
} from "../chunk-SYWMYQYJ.mjs";
|
|
11
5
|
import {
|
|
12
6
|
range
|
|
13
7
|
} from "../chunk-UNLX2F2Y.mjs";
|
|
@@ -17,12 +11,18 @@ import {
|
|
|
17
11
|
import {
|
|
18
12
|
clamp
|
|
19
13
|
} from "../chunk-MLCL773E.mjs";
|
|
14
|
+
import {
|
|
15
|
+
meanBy
|
|
16
|
+
} from "../chunk-CXGIXTSH.mjs";
|
|
20
17
|
import {
|
|
21
18
|
mean
|
|
22
19
|
} from "../chunk-LT6E4Y4Z.mjs";
|
|
23
20
|
import {
|
|
24
21
|
sum
|
|
25
22
|
} from "../chunk-NOFHNJ5C.mjs";
|
|
23
|
+
import {
|
|
24
|
+
random
|
|
25
|
+
} from "../chunk-SYWMYQYJ.mjs";
|
|
26
26
|
import "../chunk-2MM5EJJX.mjs";
|
|
27
27
|
export {
|
|
28
28
|
clamp,
|
package/dist/math/meanBy.d.mts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* If the array is empty, this function returns `NaN`.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of elements in the array.
|
|
7
8
|
* @param {T[]} items An array to calculate the average.
|
|
8
9
|
* @param {(element: T) => number} getValue A function that selects a numeric value from each element.
|
|
9
10
|
* @returns {number} The average of all the numbers as determined by the `getValue` function.
|
package/dist/math/meanBy.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* If the array is empty, this function returns `NaN`.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of elements in the array.
|
|
7
8
|
* @param {T[]} items An array to calculate the average.
|
|
8
9
|
* @param {(element: T) => number} getValue A function that selects a numeric value from each element.
|
|
9
10
|
* @returns {number} The average of all the numbers as determined by the `getValue` function.
|
package/dist/math/meanBy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/math/meanBy.ts","../../src/math/sum.ts","../../src/math/mean.ts"],"sourcesContent":["import { mean } from './mean';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\
|
|
1
|
+
{"version":3,"sources":["../../src/math/meanBy.ts","../../src/math/sum.ts","../../src/math/mean.ts"],"sourcesContent":["import { mean } from './mean';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;AFAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;","names":[]}
|
package/dist/math/meanBy.mjs
CHANGED
package/dist/object/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/object/index.ts","../../src/object/omit.ts","../../src/object/omitBy.ts","../../src/object/pick.ts","../../src/object/pickBy.ts"],"sourcesContent":["export { omit } from './omit.ts';\nexport { omitBy } from './omitBy.ts';\nexport { pick } from './pick.ts';\nexport { pickBy } from './pickBy.ts';\n","/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n","/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;
|
|
1
|
+
{"version":3,"sources":["../../src/object/index.ts","../../src/object/omit.ts","../../src/object/omitBy.ts","../../src/object/pick.ts","../../src/object/pickBy.ts"],"sourcesContent":["export { omit } from './omit.ts';\nexport { omitBy } from './omitBy.ts';\nexport { pick } from './pick.ts';\nexport { pickBy } from './pickBy.ts';\n","/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n","/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,mBAAK;AAEpB,aAAW,OAAO,MAAM;AACtB,WAAO,OAAO,GAAG;AAAA,EACnB;AAEA,SAAO;AACT;;;ACNO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,WAAW,OAAO,GAAG,GAAG;AAC1B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;;;ACjBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,CAAC;AAEhB,aAAW,OAAO,MAAM;AACtB,WAAO,GAAG,IAAI,IAAI,GAAG;AAAA,EACvB;AAEA,SAAO;AACT;;;ACNO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,CAAC,WAAW,OAAO,GAAG,GAAG;AAC3B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
|
package/dist/object/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "../chunk-T5JCRGXA.mjs";
|
|
2
|
+
import {
|
|
3
|
+
omit
|
|
4
|
+
} from "../chunk-QZITBKWX.mjs";
|
|
2
5
|
import {
|
|
3
6
|
omitBy
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BCTYOXT7.mjs";
|
|
5
8
|
import {
|
|
6
9
|
pick
|
|
7
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-HPFDYUGP.mjs";
|
|
8
11
|
import {
|
|
9
12
|
pickBy
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import {
|
|
12
|
-
omit
|
|
13
|
-
} from "../chunk-PLTO44KM.mjs";
|
|
13
|
+
} from "../chunk-6CLH5YZ2.mjs";
|
|
14
14
|
import "../chunk-2MM5EJJX.mjs";
|
|
15
15
|
export {
|
|
16
16
|
omit,
|
package/dist/object/omit.d.mts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* This function takes an object and an array of keys, and returns a new object that
|
|
5
5
|
* excludes the properties corresponding to the specified keys.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
8
|
+
* @template K - The type of keys in object.
|
|
7
9
|
* @param {T} obj - The object to omit keys from.
|
|
8
10
|
* @param {K[]} keys - An array of keys to be omitted from the object.
|
|
9
11
|
* @returns {Omit<T, K>} A new object with the specified keys omitted.
|
package/dist/object/omit.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* This function takes an object and an array of keys, and returns a new object that
|
|
5
5
|
* excludes the properties corresponding to the specified keys.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
8
|
+
* @template K - The type of keys in object.
|
|
7
9
|
* @param {T} obj - The object to omit keys from.
|
|
8
10
|
* @param {K[]} keys - An array of keys to be omitted from the object.
|
|
9
11
|
* @returns {Omit<T, K>} A new object with the specified keys omitted.
|
package/dist/object/omit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/object/omit.ts"],"sourcesContent":["/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/object/omit.ts"],"sourcesContent":["/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,mBAAK;AAEpB,aAAW,OAAO,MAAM;AACtB,WAAO,OAAO,GAAG;AAAA,EACnB;AAEA,SAAO;AACT;","names":[]}
|
package/dist/object/omit.mjs
CHANGED
package/dist/object/omitBy.d.mts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This function takes an object and a predicate function, and returns a new object that
|
|
5
5
|
* includes only the properties for which the predicate function returns false.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
7
8
|
* @param {T} obj - The object to omit properties from.
|
|
8
9
|
* @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines
|
|
9
10
|
* whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
|
package/dist/object/omitBy.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This function takes an object and a predicate function, and returns a new object that
|
|
5
5
|
* includes only the properties for which the predicate function returns false.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
7
8
|
* @param {T} obj - The object to omit properties from.
|
|
8
9
|
* @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines
|
|
9
10
|
* whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/object/omitBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/object/omitBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,WAAW,OAAO,GAAG,GAAG;AAC1B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
|
package/dist/object/omitBy.mjs
CHANGED
package/dist/object/pick.d.mts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* This function takes an object and an array of keys, and returns a new object that
|
|
5
5
|
* includes only the properties corresponding to the specified keys.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
8
|
+
* @template K - The type of keys in object.
|
|
7
9
|
* @param {T} obj - The object to pick keys from.
|
|
8
10
|
* @param {K[]} keys - An array of keys to be picked from the object.
|
|
9
11
|
* @returns {Pick<T, K>} A new object with the specified keys picked.
|
package/dist/object/pick.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* This function takes an object and an array of keys, and returns a new object that
|
|
5
5
|
* includes only the properties corresponding to the specified keys.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
8
|
+
* @template K - The type of keys in object.
|
|
7
9
|
* @param {T} obj - The object to pick keys from.
|
|
8
10
|
* @param {K[]} keys - An array of keys to be picked from the object.
|
|
9
11
|
* @returns {Pick<T, K>} A new object with the specified keys picked.
|
package/dist/object/pick.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/object/pick.ts"],"sourcesContent":["/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/object/pick.ts"],"sourcesContent":["/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,CAAC;AAEhB,aAAW,OAAO,MAAM;AACtB,WAAO,GAAG,IAAI,IAAI,GAAG;AAAA,EACvB;AAEA,SAAO;AACT;","names":[]}
|
package/dist/object/pick.mjs
CHANGED
package/dist/object/pickBy.d.mts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This function takes an object and a predicate function, and returns a new object that
|
|
5
5
|
* includes only the properties for which the predicate function returns true.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
7
8
|
* @param {T} obj - The object to pick properties from.
|
|
8
9
|
* @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines
|
|
9
10
|
* whether a property should be picked. It takes the property's key and value as arguments and returns `true`
|
package/dist/object/pickBy.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This function takes an object and a predicate function, and returns a new object that
|
|
5
5
|
* includes only the properties for which the predicate function returns true.
|
|
6
6
|
*
|
|
7
|
+
* @template T - The type of object.
|
|
7
8
|
* @param {T} obj - The object to pick properties from.
|
|
8
9
|
* @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines
|
|
9
10
|
* whether a property should be picked. It takes the property's key and value as arguments and returns `true`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/object/pickBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/object/pickBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,CAAC,WAAW,OAAO,GAAG,GAAG;AAC3B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
|