es-toolkit 1.0.3-dev.37 → 1.0.3
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.d.ts +1 -3
- package/dist/array/chunk.spec.d.ts +1 -0
- package/dist/array/difference.d.ts +1 -3
- package/dist/array/difference.spec.d.ts +1 -0
- package/dist/array/differenceBy.d.ts +1 -3
- package/dist/array/differenceBy.spec.d.ts +1 -0
- package/dist/array/differenceWith.d.ts +1 -3
- package/dist/array/differenceWith.spec.d.ts +1 -0
- package/dist/array/drop.d.ts +1 -3
- package/dist/array/drop.spec.d.ts +1 -0
- package/dist/array/dropRight.d.ts +1 -3
- package/dist/array/dropRight.spec.d.ts +1 -0
- package/dist/array/dropRightWhile.d.ts +1 -3
- package/dist/array/dropRightWhile.spec.d.ts +1 -0
- package/dist/array/dropWhile.d.ts +1 -3
- package/dist/array/dropWhile.spec.d.ts +1 -0
- package/dist/array/groupBy.d.ts +1 -3
- package/dist/array/groupBy.spec.d.ts +1 -0
- package/dist/array/index.d.ts +30 -30
- package/dist/array/index.js +842 -199
- package/dist/array/intersection.d.ts +1 -3
- package/dist/array/intersection.spec.d.ts +1 -0
- package/dist/array/intersectionBy.d.ts +1 -3
- package/dist/array/intersectionBy.spec.d.ts +1 -0
- package/dist/array/intersectionWith.d.ts +1 -3
- package/dist/array/intersectionWith.spec.d.ts +1 -0
- package/dist/array/partition.d.ts +1 -3
- package/dist/array/partition.spec.d.ts +1 -0
- package/dist/array/sample.d.ts +1 -3
- package/dist/array/sample.spec.d.ts +1 -0
- package/dist/array/shuffle.d.ts +1 -3
- package/dist/array/shuffle.spec.d.ts +1 -0
- package/dist/array/take.d.ts +1 -3
- package/dist/array/take.spec.d.ts +1 -0
- package/dist/array/takeRight.d.ts +1 -3
- package/dist/array/takeRight.spec.d.ts +1 -0
- package/dist/array/takeRightWhile.d.ts +1 -3
- package/dist/array/takeRightWhile.spec.d.ts +1 -0
- package/dist/array/takeWhile.d.ts +1 -3
- package/dist/array/takeWhile.spec.d.ts +1 -0
- package/dist/array/union.d.ts +1 -3
- package/dist/array/union.spec.d.ts +1 -0
- package/dist/array/unionBy.d.ts +1 -3
- package/dist/array/unionBy.spec.d.ts +1 -0
- package/dist/array/unionWith.d.ts +1 -3
- package/dist/array/unionWith.spec.d.ts +1 -0
- package/dist/array/uniq.d.ts +1 -3
- package/dist/array/uniq.spec.d.ts +1 -0
- package/dist/array/uniqBy.d.ts +1 -3
- package/dist/array/uniqBy.spec.d.ts +1 -0
- package/dist/array/uniqWith.d.ts +1 -3
- package/dist/array/uniqWith.spec.d.ts +1 -0
- package/dist/array/xor.d.ts +1 -3
- package/dist/array/xor.spec.d.ts +1 -0
- package/dist/array/xorBy.d.ts +1 -3
- package/dist/array/xorBy.spec.d.ts +1 -0
- package/dist/array/xorWith.d.ts +1 -3
- package/dist/array/xorWith.spec.d.ts +1 -0
- package/dist/array/zip.d.ts +4 -6
- package/dist/array/zip.spec.d.ts +1 -0
- package/dist/array/zipWith.d.ts +4 -6
- package/dist/array/zipWith.spec.d.ts +1 -0
- package/dist/function/debounce.d.ts +1 -3
- package/dist/function/debounce.spec.d.ts +1 -0
- package/dist/function/index.d.ts +3 -3
- package/dist/function/index.js +78 -47
- package/dist/function/once.d.ts +1 -3
- package/dist/function/once.spec.d.ts +1 -0
- package/dist/function/throttle.d.ts +1 -3
- package/dist/function/throttle.spec.d.ts +1 -0
- package/dist/index.d.ts +6 -45
- package/dist/index.js +1271 -288
- package/dist/math/clamp.d.ts +2 -4
- package/dist/math/clamp.spec.d.ts +1 -0
- package/dist/math/index.d.ts +3 -3
- package/dist/math/index.js +132 -41
- package/dist/math/round.d.ts +1 -3
- package/dist/math/round.spec.d.ts +1 -0
- package/dist/math/sum.d.ts +1 -3
- package/dist/math/sum.spec.d.ts +1 -0
- package/dist/object/index.d.ts +4 -4
- package/dist/object/index.js +256 -62
- package/dist/object/omit.d.ts +1 -3
- package/dist/object/omit.spec.d.ts +1 -0
- package/dist/object/omitBy.d.ts +1 -3
- package/dist/object/omitBy.spec.d.ts +1 -0
- package/dist/object/pick.d.ts +1 -3
- package/dist/object/pick.spec.d.ts +1 -0
- package/dist/object/pickBy.d.ts +1 -3
- package/dist/object/pickBy.spec.d.ts +1 -0
- package/dist/predicate/index.d.ts +4 -4
- package/dist/predicate/index.js +84 -42
- package/dist/predicate/isNil.d.ts +1 -3
- package/dist/predicate/isNil.spec.d.ts +1 -0
- package/dist/predicate/isNotNil.d.ts +1 -3
- package/dist/predicate/isNotNil.spec.d.ts +1 -0
- package/dist/predicate/isNull.d.ts +1 -3
- package/dist/predicate/isNull.spec.d.ts +1 -0
- package/dist/predicate/isUndefined.d.ts +1 -3
- package/dist/predicate/isUndefined.spec.d.ts +1 -0
- package/dist/promise/delay.d.ts +1 -3
- package/dist/promise/delay.spec.d.ts +1 -0
- package/dist/promise/index.d.ts +1 -1
- package/dist/promise/index.js +23 -31
- package/esm/_virtual/_rollupPluginBabelHelpers.mjs +163 -0
- package/esm/array/_virtual/_rollupPluginBabelHelpers.mjs +78 -0
- package/{dist/array/chunk.d.mts → esm/array/chunk.mjs} +13 -1
- package/{dist/array/difference.d.mts → esm/array/difference.mjs} +12 -8
- package/{dist/array/differenceBy.d.mts → esm/array/differenceBy.mjs} +17 -10
- package/{dist/array/differenceWith.d.mts → esm/array/differenceWith.mjs} +12 -6
- package/{dist/array/drop.d.mts → esm/array/drop.mjs} +6 -4
- package/{dist/array/dropRight.d.mts → esm/array/dropRight.mjs} +5 -3
- package/{dist/array/dropRightWhile.d.mts → esm/array/dropRightWhile.mjs} +11 -5
- package/{dist/array/dropWhile.d.mts → esm/array/dropWhile.mjs} +10 -5
- package/{dist/array/groupBy.d.mts → esm/array/groupBy.mjs} +26 -5
- package/{dist/array/intersection.d.mts → esm/array/intersection.mjs} +8 -4
- package/{dist/array/intersectionBy.d.mts → esm/array/intersectionBy.mjs} +12 -5
- package/{dist/array/intersectionWith.d.mts → esm/array/intersectionWith.mjs} +12 -6
- package/{dist/array/partition.d.mts → esm/array/partition.mjs} +30 -8
- package/{dist/array/sample.d.mts → esm/array/sample.mjs} +5 -2
- package/{dist/array/shuffle.d.mts → esm/array/shuffle.mjs} +13 -2
- package/{dist/array/take.d.mts → esm/array/take.mjs} +7 -5
- package/{dist/array/takeRight.d.mts → esm/array/takeRight.mjs} +10 -5
- package/{dist/array/takeRightWhile.d.mts → esm/array/takeRightWhile.mjs} +12 -5
- package/{dist/array/takeWhile.d.mts → esm/array/takeWhile.mjs} +21 -1
- package/{dist/array/union.d.mts → esm/array/union.mjs} +7 -3
- package/{dist/array/unionBy.d.mts → esm/array/unionBy.mjs} +16 -4
- package/{dist/array/unionWith.d.mts → esm/array/unionWith.mjs} +8 -4
- package/esm/array/uniq.mjs +37 -0
- package/{dist/array/uniqBy.d.mts → esm/array/uniqBy.mjs} +7 -1
- package/esm/array/uniqWith.mjs +39 -0
- package/{dist/array/xor.d.mts → esm/array/xor.mjs} +10 -4
- package/{dist/array/xorBy.d.mts → esm/array/xorBy.mjs} +13 -5
- package/{dist/array/xorWith.d.mts → esm/array/xorWith.mjs} +13 -5
- package/esm/array/zip.mjs +52 -0
- package/{dist/array/zipWith.d.mts → esm/array/zipWith.mjs} +26 -6
- package/{dist/function/debounce.d.mts → esm/function/debounce.mjs} +18 -5
- package/{dist/function/once.d.mts → esm/function/once.mjs} +14 -2
- package/{dist/function/throttle.d.mts → esm/function/throttle.mjs} +13 -3
- package/esm/math/_virtual/_rollupPluginBabelHelpers.mjs +66 -0
- package/{dist/math/clamp.d.mts → esm/math/clamp.mjs} +7 -2
- package/{dist/math/round.d.mts → esm/math/round.mjs} +7 -3
- package/esm/math/sum.mjs +33 -0
- package/esm/object/_virtual/_rollupPluginBabelHelpers.mjs +151 -0
- package/{dist/object/omit.d.mts → esm/object/omit.mjs} +19 -2
- package/{dist/object/omitBy.d.mts → esm/object/omitBy.mjs} +18 -4
- package/{dist/object/pick.d.mts → esm/object/pick.mjs} +19 -2
- package/{dist/object/pickBy.d.mts → esm/object/pickBy.mjs} +18 -4
- package/{dist/predicate/isNil.d.mts → esm/predicate/isNil.mjs} +6 -4
- package/{dist/predicate/isNotNil.d.mts → esm/predicate/isNotNil.mjs} +4 -2
- package/{dist/predicate/isNull.d.mts → esm/predicate/isNull.mjs} +6 -4
- package/{dist/predicate/isUndefined.d.mts → esm/predicate/isUndefined.mjs} +6 -4
- package/{dist/promise/delay.d.mts → esm/promise/delay.mjs} +8 -4
- package/package.json +48 -118
- package/dist/array/chunk.js +0 -43
- package/dist/array/chunk.js.map +0 -1
- package/dist/array/chunk.mjs +0 -8
- package/dist/array/chunk.mjs.map +0 -1
- package/dist/array/difference.js +0 -35
- package/dist/array/difference.js.map +0 -1
- package/dist/array/difference.mjs +0 -8
- package/dist/array/difference.mjs.map +0 -1
- package/dist/array/differenceBy.js +0 -36
- package/dist/array/differenceBy.js.map +0 -1
- package/dist/array/differenceBy.mjs +0 -8
- package/dist/array/differenceBy.mjs.map +0 -1
- package/dist/array/differenceWith.js +0 -37
- package/dist/array/differenceWith.js.map +0 -1
- package/dist/array/differenceWith.mjs +0 -8
- package/dist/array/differenceWith.mjs.map +0 -1
- package/dist/array/drop.js +0 -33
- package/dist/array/drop.js.map +0 -1
- package/dist/array/drop.mjs +0 -8
- package/dist/array/drop.mjs.map +0 -1
- package/dist/array/dropRight.js +0 -33
- package/dist/array/dropRight.js.map +0 -1
- package/dist/array/dropRight.mjs +0 -8
- package/dist/array/dropRight.mjs.map +0 -1
- package/dist/array/dropRightWhile.js +0 -43
- package/dist/array/dropRightWhile.js.map +0 -1
- package/dist/array/dropRightWhile.mjs +0 -9
- package/dist/array/dropRightWhile.mjs.map +0 -1
- package/dist/array/dropWhile.js +0 -34
- package/dist/array/dropWhile.js.map +0 -1
- package/dist/array/dropWhile.mjs +0 -8
- package/dist/array/dropWhile.mjs.map +0 -1
- package/dist/array/groupBy.js +0 -41
- package/dist/array/groupBy.js.map +0 -1
- package/dist/array/groupBy.mjs +0 -8
- package/dist/array/groupBy.mjs.map +0 -1
- package/dist/array/index.js.map +0 -1
- package/dist/array/index.mjs +0 -125
- package/dist/array/index.mjs.map +0 -1
- package/dist/array/intersection.js +0 -35
- package/dist/array/intersection.js.map +0 -1
- package/dist/array/intersection.mjs +0 -8
- package/dist/array/intersection.mjs.map +0 -1
- package/dist/array/intersectionBy.js +0 -36
- package/dist/array/intersectionBy.js.map +0 -1
- package/dist/array/intersectionBy.mjs +0 -8
- package/dist/array/intersectionBy.mjs.map +0 -1
- package/dist/array/intersectionWith.js +0 -37
- package/dist/array/intersectionWith.js.map +0 -1
- package/dist/array/intersectionWith.mjs +0 -8
- package/dist/array/intersectionWith.mjs.map +0 -1
- package/dist/array/partition.js +0 -42
- package/dist/array/partition.js.map +0 -1
- package/dist/array/partition.mjs +0 -8
- package/dist/array/partition.mjs.map +0 -1
- package/dist/array/sample.js +0 -34
- package/dist/array/sample.js.map +0 -1
- package/dist/array/sample.mjs +0 -8
- package/dist/array/sample.mjs.map +0 -1
- package/dist/array/shuffle.js +0 -37
- package/dist/array/shuffle.js.map +0 -1
- package/dist/array/shuffle.mjs +0 -8
- package/dist/array/shuffle.mjs.map +0 -1
- package/dist/array/take.js +0 -33
- package/dist/array/take.js.map +0 -1
- package/dist/array/take.mjs +0 -8
- package/dist/array/take.mjs.map +0 -1
- package/dist/array/takeRight.js +0 -36
- package/dist/array/takeRight.js.map +0 -1
- package/dist/array/takeRight.mjs +0 -8
- package/dist/array/takeRight.mjs.map +0 -1
- package/dist/array/takeRightWhile.js +0 -38
- package/dist/array/takeRightWhile.js.map +0 -1
- package/dist/array/takeRightWhile.mjs +0 -8
- package/dist/array/takeRightWhile.mjs.map +0 -1
- package/dist/array/takeWhile.js +0 -40
- package/dist/array/takeWhile.js.map +0 -1
- package/dist/array/takeWhile.mjs +0 -8
- package/dist/array/takeWhile.mjs.map +0 -1
- package/dist/array/union.js +0 -47
- package/dist/array/union.js.map +0 -1
- package/dist/array/union.mjs +0 -9
- package/dist/array/union.mjs.map +0 -1
- package/dist/array/unionBy.js +0 -40
- package/dist/array/unionBy.js.map +0 -1
- package/dist/array/unionBy.mjs +0 -8
- package/dist/array/unionBy.mjs.map +0 -1
- package/dist/array/unionWith.js +0 -47
- package/dist/array/unionWith.js.map +0 -1
- package/dist/array/unionWith.mjs +0 -9
- package/dist/array/unionWith.mjs.map +0 -1
- package/dist/array/uniq.d.mts +0 -17
- package/dist/array/uniq.js +0 -40
- package/dist/array/uniq.js.map +0 -1
- package/dist/array/uniq.mjs +0 -8
- package/dist/array/uniq.mjs.map +0 -1
- package/dist/array/uniqBy.js +0 -47
- package/dist/array/uniqBy.js.map +0 -1
- package/dist/array/uniqBy.mjs +0 -9
- package/dist/array/uniqBy.mjs.map +0 -1
- package/dist/array/uniqWith.d.mts +0 -14
- package/dist/array/uniqWith.js +0 -40
- package/dist/array/uniqWith.js.map +0 -1
- package/dist/array/uniqWith.mjs +0 -8
- package/dist/array/uniqWith.mjs.map +0 -1
- package/dist/array/xor.js +0 -66
- package/dist/array/xor.js.map +0 -1
- package/dist/array/xor.mjs +0 -12
- package/dist/array/xor.mjs.map +0 -1
- package/dist/array/xorBy.js +0 -65
- package/dist/array/xorBy.js.map +0 -1
- package/dist/array/xorBy.mjs +0 -11
- package/dist/array/xorBy.mjs.map +0 -1
- package/dist/array/xorWith.js +0 -72
- package/dist/array/xorWith.js.map +0 -1
- package/dist/array/xorWith.mjs +0 -12
- package/dist/array/xorWith.mjs.map +0 -1
- package/dist/array/zip.d.mts +0 -27
- package/dist/array/zip.js +0 -42
- package/dist/array/zip.js.map +0 -1
- package/dist/array/zip.mjs +0 -8
- package/dist/array/zip.mjs.map +0 -1
- package/dist/array/zipWith.js +0 -41
- package/dist/array/zipWith.js.map +0 -1
- package/dist/array/zipWith.mjs +0 -8
- package/dist/array/zipWith.mjs.map +0 -1
- package/dist/chunk-2KXLTAVK.mjs +0 -16
- package/dist/chunk-2KXLTAVK.mjs.map +0 -1
- package/dist/chunk-2MM5EJJX.mjs +0 -21
- package/dist/chunk-2MM5EJJX.mjs.map +0 -1
- package/dist/chunk-2VB6XU3I.mjs +0 -12
- package/dist/chunk-2VB6XU3I.mjs.map +0 -1
- package/dist/chunk-35TWSMYS.mjs +0 -19
- package/dist/chunk-35TWSMYS.mjs.map +0 -1
- package/dist/chunk-6ZCQ5ZMB.mjs +0 -13
- package/dist/chunk-6ZCQ5ZMB.mjs.map +0 -1
- package/dist/chunk-724PNXPR.mjs +0 -13
- package/dist/chunk-724PNXPR.mjs.map +0 -1
- package/dist/chunk-7GWOR247.mjs +0 -11
- package/dist/chunk-7GWOR247.mjs.map +0 -1
- package/dist/chunk-7KIXZNXS.mjs +0 -21
- package/dist/chunk-7KIXZNXS.mjs.map +0 -1
- package/dist/chunk-7OZZODAE.mjs +0 -19
- package/dist/chunk-7OZZODAE.mjs.map +0 -1
- package/dist/chunk-7PPND7QY.mjs +0 -16
- package/dist/chunk-7PPND7QY.mjs.map +0 -1
- package/dist/chunk-7SJHJHBN.mjs +0 -11
- package/dist/chunk-7SJHJHBN.mjs.map +0 -1
- package/dist/chunk-ARWKEQMQ.mjs +0 -19
- package/dist/chunk-ARWKEQMQ.mjs.map +0 -1
- package/dist/chunk-ARZ5BDR6.mjs +0 -1
- package/dist/chunk-ARZ5BDR6.mjs.map +0 -1
- package/dist/chunk-BAJC3BM7.mjs +0 -12
- package/dist/chunk-BAJC3BM7.mjs.map +0 -1
- package/dist/chunk-EAI6NLXI.mjs +0 -12
- package/dist/chunk-EAI6NLXI.mjs.map +0 -1
- package/dist/chunk-EJGAXTF7.mjs +0 -1
- package/dist/chunk-EJGAXTF7.mjs.map +0 -1
- package/dist/chunk-FUWEG5ZM.mjs +0 -9
- package/dist/chunk-FUWEG5ZM.mjs.map +0 -1
- package/dist/chunk-GJM7F3TH.mjs +0 -13
- package/dist/chunk-GJM7F3TH.mjs.map +0 -1
- package/dist/chunk-HQF6OFGM.mjs +0 -9
- package/dist/chunk-HQF6OFGM.mjs.map +0 -1
- package/dist/chunk-IJLQVGW4.mjs +0 -1
- package/dist/chunk-IJLQVGW4.mjs.map +0 -1
- package/dist/chunk-J3NTLMAE.mjs +0 -10
- package/dist/chunk-J3NTLMAE.mjs.map +0 -1
- package/dist/chunk-L4Y3G6AJ.mjs +0 -23
- package/dist/chunk-L4Y3G6AJ.mjs.map +0 -1
- package/dist/chunk-LAZNLIBJ.mjs +0 -10
- package/dist/chunk-LAZNLIBJ.mjs.map +0 -1
- package/dist/chunk-MAJSPFA6.mjs +0 -1
- package/dist/chunk-MAJSPFA6.mjs.map +0 -1
- package/dist/chunk-NEMQJ2GF.mjs +0 -18
- package/dist/chunk-NEMQJ2GF.mjs.map +0 -1
- package/dist/chunk-NK2262VG.mjs +0 -9
- package/dist/chunk-NK2262VG.mjs.map +0 -1
- package/dist/chunk-NSYWEYWT.mjs +0 -13
- package/dist/chunk-NSYWEYWT.mjs.map +0 -1
- package/dist/chunk-NYVT33DR.mjs +0 -9
- package/dist/chunk-NYVT33DR.mjs.map +0 -1
- package/dist/chunk-O3DWW7O5.mjs +0 -18
- package/dist/chunk-O3DWW7O5.mjs.map +0 -1
- package/dist/chunk-O5YJUO7P.mjs +0 -13
- package/dist/chunk-O5YJUO7P.mjs.map +0 -1
- package/dist/chunk-OBMK7JO2.mjs +0 -13
- package/dist/chunk-OBMK7JO2.mjs.map +0 -1
- package/dist/chunk-OF7HQYH4.mjs +0 -9
- package/dist/chunk-OF7HQYH4.mjs.map +0 -1
- package/dist/chunk-PTQLD7TG.mjs +0 -11
- package/dist/chunk-PTQLD7TG.mjs.map +0 -1
- package/dist/chunk-PWMHSN27.mjs +0 -14
- package/dist/chunk-PWMHSN27.mjs.map +0 -1
- package/dist/chunk-QRQPLMV4.mjs +0 -16
- package/dist/chunk-QRQPLMV4.mjs.map +0 -1
- package/dist/chunk-R5DNKXDI.mjs +0 -21
- package/dist/chunk-R5DNKXDI.mjs.map +0 -1
- package/dist/chunk-RK6PRCEJ.mjs +0 -12
- package/dist/chunk-RK6PRCEJ.mjs.map +0 -1
- package/dist/chunk-RLDY4N3Q.mjs +0 -13
- package/dist/chunk-RLDY4N3Q.mjs.map +0 -1
- package/dist/chunk-RU3RXBUC.mjs +0 -17
- package/dist/chunk-RU3RXBUC.mjs.map +0 -1
- package/dist/chunk-S767XFOS.mjs +0 -10
- package/dist/chunk-S767XFOS.mjs.map +0 -1
- package/dist/chunk-SGSQKXDO.mjs +0 -15
- package/dist/chunk-SGSQKXDO.mjs.map +0 -1
- package/dist/chunk-SYQTG4N4.mjs +0 -1
- package/dist/chunk-SYQTG4N4.mjs.map +0 -1
- package/dist/chunk-T5JCRGXA.mjs +0 -1
- package/dist/chunk-T5JCRGXA.mjs.map +0 -1
- package/dist/chunk-TOLR2FNF.mjs +0 -13
- package/dist/chunk-TOLR2FNF.mjs.map +0 -1
- package/dist/chunk-U42V7PZH.mjs +0 -9
- package/dist/chunk-U42V7PZH.mjs.map +0 -1
- package/dist/chunk-UNX3KZO2.mjs +0 -17
- package/dist/chunk-UNX3KZO2.mjs.map +0 -1
- package/dist/chunk-UZP4YX7I.mjs +0 -17
- package/dist/chunk-UZP4YX7I.mjs.map +0 -1
- package/dist/chunk-VACGGQOL.mjs +0 -9
- package/dist/chunk-VACGGQOL.mjs.map +0 -1
- package/dist/chunk-VAKCSKGR.mjs +0 -17
- package/dist/chunk-VAKCSKGR.mjs.map +0 -1
- package/dist/chunk-XAJYDHCM.mjs +0 -16
- package/dist/chunk-XAJYDHCM.mjs.map +0 -1
- package/dist/chunk-XW452I77.mjs +0 -16
- package/dist/chunk-XW452I77.mjs.map +0 -1
- package/dist/chunk-Z4IO7EIH.mjs +0 -16
- package/dist/chunk-Z4IO7EIH.mjs.map +0 -1
- package/dist/function/debounce.js +0 -47
- package/dist/function/debounce.js.map +0 -1
- package/dist/function/debounce.mjs +0 -8
- package/dist/function/debounce.mjs.map +0 -1
- package/dist/function/index.js.map +0 -1
- package/dist/function/index.mjs +0 -17
- package/dist/function/index.mjs.map +0 -1
- package/dist/function/once.js +0 -43
- package/dist/function/once.js.map +0 -1
- package/dist/function/once.mjs +0 -8
- package/dist/function/once.mjs.map +0 -1
- package/dist/function/throttle.js +0 -41
- package/dist/function/throttle.js.map +0 -1
- package/dist/function/throttle.mjs +0 -8
- package/dist/function/throttle.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -190
- package/dist/index.mjs.map +0 -1
- package/dist/math/clamp.js +0 -36
- package/dist/math/clamp.js.map +0 -1
- package/dist/math/clamp.mjs +0 -8
- package/dist/math/clamp.mjs.map +0 -1
- package/dist/math/index.js.map +0 -1
- package/dist/math/index.mjs +0 -17
- package/dist/math/index.mjs.map +0 -1
- package/dist/math/round.js +0 -34
- package/dist/math/round.js.map +0 -1
- package/dist/math/round.mjs +0 -8
- package/dist/math/round.mjs.map +0 -1
- package/dist/math/sum.d.mts +0 -16
- package/dist/math/sum.js +0 -37
- package/dist/math/sum.js.map +0 -1
- package/dist/math/sum.mjs +0 -8
- package/dist/math/sum.mjs.map +0 -1
- package/dist/object/index.js.map +0 -1
- package/dist/object/index.mjs +0 -21
- package/dist/object/index.mjs.map +0 -1
- package/dist/object/omit.js +0 -51
- package/dist/object/omit.js.map +0 -1
- package/dist/object/omit.mjs +0 -8
- package/dist/object/omit.mjs.map +0 -1
- package/dist/object/omitBy.js +0 -40
- package/dist/object/omitBy.js.map +0 -1
- package/dist/object/omitBy.mjs +0 -8
- package/dist/object/omitBy.mjs.map +0 -1
- package/dist/object/pick.js +0 -37
- package/dist/object/pick.js.map +0 -1
- package/dist/object/pick.mjs +0 -8
- package/dist/object/pick.mjs.map +0 -1
- package/dist/object/pickBy.js +0 -40
- package/dist/object/pickBy.js.map +0 -1
- package/dist/object/pickBy.mjs +0 -8
- package/dist/object/pickBy.mjs.map +0 -1
- package/dist/predicate/index.js.map +0 -1
- package/dist/predicate/index.mjs +0 -21
- package/dist/predicate/index.mjs.map +0 -1
- package/dist/predicate/isNil.js +0 -33
- package/dist/predicate/isNil.js.map +0 -1
- package/dist/predicate/isNil.mjs +0 -8
- package/dist/predicate/isNil.mjs.map +0 -1
- package/dist/predicate/isNotNil.js +0 -33
- package/dist/predicate/isNotNil.js.map +0 -1
- package/dist/predicate/isNotNil.mjs +0 -8
- package/dist/predicate/isNotNil.mjs.map +0 -1
- package/dist/predicate/isNull.js +0 -33
- package/dist/predicate/isNull.js.map +0 -1
- package/dist/predicate/isNull.mjs +0 -8
- package/dist/predicate/isNull.mjs.map +0 -1
- package/dist/predicate/isUndefined.js +0 -33
- package/dist/predicate/isUndefined.js.map +0 -1
- package/dist/predicate/isUndefined.mjs +0 -8
- package/dist/predicate/isUndefined.mjs.map +0 -1
- package/dist/promise/delay.js +0 -35
- package/dist/promise/delay.js.map +0 -1
- package/dist/promise/delay.mjs +0 -8
- package/dist/promise/delay.mjs.map +0 -1
- package/dist/promise/index.js.map +0 -1
- package/dist/promise/index.mjs +0 -9
- package/dist/promise/index.mjs.map +0 -1
- /package/{dist/array/index.d.mts → esm/array/index.mjs} +0 -0
- /package/{dist/function/index.d.mts → esm/function/index.mjs} +0 -0
- /package/{dist/index.d.mts → esm/index.mjs} +0 -0
- /package/{dist/math/index.d.mts → esm/math/index.mjs} +0 -0
- /package/{dist/object/index.d.mts → esm/object/index.mjs} +0 -0
- /package/{dist/predicate/index.d.mts → esm/predicate/index.mjs} +0 -0
- /package/{dist/promise/index.d.mts → esm/promise/index.mjs} +0 -0
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
import { difference } from './difference.mjs';
|
|
2
|
+
import { intersection } from './intersection.mjs';
|
|
3
|
+
import { union } from './union.mjs';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
|
|
3
7
|
* which are in either of the arrays, but not in their intersection.
|
|
4
|
-
*
|
|
8
|
+
*
|
|
5
9
|
* @param {T[]} arr1 - The first array.
|
|
6
10
|
* @param {T[]} arr2 - The second array.
|
|
7
11
|
* @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.
|
|
8
|
-
*
|
|
12
|
+
*
|
|
9
13
|
* @example
|
|
10
14
|
* // Returns [1, 2, 5, 6]
|
|
11
15
|
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
|
12
|
-
*
|
|
16
|
+
*
|
|
13
17
|
* @example
|
|
14
18
|
* // Returns ['a', 'c']
|
|
15
19
|
* xor(['a', 'b'], ['b', 'c']);
|
|
16
20
|
*/
|
|
17
|
-
|
|
21
|
+
function xor(arr1, arr2) {
|
|
22
|
+
return difference(union(arr1, arr2), intersection(arr1, arr2));
|
|
23
|
+
}
|
|
18
24
|
|
|
19
25
|
export { xor };
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
import { differenceBy } from './differenceBy.mjs';
|
|
2
|
+
import { intersectionBy } from './intersectionBy.mjs';
|
|
3
|
+
import { unionBy } from './unionBy.mjs';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
|
-
* Computes the symmetric difference between two arrays using a custom mapping function.
|
|
3
|
-
* The symmetric difference is the set of elements which are in either of the arrays,
|
|
6
|
+
* Computes the symmetric difference between two arrays using a custom mapping function.
|
|
7
|
+
* The symmetric difference is the set of elements which are in either of the arrays,
|
|
4
8
|
* but not in their intersection, determined by the result of the mapping function.
|
|
5
9
|
*
|
|
6
10
|
* @template T - Type of elements in the input arrays.
|
|
7
11
|
* @template U - Type of the values returned by the mapping function.
|
|
8
|
-
*
|
|
12
|
+
*
|
|
9
13
|
* @param {T[]} arr1 - The first array.
|
|
10
14
|
* @param {T[]} arr2 - The second array.
|
|
11
15
|
* @param {function(item: T): U} mapper - The function to map array elements to comparison values.
|
|
12
16
|
* @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.
|
|
13
|
-
*
|
|
17
|
+
*
|
|
14
18
|
* @example
|
|
15
19
|
* // Custom mapping function for objects with an 'id' property
|
|
16
20
|
* const idMapper = obj => obj.id;
|
|
17
21
|
* xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
|
|
18
22
|
* // Returns [{ id: 1 }, { id: 3 }]
|
|
19
23
|
*/
|
|
20
|
-
|
|
24
|
+
function xorBy(arr1, arr2, mapper) {
|
|
25
|
+
var union = unionBy(arr1, arr2, mapper);
|
|
26
|
+
var intersection = intersectionBy(arr1, arr2, mapper);
|
|
27
|
+
return differenceBy(union, intersection, mapper);
|
|
28
|
+
}
|
|
21
29
|
|
|
22
30
|
export { xorBy };
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
+
import { differenceWith } from './differenceWith.mjs';
|
|
2
|
+
import { intersectionWith } from './intersectionWith.mjs';
|
|
3
|
+
import { unionWith } from './unionWith.mjs';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
|
-
* Computes the symmetric difference between two arrays using a custom equality function.
|
|
3
|
-
* The symmetric difference is the set of elements which are in either of the arrays,
|
|
6
|
+
* Computes the symmetric difference between two arrays using a custom equality function.
|
|
7
|
+
* The symmetric difference is the set of elements which are in either of the arrays,
|
|
4
8
|
* but not in their intersection.
|
|
5
9
|
*
|
|
6
10
|
* @template T - Type of elements in the input arrays.
|
|
7
|
-
*
|
|
11
|
+
*
|
|
8
12
|
* @param {T[]} arr1 - The first array.
|
|
9
13
|
* @param {T[]} arr2 - The second array.
|
|
10
14
|
* @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.
|
|
11
15
|
* @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function.
|
|
12
|
-
*
|
|
16
|
+
*
|
|
13
17
|
* @example
|
|
14
18
|
* // Custom equality function for objects with an 'id' property
|
|
15
19
|
* const areObjectsEqual = (a, b) => a.id === b.id;
|
|
16
20
|
* xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);
|
|
17
21
|
* // Returns [{ id: 1 }, { id: 3 }]
|
|
18
22
|
*/
|
|
19
|
-
|
|
23
|
+
function xorWith(arr1, arr2, areElementsEqual) {
|
|
24
|
+
var union = unionWith(arr1, arr2, areElementsEqual);
|
|
25
|
+
var intersection = intersectionWith(arr1, arr2, areElementsEqual);
|
|
26
|
+
return differenceWith(union, intersection, areElementsEqual);
|
|
27
|
+
}
|
|
20
28
|
|
|
21
29
|
export { xorWith };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { toConsumableArray as _toConsumableArray, createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Combines multiple arrays into a single array of tuples.
|
|
5
|
+
*
|
|
6
|
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
|
7
|
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
|
8
|
+
* different lengths, the resulting array will have the length of the longest input array,
|
|
9
|
+
* with undefined values for missing elements.
|
|
10
|
+
*
|
|
11
|
+
* @param {...T[][]} arrs - The arrays to zip together.
|
|
12
|
+
* @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const arr1 = [1, 2, 3];
|
|
16
|
+
* const arr2 = ['a', 'b', 'c'];
|
|
17
|
+
* const result = zip(arr1, arr2);
|
|
18
|
+
* // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
|
|
19
|
+
*
|
|
20
|
+
* const arr3 = [true, false];
|
|
21
|
+
* const result2 = zip(arr1, arr2, arr3);
|
|
22
|
+
* // result2 will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
function zip() {
|
|
26
|
+
var result = [];
|
|
27
|
+
for (var _len = arguments.length, arrs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
arrs[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (x) {
|
|
31
|
+
return x.length;
|
|
32
|
+
})));
|
|
33
|
+
for (var i = 0; i < maxIndex; i++) {
|
|
34
|
+
var element = [];
|
|
35
|
+
var _iterator = _createForOfIteratorHelper(arrs),
|
|
36
|
+
_step;
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var arr = _step.value;
|
|
40
|
+
element.push(arr[i]);
|
|
41
|
+
}
|
|
42
|
+
} catch (err) {
|
|
43
|
+
_iterator.e(err);
|
|
44
|
+
} finally {
|
|
45
|
+
_iterator.f();
|
|
46
|
+
}
|
|
47
|
+
result.push(element);
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { zip };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { toConsumableArray as _toConsumableArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Combines multiple arrays into a single array using a custom combiner function.
|
|
3
|
-
*
|
|
4
|
-
* This function takes multiple arrays and a combiner function, and returns a new array where each element
|
|
5
|
+
*
|
|
6
|
+
* This function takes multiple arrays and a combiner function, and returns a new array where each element
|
|
5
7
|
* is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|
6
8
|
*
|
|
7
9
|
* @param {T[]} arr1 - The first array to zip.
|
|
@@ -26,9 +28,27 @@
|
|
|
26
28
|
* const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);
|
|
27
29
|
* // result will be [`135`, `246`]
|
|
28
30
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
function zipWith(arr1) {
|
|
33
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
34
|
+
rest[_key - 1] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
var arrs = [arr1].concat(_toConsumableArray(rest.slice(0, -1)));
|
|
37
|
+
var combine = rest[rest.length - 1];
|
|
38
|
+
var result = [];
|
|
39
|
+
var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (arr) {
|
|
40
|
+
return arr.length;
|
|
41
|
+
})));
|
|
42
|
+
var _loop = function _loop(i) {
|
|
43
|
+
var elements = arrs.map(function (arr) {
|
|
44
|
+
return arr[i];
|
|
45
|
+
});
|
|
46
|
+
result.push(combine.apply(void 0, _toConsumableArray(elements)));
|
|
47
|
+
};
|
|
48
|
+
for (var i = 0; i < maxIndex; i++) {
|
|
49
|
+
_loop(i);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
33
53
|
|
|
34
54
|
export { zipWith };
|
|
@@ -14,13 +14,26 @@
|
|
|
14
14
|
*
|
|
15
15
|
* // Will log 'Function executed' after 1 second if not called again in that time
|
|
16
16
|
* debouncedFunction();
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* // Will not log anything as the previous call is canceled
|
|
19
19
|
* debouncedFunction.cancel();
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
function debounce(func, debounceMs) {
|
|
22
|
+
var timeoutId = null;
|
|
23
|
+
var debounced = function debounced() {
|
|
24
|
+
if (timeoutId != null) {
|
|
25
|
+
clearTimeout(timeoutId);
|
|
26
|
+
}
|
|
27
|
+
timeoutId = setTimeout(function () {
|
|
28
|
+
func();
|
|
29
|
+
}, debounceMs);
|
|
30
|
+
};
|
|
31
|
+
debounced.cancel = function () {
|
|
32
|
+
if (timeoutId != null) {
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return debounced;
|
|
37
|
+
}
|
|
25
38
|
|
|
26
39
|
export { debounce };
|
|
@@ -10,10 +10,22 @@
|
|
|
10
10
|
* console.log('Initialized!');
|
|
11
11
|
* return true;
|
|
12
12
|
* });
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* initialize(); // Logs: 'Initialized!' and returns true
|
|
15
15
|
* initialize(); // Returns true without logging
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
function once(func) {
|
|
18
|
+
var called = false;
|
|
19
|
+
var cache;
|
|
20
|
+
return function () {
|
|
21
|
+
if (called) {
|
|
22
|
+
return cache;
|
|
23
|
+
}
|
|
24
|
+
var result = func();
|
|
25
|
+
called = true;
|
|
26
|
+
cache = result;
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
18
30
|
|
|
19
31
|
export { once };
|
|
@@ -14,15 +14,25 @@
|
|
|
14
14
|
*
|
|
15
15
|
* // Will log 'Function executed' immediately
|
|
16
16
|
* throttledFunction();
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* // Will not log anything as it is within the throttle time
|
|
19
19
|
* throttledFunction();
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
21
|
* // After 1 second
|
|
22
22
|
* setTimeout(() => {
|
|
23
23
|
* throttledFunction(); // Will log 'Function executed'
|
|
24
24
|
* }, 1000);
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
function throttle(func, throttleMs) {
|
|
27
|
+
var lastCallTime;
|
|
28
|
+
var throttledFunction = function throttledFunction() {
|
|
29
|
+
var now = Date.now();
|
|
30
|
+
if (lastCallTime == null || now - lastCallTime >= throttleMs) {
|
|
31
|
+
lastCallTime = now;
|
|
32
|
+
func();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return throttledFunction;
|
|
36
|
+
}
|
|
27
37
|
|
|
28
38
|
export { throttle };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
2
|
+
if (!o) return;
|
|
3
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
4
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
7
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
8
|
+
}
|
|
9
|
+
function _arrayLikeToArray(arr, len) {
|
|
10
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
11
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
12
|
+
return arr2;
|
|
13
|
+
}
|
|
14
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
15
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
16
|
+
if (!it) {
|
|
17
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
18
|
+
if (it) o = it;
|
|
19
|
+
var i = 0;
|
|
20
|
+
var F = function () {};
|
|
21
|
+
return {
|
|
22
|
+
s: F,
|
|
23
|
+
n: function () {
|
|
24
|
+
if (i >= o.length) return {
|
|
25
|
+
done: true
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
done: false,
|
|
29
|
+
value: o[i++]
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
e: function (e) {
|
|
33
|
+
throw e;
|
|
34
|
+
},
|
|
35
|
+
f: F
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
39
|
+
}
|
|
40
|
+
var normalCompletion = true,
|
|
41
|
+
didErr = false,
|
|
42
|
+
err;
|
|
43
|
+
return {
|
|
44
|
+
s: function () {
|
|
45
|
+
it = it.call(o);
|
|
46
|
+
},
|
|
47
|
+
n: function () {
|
|
48
|
+
var step = it.next();
|
|
49
|
+
normalCompletion = step.done;
|
|
50
|
+
return step;
|
|
51
|
+
},
|
|
52
|
+
e: function (e) {
|
|
53
|
+
didErr = true;
|
|
54
|
+
err = e;
|
|
55
|
+
},
|
|
56
|
+
f: function () {
|
|
57
|
+
try {
|
|
58
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
59
|
+
} finally {
|
|
60
|
+
if (didErr) throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { _arrayLikeToArray as arrayLikeToArray, _createForOfIteratorHelper as createForOfIteratorHelper, _unsupportedIterableToArray as unsupportedIterableToArray };
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
|
|
16
16
|
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
|
|
19
|
+
function clamp(value, bound1, bound2) {
|
|
20
|
+
if (bound2 == null) {
|
|
21
|
+
return Math.min(value, bound1);
|
|
22
|
+
}
|
|
23
|
+
return Math.min(Math.max(value, bound1), bound2);
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
export { clamp };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rounds a number to a specified precision.
|
|
3
|
-
*
|
|
4
|
-
* This function takes a number and an optional precision value, and returns the number rounded
|
|
3
|
+
*
|
|
4
|
+
* This function takes a number and an optional precision value, and returns the number rounded
|
|
5
5
|
* to the specified number of decimal places.
|
|
6
6
|
*
|
|
7
7
|
* @param {number} value - The number to round.
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* const result2 = round(1.2345, 2); // result2 will be 1.23
|
|
14
14
|
* const result3 = round(1.2345, 3); // result3 will be 1.235
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
function round(value) {
|
|
17
|
+
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
18
|
+
var multiplier = Math.pow(10, precision);
|
|
19
|
+
return Math.round(value * multiplier) / multiplier;
|
|
20
|
+
}
|
|
17
21
|
|
|
18
22
|
export { round };
|
package/esm/math/sum.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the sum of an array of numbers.
|
|
5
|
+
*
|
|
6
|
+
* This function takes an array of numbers and returns the sum of all the elements in the array.
|
|
7
|
+
*
|
|
8
|
+
* @param {number[]} nums - An array of numbers to be summed.
|
|
9
|
+
* @returns {number} The sum of all the numbers in the array.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* * const numbers = [1, 2, 3, 4, 5];
|
|
13
|
+
* const result = sum(numbers);
|
|
14
|
+
* // result will be 15
|
|
15
|
+
*/
|
|
16
|
+
function sum(nums) {
|
|
17
|
+
var result = 0;
|
|
18
|
+
var _iterator = _createForOfIteratorHelper(nums),
|
|
19
|
+
_step;
|
|
20
|
+
try {
|
|
21
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
22
|
+
var num = _step.value;
|
|
23
|
+
result += num;
|
|
24
|
+
}
|
|
25
|
+
} catch (err) {
|
|
26
|
+
_iterator.e(err);
|
|
27
|
+
} finally {
|
|
28
|
+
_iterator.f();
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { sum };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
function _iterableToArrayLimit(r, l) {
|
|
2
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
3
|
+
if (null != t) {
|
|
4
|
+
var e,
|
|
5
|
+
n,
|
|
6
|
+
i,
|
|
7
|
+
u,
|
|
8
|
+
a = [],
|
|
9
|
+
f = !0,
|
|
10
|
+
o = !1;
|
|
11
|
+
try {
|
|
12
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
13
|
+
if (Object(t) !== t) return;
|
|
14
|
+
f = !1;
|
|
15
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
16
|
+
} catch (r) {
|
|
17
|
+
o = !0, n = r;
|
|
18
|
+
} finally {
|
|
19
|
+
try {
|
|
20
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
21
|
+
} finally {
|
|
22
|
+
if (o) throw n;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return a;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function ownKeys(e, r) {
|
|
29
|
+
var t = Object.keys(e);
|
|
30
|
+
if (Object.getOwnPropertySymbols) {
|
|
31
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
32
|
+
r && (o = o.filter(function (r) {
|
|
33
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
34
|
+
})), t.push.apply(t, o);
|
|
35
|
+
}
|
|
36
|
+
return t;
|
|
37
|
+
}
|
|
38
|
+
function _objectSpread2(e) {
|
|
39
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
40
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
41
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
42
|
+
_defineProperty(e, r, t[r]);
|
|
43
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
44
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return e;
|
|
48
|
+
}
|
|
49
|
+
function _toPrimitive(t, r) {
|
|
50
|
+
if ("object" != typeof t || !t) return t;
|
|
51
|
+
var e = t[Symbol.toPrimitive];
|
|
52
|
+
if (void 0 !== e) {
|
|
53
|
+
var i = e.call(t, r || "default");
|
|
54
|
+
if ("object" != typeof i) return i;
|
|
55
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
56
|
+
}
|
|
57
|
+
return ("string" === r ? String : Number)(t);
|
|
58
|
+
}
|
|
59
|
+
function _toPropertyKey(t) {
|
|
60
|
+
var i = _toPrimitive(t, "string");
|
|
61
|
+
return "symbol" == typeof i ? i : i + "";
|
|
62
|
+
}
|
|
63
|
+
function _defineProperty(obj, key, value) {
|
|
64
|
+
key = _toPropertyKey(key);
|
|
65
|
+
if (key in obj) {
|
|
66
|
+
Object.defineProperty(obj, key, {
|
|
67
|
+
value: value,
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
obj[key] = value;
|
|
74
|
+
}
|
|
75
|
+
return obj;
|
|
76
|
+
}
|
|
77
|
+
function _slicedToArray(arr, i) {
|
|
78
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
79
|
+
}
|
|
80
|
+
function _arrayWithHoles(arr) {
|
|
81
|
+
if (Array.isArray(arr)) return arr;
|
|
82
|
+
}
|
|
83
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
84
|
+
if (!o) return;
|
|
85
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
86
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
87
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
88
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
89
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
90
|
+
}
|
|
91
|
+
function _arrayLikeToArray(arr, len) {
|
|
92
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
93
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
94
|
+
return arr2;
|
|
95
|
+
}
|
|
96
|
+
function _nonIterableRest() {
|
|
97
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
98
|
+
}
|
|
99
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
100
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
101
|
+
if (!it) {
|
|
102
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
103
|
+
if (it) o = it;
|
|
104
|
+
var i = 0;
|
|
105
|
+
var F = function () {};
|
|
106
|
+
return {
|
|
107
|
+
s: F,
|
|
108
|
+
n: function () {
|
|
109
|
+
if (i >= o.length) return {
|
|
110
|
+
done: true
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
done: false,
|
|
114
|
+
value: o[i++]
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
e: function (e) {
|
|
118
|
+
throw e;
|
|
119
|
+
},
|
|
120
|
+
f: F
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
124
|
+
}
|
|
125
|
+
var normalCompletion = true,
|
|
126
|
+
didErr = false,
|
|
127
|
+
err;
|
|
128
|
+
return {
|
|
129
|
+
s: function () {
|
|
130
|
+
it = it.call(o);
|
|
131
|
+
},
|
|
132
|
+
n: function () {
|
|
133
|
+
var step = it.next();
|
|
134
|
+
normalCompletion = step.done;
|
|
135
|
+
return step;
|
|
136
|
+
},
|
|
137
|
+
e: function (e) {
|
|
138
|
+
didErr = true;
|
|
139
|
+
err = e;
|
|
140
|
+
},
|
|
141
|
+
f: function () {
|
|
142
|
+
try {
|
|
143
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
144
|
+
} finally {
|
|
145
|
+
if (didErr) throw err;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _createForOfIteratorHelper as createForOfIteratorHelper, _defineProperty as defineProperty, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _objectSpread2 as objectSpread2, _slicedToArray as slicedToArray, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _unsupportedIterableToArray as unsupportedIterableToArray };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2, createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Creates a new object with specified keys omitted.
|
|
3
5
|
*
|
|
4
|
-
* This function takes an object and an array of keys, and returns a new object that
|
|
6
|
+
* This function takes an object and an array of keys, and returns a new object that
|
|
5
7
|
* excludes the properties corresponding to the specified keys.
|
|
6
8
|
*
|
|
7
9
|
* @param {T} obj - The object to omit keys from.
|
|
@@ -13,6 +15,21 @@
|
|
|
13
15
|
* const result = omit(obj, ['b', 'c']);
|
|
14
16
|
* // result will be { a: 1 }
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
function omit(obj, keys) {
|
|
19
|
+
var result = _objectSpread2({}, obj);
|
|
20
|
+
var _iterator = _createForOfIteratorHelper(keys),
|
|
21
|
+
_step;
|
|
22
|
+
try {
|
|
23
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
24
|
+
var key = _step.value;
|
|
25
|
+
delete result[key];
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
_iterator.e(err);
|
|
29
|
+
} finally {
|
|
30
|
+
_iterator.f();
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
17
34
|
|
|
18
35
|
export { omit };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Creates a new object composed of the properties that do not satisfy the predicate function.
|
|
3
5
|
*
|
|
4
|
-
* This function takes an object and a predicate function, and returns a new object that
|
|
6
|
+
* This function takes an object and a predicate function, and returns a new object that
|
|
5
7
|
* includes only the properties for which the predicate function returns false.
|
|
6
8
|
*
|
|
7
9
|
* @param {T} obj - The object to omit properties from.
|
|
8
|
-
* @param {(value: T[string], key: string) => boolean} shouldOmit - A predicate function that determines
|
|
9
|
-
* whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
|
|
10
|
+
* @param {(value: T[string], key: string) => boolean} shouldOmit - A predicate function that determines
|
|
11
|
+
* whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
|
|
10
12
|
* if the property should be omitted, and `false` otherwise.
|
|
11
13
|
* @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.
|
|
12
14
|
*
|
|
@@ -16,6 +18,18 @@
|
|
|
16
18
|
* const result = omitBy(obj, shouldOmit);
|
|
17
19
|
* // result will be { a: 1, c: 3 }
|
|
18
20
|
*/
|
|
19
|
-
|
|
21
|
+
function omitBy(obj, shouldOmit) {
|
|
22
|
+
var result = {};
|
|
23
|
+
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
24
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
25
|
+
key = _Object$entries$_i[0],
|
|
26
|
+
value = _Object$entries$_i[1];
|
|
27
|
+
if (shouldOmit(value, key)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
result[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
20
34
|
|
|
21
35
|
export { omitBy };
|