es-toolkit 1.0.3 → 1.0.4-dev.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/{esm/array/chunk.mjs → dist/array/chunk.d.mts} +1 -13
- package/dist/array/chunk.d.ts +3 -1
- package/dist/array/chunk.js +43 -0
- package/dist/array/chunk.js.map +1 -0
- package/dist/array/chunk.mjs +8 -0
- package/dist/array/chunk.mjs.map +1 -0
- package/{esm/array/difference.mjs → dist/array/difference.d.mts} +8 -12
- package/dist/array/difference.d.ts +3 -1
- package/dist/array/difference.js +35 -0
- package/dist/array/difference.js.map +1 -0
- package/dist/array/difference.mjs +8 -0
- package/dist/array/difference.mjs.map +1 -0
- package/{esm/array/differenceBy.mjs → dist/array/differenceBy.d.mts} +10 -17
- package/dist/array/differenceBy.d.ts +3 -1
- package/dist/array/differenceBy.js +36 -0
- package/dist/array/differenceBy.js.map +1 -0
- package/dist/array/differenceBy.mjs +8 -0
- package/dist/array/differenceBy.mjs.map +1 -0
- package/{esm/array/differenceWith.mjs → dist/array/differenceWith.d.mts} +6 -12
- package/dist/array/differenceWith.d.ts +3 -1
- package/dist/array/differenceWith.js +37 -0
- package/dist/array/differenceWith.js.map +1 -0
- package/dist/array/differenceWith.mjs +8 -0
- package/dist/array/differenceWith.mjs.map +1 -0
- package/{esm/array/drop.mjs → dist/array/drop.d.mts} +4 -6
- package/dist/array/drop.d.ts +3 -1
- package/dist/array/drop.js +33 -0
- package/dist/array/drop.js.map +1 -0
- package/dist/array/drop.mjs +8 -0
- package/dist/array/drop.mjs.map +1 -0
- package/{esm/array/dropRight.mjs → dist/array/dropRight.d.mts} +3 -5
- package/dist/array/dropRight.d.ts +3 -1
- package/dist/array/dropRight.js +33 -0
- package/dist/array/dropRight.js.map +1 -0
- package/dist/array/dropRight.mjs +8 -0
- package/dist/array/dropRight.mjs.map +1 -0
- package/{esm/array/dropRightWhile.mjs → dist/array/dropRightWhile.d.mts} +5 -11
- package/dist/array/dropRightWhile.d.ts +3 -1
- package/dist/array/dropRightWhile.js +43 -0
- package/dist/array/dropRightWhile.js.map +1 -0
- package/dist/array/dropRightWhile.mjs +9 -0
- package/dist/array/dropRightWhile.mjs.map +1 -0
- package/{esm/array/dropWhile.mjs → dist/array/dropWhile.d.mts} +5 -10
- package/dist/array/dropWhile.d.ts +3 -1
- package/dist/array/dropWhile.js +34 -0
- package/dist/array/dropWhile.js.map +1 -0
- package/dist/array/dropWhile.mjs +8 -0
- package/dist/array/dropWhile.mjs.map +1 -0
- package/{esm/array/groupBy.mjs → dist/array/groupBy.d.mts} +5 -26
- package/dist/array/groupBy.d.ts +3 -1
- package/dist/array/groupBy.js +41 -0
- package/dist/array/groupBy.js.map +1 -0
- package/dist/array/groupBy.mjs +8 -0
- package/dist/array/groupBy.mjs.map +1 -0
- package/dist/array/index.d.ts +30 -30
- package/dist/array/index.js +199 -842
- package/dist/array/index.js.map +1 -0
- package/dist/array/index.mjs +125 -0
- package/dist/array/index.mjs.map +1 -0
- package/{esm/array/intersection.mjs → dist/array/intersection.d.mts} +4 -8
- package/dist/array/intersection.d.ts +3 -1
- package/dist/array/intersection.js +35 -0
- package/dist/array/intersection.js.map +1 -0
- package/dist/array/intersection.mjs +8 -0
- package/dist/array/intersection.mjs.map +1 -0
- package/{esm/array/intersectionBy.mjs → dist/array/intersectionBy.d.mts} +5 -12
- package/dist/array/intersectionBy.d.ts +3 -1
- package/dist/array/intersectionBy.js +36 -0
- package/dist/array/intersectionBy.js.map +1 -0
- package/dist/array/intersectionBy.mjs +8 -0
- package/dist/array/intersectionBy.mjs.map +1 -0
- package/{esm/array/intersectionWith.mjs → dist/array/intersectionWith.d.mts} +6 -12
- package/dist/array/intersectionWith.d.ts +3 -1
- package/dist/array/intersectionWith.js +37 -0
- package/dist/array/intersectionWith.js.map +1 -0
- package/dist/array/intersectionWith.mjs +8 -0
- package/dist/array/intersectionWith.mjs.map +1 -0
- package/{esm/array/partition.mjs → dist/array/partition.d.mts} +8 -30
- package/dist/array/partition.d.ts +3 -1
- package/dist/array/partition.js +42 -0
- package/dist/array/partition.js.map +1 -0
- package/dist/array/partition.mjs +8 -0
- package/dist/array/partition.mjs.map +1 -0
- package/{esm/array/sample.mjs → dist/array/sample.d.mts} +2 -5
- package/dist/array/sample.d.ts +3 -1
- package/dist/array/sample.js +34 -0
- package/dist/array/sample.js.map +1 -0
- package/dist/array/sample.mjs +8 -0
- package/dist/array/sample.mjs.map +1 -0
- package/{esm/array/shuffle.mjs → dist/array/shuffle.d.mts} +2 -13
- package/dist/array/shuffle.d.ts +3 -1
- package/dist/array/shuffle.js +37 -0
- package/dist/array/shuffle.js.map +1 -0
- package/dist/array/shuffle.mjs +8 -0
- package/dist/array/shuffle.mjs.map +1 -0
- package/{esm/array/take.mjs → dist/array/take.d.mts} +5 -7
- package/dist/array/take.d.ts +3 -1
- package/dist/array/take.js +33 -0
- package/dist/array/take.js.map +1 -0
- package/dist/array/take.mjs +8 -0
- package/dist/array/take.mjs.map +1 -0
- package/{esm/array/takeRight.mjs → dist/array/takeRight.d.mts} +5 -10
- package/dist/array/takeRight.d.ts +3 -1
- package/dist/array/takeRight.js +36 -0
- package/dist/array/takeRight.js.map +1 -0
- package/dist/array/takeRight.mjs +8 -0
- package/dist/array/takeRight.mjs.map +1 -0
- package/{esm/array/takeRightWhile.mjs → dist/array/takeRightWhile.d.mts} +5 -12
- package/dist/array/takeRightWhile.d.ts +3 -1
- package/dist/array/takeRightWhile.js +38 -0
- package/dist/array/takeRightWhile.js.map +1 -0
- package/dist/array/takeRightWhile.mjs +8 -0
- package/dist/array/takeRightWhile.mjs.map +1 -0
- package/{esm/array/takeWhile.mjs → dist/array/takeWhile.d.mts} +1 -21
- package/dist/array/takeWhile.d.ts +3 -1
- package/dist/array/takeWhile.js +40 -0
- package/dist/array/takeWhile.js.map +1 -0
- package/dist/array/takeWhile.mjs +8 -0
- package/dist/array/takeWhile.mjs.map +1 -0
- package/{esm/array/union.mjs → dist/array/union.d.mts} +3 -7
- package/dist/array/union.d.ts +3 -1
- package/dist/array/union.js +47 -0
- package/dist/array/union.js.map +1 -0
- package/dist/array/union.mjs +9 -0
- package/dist/array/union.mjs.map +1 -0
- package/{esm/array/unionBy.mjs → dist/array/unionBy.d.mts} +4 -16
- package/dist/array/unionBy.d.ts +3 -1
- package/dist/array/unionBy.js +40 -0
- package/dist/array/unionBy.js.map +1 -0
- package/dist/array/unionBy.mjs +8 -0
- package/dist/array/unionBy.mjs.map +1 -0
- package/{esm/array/unionWith.mjs → dist/array/unionWith.d.mts} +4 -8
- package/dist/array/unionWith.d.ts +3 -1
- package/dist/array/unionWith.js +47 -0
- package/dist/array/unionWith.js.map +1 -0
- package/dist/array/unionWith.mjs +9 -0
- package/dist/array/unionWith.mjs.map +1 -0
- package/dist/array/uniq.d.mts +17 -0
- package/dist/array/uniq.d.ts +3 -1
- package/dist/array/uniq.js +40 -0
- package/dist/array/uniq.js.map +1 -0
- package/dist/array/uniq.mjs +8 -0
- package/dist/array/uniq.mjs.map +1 -0
- package/{esm/array/uniqBy.mjs → dist/array/uniqBy.d.mts} +1 -7
- package/dist/array/uniqBy.d.ts +3 -1
- package/dist/array/uniqBy.js +47 -0
- package/dist/array/uniqBy.js.map +1 -0
- package/dist/array/uniqBy.mjs +9 -0
- package/dist/array/uniqBy.mjs.map +1 -0
- package/dist/array/uniqWith.d.mts +14 -0
- package/dist/array/uniqWith.d.ts +3 -1
- package/dist/array/uniqWith.js +40 -0
- package/dist/array/uniqWith.js.map +1 -0
- package/dist/array/uniqWith.mjs +8 -0
- package/dist/array/uniqWith.mjs.map +1 -0
- package/{esm/array/xor.mjs → dist/array/xor.d.mts} +4 -10
- package/dist/array/xor.d.ts +3 -1
- package/dist/array/xor.js +66 -0
- package/dist/array/xor.js.map +1 -0
- package/dist/array/xor.mjs +12 -0
- package/dist/array/xor.mjs.map +1 -0
- package/{esm/array/xorBy.mjs → dist/array/xorBy.d.mts} +5 -13
- package/dist/array/xorBy.d.ts +3 -1
- package/dist/array/xorBy.js +65 -0
- package/dist/array/xorBy.js.map +1 -0
- package/dist/array/xorBy.mjs +11 -0
- package/dist/array/xorBy.mjs.map +1 -0
- package/{esm/array/xorWith.mjs → dist/array/xorWith.d.mts} +5 -13
- package/dist/array/xorWith.d.ts +3 -1
- package/dist/array/xorWith.js +72 -0
- package/dist/array/xorWith.js.map +1 -0
- package/dist/array/xorWith.mjs +12 -0
- package/dist/array/xorWith.mjs.map +1 -0
- package/dist/array/zip.d.mts +27 -0
- package/dist/array/zip.d.ts +6 -4
- package/dist/array/zip.js +42 -0
- package/dist/array/zip.js.map +1 -0
- package/dist/array/zip.mjs +8 -0
- package/dist/array/zip.mjs.map +1 -0
- package/{esm/array/zipWith.mjs → dist/array/zipWith.d.mts} +6 -26
- package/dist/array/zipWith.d.ts +6 -4
- package/dist/array/zipWith.js +41 -0
- package/dist/array/zipWith.js.map +1 -0
- package/dist/array/zipWith.mjs +8 -0
- package/dist/array/zipWith.mjs.map +1 -0
- package/dist/chunk-2KXLTAVK.mjs +16 -0
- package/dist/chunk-2KXLTAVK.mjs.map +1 -0
- package/dist/chunk-2MM5EJJX.mjs +21 -0
- package/dist/chunk-2MM5EJJX.mjs.map +1 -0
- package/dist/chunk-2VB6XU3I.mjs +12 -0
- package/dist/chunk-2VB6XU3I.mjs.map +1 -0
- package/dist/chunk-35TWSMYS.mjs +19 -0
- package/dist/chunk-35TWSMYS.mjs.map +1 -0
- package/dist/chunk-5JWSGT4R.mjs +18 -0
- package/dist/chunk-5JWSGT4R.mjs.map +1 -0
- package/dist/chunk-724PNXPR.mjs +13 -0
- package/dist/chunk-724PNXPR.mjs.map +1 -0
- package/dist/chunk-7GWOR247.mjs +11 -0
- package/dist/chunk-7GWOR247.mjs.map +1 -0
- package/dist/chunk-7OZZODAE.mjs +19 -0
- package/dist/chunk-7OZZODAE.mjs.map +1 -0
- package/dist/chunk-7PPND7QY.mjs +16 -0
- package/dist/chunk-7PPND7QY.mjs.map +1 -0
- package/dist/chunk-7SJHJHBN.mjs +11 -0
- package/dist/chunk-7SJHJHBN.mjs.map +1 -0
- package/dist/chunk-ARWKEQMQ.mjs +19 -0
- package/dist/chunk-ARWKEQMQ.mjs.map +1 -0
- package/dist/chunk-ARZ5BDR6.mjs +1 -0
- package/dist/chunk-ARZ5BDR6.mjs.map +1 -0
- package/dist/chunk-BAJC3BM7.mjs +12 -0
- package/dist/chunk-BAJC3BM7.mjs.map +1 -0
- package/dist/chunk-EAI4DDCQ.mjs +16 -0
- package/dist/chunk-EAI4DDCQ.mjs.map +1 -0
- package/dist/chunk-EAI6NLXI.mjs +12 -0
- package/dist/chunk-EAI6NLXI.mjs.map +1 -0
- package/dist/chunk-EJGAXTF7.mjs +1 -0
- package/dist/chunk-EJGAXTF7.mjs.map +1 -0
- package/dist/chunk-FUWEG5ZM.mjs +9 -0
- package/dist/chunk-FUWEG5ZM.mjs.map +1 -0
- package/dist/chunk-GJM7F3TH.mjs +13 -0
- package/dist/chunk-GJM7F3TH.mjs.map +1 -0
- package/dist/chunk-HQF6OFGM.mjs +9 -0
- package/dist/chunk-HQF6OFGM.mjs.map +1 -0
- package/dist/chunk-IJLQVGW4.mjs +1 -0
- package/dist/chunk-IJLQVGW4.mjs.map +1 -0
- package/dist/chunk-J3NTLMAE.mjs +10 -0
- package/dist/chunk-J3NTLMAE.mjs.map +1 -0
- package/dist/chunk-JMLFPGZ3.mjs +13 -0
- package/dist/chunk-JMLFPGZ3.mjs.map +1 -0
- package/dist/chunk-L4Y3G6AJ.mjs +23 -0
- package/dist/chunk-L4Y3G6AJ.mjs.map +1 -0
- package/dist/chunk-LAZNLIBJ.mjs +10 -0
- package/dist/chunk-LAZNLIBJ.mjs.map +1 -0
- package/dist/chunk-MAJSPFA6.mjs +1 -0
- package/dist/chunk-MAJSPFA6.mjs.map +1 -0
- package/dist/chunk-NEMQJ2GF.mjs +18 -0
- package/dist/chunk-NEMQJ2GF.mjs.map +1 -0
- package/dist/chunk-NK2262VG.mjs +9 -0
- package/dist/chunk-NK2262VG.mjs.map +1 -0
- package/dist/chunk-NSYWEYWT.mjs +13 -0
- package/dist/chunk-NSYWEYWT.mjs.map +1 -0
- package/dist/chunk-NYVT33DR.mjs +9 -0
- package/dist/chunk-NYVT33DR.mjs.map +1 -0
- package/dist/chunk-OBMK7JO2.mjs +13 -0
- package/dist/chunk-OBMK7JO2.mjs.map +1 -0
- package/dist/chunk-PTQLD7TG.mjs +11 -0
- package/dist/chunk-PTQLD7TG.mjs.map +1 -0
- package/dist/chunk-PWMHSN27.mjs +14 -0
- package/dist/chunk-PWMHSN27.mjs.map +1 -0
- package/dist/chunk-QRQPLMV4.mjs +16 -0
- package/dist/chunk-QRQPLMV4.mjs.map +1 -0
- package/dist/chunk-R5DNKXDI.mjs +21 -0
- package/dist/chunk-R5DNKXDI.mjs.map +1 -0
- package/dist/chunk-RK6PRCEJ.mjs +12 -0
- package/dist/chunk-RK6PRCEJ.mjs.map +1 -0
- package/dist/chunk-RLDY4N3Q.mjs +13 -0
- package/dist/chunk-RLDY4N3Q.mjs.map +1 -0
- package/dist/chunk-RU3RXBUC.mjs +17 -0
- package/dist/chunk-RU3RXBUC.mjs.map +1 -0
- package/dist/chunk-S767XFOS.mjs +10 -0
- package/dist/chunk-S767XFOS.mjs.map +1 -0
- package/dist/chunk-SGSQKXDO.mjs +15 -0
- package/dist/chunk-SGSQKXDO.mjs.map +1 -0
- package/dist/chunk-SYQTG4N4.mjs +1 -0
- package/dist/chunk-SYQTG4N4.mjs.map +1 -0
- package/dist/chunk-T5JCRGXA.mjs +1 -0
- package/dist/chunk-T5JCRGXA.mjs.map +1 -0
- package/dist/chunk-TOLR2FNF.mjs +13 -0
- package/dist/chunk-TOLR2FNF.mjs.map +1 -0
- package/dist/chunk-UNX3KZO2.mjs +17 -0
- package/dist/chunk-UNX3KZO2.mjs.map +1 -0
- package/dist/chunk-UZP4YX7I.mjs +17 -0
- package/dist/chunk-UZP4YX7I.mjs.map +1 -0
- package/dist/chunk-VACGGQOL.mjs +9 -0
- package/dist/chunk-VACGGQOL.mjs.map +1 -0
- package/dist/chunk-VAKCSKGR.mjs +17 -0
- package/dist/chunk-VAKCSKGR.mjs.map +1 -0
- package/dist/chunk-VJGGYY4Y.mjs +13 -0
- package/dist/chunk-VJGGYY4Y.mjs.map +1 -0
- package/dist/chunk-WFQ3LAHQ.mjs +9 -0
- package/dist/chunk-WFQ3LAHQ.mjs.map +1 -0
- package/dist/chunk-XS4ZPJMT.mjs +21 -0
- package/dist/chunk-XS4ZPJMT.mjs.map +1 -0
- package/dist/chunk-XW452I77.mjs +16 -0
- package/dist/chunk-XW452I77.mjs.map +1 -0
- package/dist/chunk-YMNXRH52.mjs +9 -0
- package/dist/chunk-YMNXRH52.mjs.map +1 -0
- package/dist/chunk-Z4IO7EIH.mjs +16 -0
- package/dist/chunk-Z4IO7EIH.mjs.map +1 -0
- package/{esm/function/debounce.mjs → dist/function/debounce.d.mts} +5 -18
- package/dist/function/debounce.d.ts +3 -1
- package/dist/function/debounce.js +47 -0
- package/dist/function/debounce.js.map +1 -0
- package/dist/function/debounce.mjs +8 -0
- package/dist/function/debounce.mjs.map +1 -0
- package/dist/function/index.d.ts +3 -3
- package/dist/function/index.js +47 -78
- package/dist/function/index.js.map +1 -0
- package/dist/function/index.mjs +17 -0
- package/dist/function/index.mjs.map +1 -0
- package/{esm/function/once.mjs → dist/function/once.d.mts} +2 -14
- package/dist/function/once.d.ts +3 -1
- package/dist/function/once.js +43 -0
- package/dist/function/once.js.map +1 -0
- package/dist/function/once.mjs +8 -0
- package/dist/function/once.mjs.map +1 -0
- package/{esm/function/throttle.mjs → dist/function/throttle.d.mts} +3 -13
- package/dist/function/throttle.d.ts +3 -1
- package/dist/function/throttle.js +41 -0
- package/dist/function/throttle.js.map +1 -0
- package/dist/function/throttle.mjs +8 -0
- package/dist/function/throttle.mjs.map +1 -0
- package/dist/index.d.ts +45 -6
- package/dist/index.js +288 -1271
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +190 -0
- package/dist/index.mjs.map +1 -0
- package/{esm/math/clamp.mjs → dist/math/clamp.d.mts} +2 -7
- package/dist/math/clamp.d.ts +4 -2
- package/dist/math/clamp.js +36 -0
- package/dist/math/clamp.js.map +1 -0
- package/dist/math/clamp.mjs +8 -0
- package/dist/math/clamp.mjs.map +1 -0
- package/dist/math/index.d.ts +3 -3
- package/dist/math/index.js +41 -132
- package/dist/math/index.js.map +1 -0
- package/dist/math/index.mjs +17 -0
- package/dist/math/index.mjs.map +1 -0
- package/{esm/math/round.mjs → dist/math/round.d.mts} +3 -7
- package/dist/math/round.d.ts +3 -1
- package/dist/math/round.js +34 -0
- package/dist/math/round.js.map +1 -0
- package/dist/math/round.mjs +8 -0
- package/dist/math/round.mjs.map +1 -0
- package/dist/math/sum.d.mts +16 -0
- package/dist/math/sum.d.ts +3 -1
- package/dist/math/sum.js +37 -0
- package/dist/math/sum.js.map +1 -0
- package/dist/math/sum.mjs +8 -0
- package/dist/math/sum.mjs.map +1 -0
- package/dist/object/index.d.ts +4 -4
- package/dist/object/index.js +62 -256
- package/dist/object/index.js.map +1 -0
- package/dist/object/index.mjs +21 -0
- package/dist/object/index.mjs.map +1 -0
- package/{esm/object/omit.mjs → dist/object/omit.d.mts} +2 -19
- package/dist/object/omit.d.ts +3 -1
- package/dist/object/omit.js +51 -0
- package/dist/object/omit.js.map +1 -0
- package/dist/object/omit.mjs +8 -0
- package/dist/object/omit.mjs.map +1 -0
- package/{esm/object/omitBy.mjs → dist/object/omitBy.d.mts} +4 -18
- package/dist/object/omitBy.d.ts +3 -1
- package/dist/object/omitBy.js +40 -0
- package/dist/object/omitBy.js.map +1 -0
- package/dist/object/omitBy.mjs +8 -0
- package/dist/object/omitBy.mjs.map +1 -0
- package/{esm/object/pick.mjs → dist/object/pick.d.mts} +2 -19
- package/dist/object/pick.d.ts +3 -1
- package/dist/object/pick.js +37 -0
- package/dist/object/pick.js.map +1 -0
- package/dist/object/pick.mjs +8 -0
- package/dist/object/pick.mjs.map +1 -0
- package/{esm/object/pickBy.mjs → dist/object/pickBy.d.mts} +4 -18
- package/dist/object/pickBy.d.ts +3 -1
- package/dist/object/pickBy.js +40 -0
- package/dist/object/pickBy.js.map +1 -0
- package/dist/object/pickBy.mjs +8 -0
- package/dist/object/pickBy.mjs.map +1 -0
- package/dist/predicate/index.d.ts +4 -4
- package/dist/predicate/index.js +42 -84
- package/dist/predicate/index.js.map +1 -0
- package/dist/predicate/index.mjs +21 -0
- package/dist/predicate/index.mjs.map +1 -0
- package/{esm/predicate/isNil.mjs → dist/predicate/isNil.d.mts} +4 -6
- package/dist/predicate/isNil.d.ts +3 -1
- package/dist/predicate/isNil.js +33 -0
- package/dist/predicate/isNil.js.map +1 -0
- package/dist/predicate/isNil.mjs +8 -0
- package/dist/predicate/isNil.mjs.map +1 -0
- package/{esm/predicate/isNotNil.mjs → dist/predicate/isNotNil.d.mts} +2 -4
- package/dist/predicate/isNotNil.d.ts +3 -1
- package/dist/predicate/isNotNil.js +33 -0
- package/dist/predicate/isNotNil.js.map +1 -0
- package/dist/predicate/isNotNil.mjs +8 -0
- package/dist/predicate/isNotNil.mjs.map +1 -0
- package/{esm/predicate/isNull.mjs → dist/predicate/isNull.d.mts} +4 -6
- package/dist/predicate/isNull.d.ts +3 -1
- package/dist/predicate/isNull.js +33 -0
- package/dist/predicate/isNull.js.map +1 -0
- package/dist/predicate/isNull.mjs +8 -0
- package/dist/predicate/isNull.mjs.map +1 -0
- package/{esm/predicate/isUndefined.mjs → dist/predicate/isUndefined.d.mts} +4 -6
- package/dist/predicate/isUndefined.d.ts +3 -1
- package/dist/predicate/isUndefined.js +33 -0
- package/dist/predicate/isUndefined.js.map +1 -0
- package/dist/predicate/isUndefined.mjs +8 -0
- package/dist/predicate/isUndefined.mjs.map +1 -0
- package/{esm/promise/delay.mjs → dist/promise/delay.d.mts} +4 -8
- package/dist/promise/delay.d.ts +3 -1
- package/dist/promise/delay.js +35 -0
- package/dist/promise/delay.js.map +1 -0
- package/dist/promise/delay.mjs +8 -0
- package/dist/promise/delay.mjs.map +1 -0
- package/dist/promise/index.d.ts +1 -1
- package/dist/promise/index.js +31 -23
- package/dist/promise/index.js.map +1 -0
- package/dist/promise/index.mjs +9 -0
- package/dist/promise/index.mjs.map +1 -0
- package/package.json +120 -49
- package/dist/array/chunk.spec.d.ts +0 -1
- package/dist/array/difference.spec.d.ts +0 -1
- package/dist/array/differenceBy.spec.d.ts +0 -1
- package/dist/array/differenceWith.spec.d.ts +0 -1
- package/dist/array/drop.spec.d.ts +0 -1
- package/dist/array/dropRight.spec.d.ts +0 -1
- package/dist/array/dropRightWhile.spec.d.ts +0 -1
- package/dist/array/dropWhile.spec.d.ts +0 -1
- package/dist/array/groupBy.spec.d.ts +0 -1
- package/dist/array/intersection.spec.d.ts +0 -1
- package/dist/array/intersectionBy.spec.d.ts +0 -1
- package/dist/array/intersectionWith.spec.d.ts +0 -1
- package/dist/array/partition.spec.d.ts +0 -1
- package/dist/array/sample.spec.d.ts +0 -1
- package/dist/array/shuffle.spec.d.ts +0 -1
- package/dist/array/take.spec.d.ts +0 -1
- package/dist/array/takeRight.spec.d.ts +0 -1
- package/dist/array/takeRightWhile.spec.d.ts +0 -1
- package/dist/array/takeWhile.spec.d.ts +0 -1
- package/dist/array/union.spec.d.ts +0 -1
- package/dist/array/unionBy.spec.d.ts +0 -1
- package/dist/array/unionWith.spec.d.ts +0 -1
- package/dist/array/uniq.spec.d.ts +0 -1
- package/dist/array/uniqBy.spec.d.ts +0 -1
- package/dist/array/uniqWith.spec.d.ts +0 -1
- package/dist/array/xor.spec.d.ts +0 -1
- package/dist/array/xorBy.spec.d.ts +0 -1
- package/dist/array/xorWith.spec.d.ts +0 -1
- package/dist/array/zip.spec.d.ts +0 -1
- package/dist/array/zipWith.spec.d.ts +0 -1
- package/dist/function/debounce.spec.d.ts +0 -1
- package/dist/function/once.spec.d.ts +0 -1
- package/dist/function/throttle.spec.d.ts +0 -1
- package/dist/math/clamp.spec.d.ts +0 -1
- package/dist/math/round.spec.d.ts +0 -1
- package/dist/math/sum.spec.d.ts +0 -1
- package/dist/object/omit.spec.d.ts +0 -1
- package/dist/object/omitBy.spec.d.ts +0 -1
- package/dist/object/pick.spec.d.ts +0 -1
- package/dist/object/pickBy.spec.d.ts +0 -1
- package/dist/predicate/isNil.spec.d.ts +0 -1
- package/dist/predicate/isNotNil.spec.d.ts +0 -1
- package/dist/predicate/isNull.spec.d.ts +0 -1
- package/dist/predicate/isUndefined.spec.d.ts +0 -1
- package/dist/promise/delay.spec.d.ts +0 -1
- package/esm/_virtual/_rollupPluginBabelHelpers.mjs +0 -163
- package/esm/array/_virtual/_rollupPluginBabelHelpers.mjs +0 -78
- package/esm/array/uniq.mjs +0 -37
- package/esm/array/uniqWith.mjs +0 -39
- package/esm/array/zip.mjs +0 -52
- package/esm/math/_virtual/_rollupPluginBabelHelpers.mjs +0 -66
- package/esm/math/sum.mjs +0 -33
- package/esm/object/_virtual/_rollupPluginBabelHelpers.mjs +0 -151
- /package/{esm/array/index.mjs → dist/array/index.d.mts} +0 -0
- /package/{esm/function/index.mjs → dist/function/index.d.mts} +0 -0
- /package/{esm/index.mjs → dist/index.d.mts} +0 -0
- /package/{esm/math/index.mjs → dist/math/index.d.mts} +0 -0
- /package/{esm/object/index.mjs → dist/object/index.d.mts} +0 -0
- /package/{esm/predicate/index.mjs → dist/predicate/index.d.mts} +0 -0
- /package/{esm/promise/index.mjs → dist/promise/index.d.mts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,647 +1,221 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
|
|
34
|
+
// src/index.ts
|
|
35
|
+
var src_exports = {};
|
|
36
|
+
__export(src_exports, {
|
|
37
|
+
chunk: () => chunk,
|
|
38
|
+
clamp: () => clamp,
|
|
39
|
+
debounce: () => debounce,
|
|
40
|
+
delay: () => delay,
|
|
41
|
+
difference: () => difference,
|
|
42
|
+
differenceBy: () => differenceBy,
|
|
43
|
+
differenceWith: () => differenceWith,
|
|
44
|
+
drop: () => drop,
|
|
45
|
+
dropRight: () => dropRight,
|
|
46
|
+
dropRightWhile: () => dropRightWhile,
|
|
47
|
+
dropWhile: () => dropWhile,
|
|
48
|
+
groupBy: () => groupBy,
|
|
49
|
+
intersection: () => intersection,
|
|
50
|
+
intersectionBy: () => intersectionBy,
|
|
51
|
+
intersectionWith: () => intersectionWith,
|
|
52
|
+
isNil: () => isNil,
|
|
53
|
+
isNotNil: () => isNotNil,
|
|
54
|
+
isNull: () => isNull,
|
|
55
|
+
isUndefined: () => isUndefined,
|
|
56
|
+
omit: () => omit,
|
|
57
|
+
omitBy: () => omitBy,
|
|
58
|
+
once: () => once,
|
|
59
|
+
partition: () => partition,
|
|
60
|
+
pick: () => pick,
|
|
61
|
+
pickBy: () => pickBy,
|
|
62
|
+
round: () => round,
|
|
63
|
+
sample: () => sample,
|
|
64
|
+
shuffle: () => shuffle,
|
|
65
|
+
sum: () => sum,
|
|
66
|
+
take: () => take,
|
|
67
|
+
takeRight: () => takeRight,
|
|
68
|
+
takeRightWhile: () => takeRightWhile,
|
|
69
|
+
takeWhile: () => takeWhile,
|
|
70
|
+
throttle: () => throttle,
|
|
71
|
+
union: () => union,
|
|
72
|
+
unionBy: () => unionBy,
|
|
73
|
+
unionWith: () => unionWith,
|
|
74
|
+
uniq: () => uniq,
|
|
75
|
+
uniqBy: () => uniqBy,
|
|
76
|
+
uniqWith: () => uniqWith,
|
|
77
|
+
xor: () => xor,
|
|
78
|
+
xorBy: () => xorBy,
|
|
79
|
+
xorWith: () => xorWith,
|
|
80
|
+
zip: () => zip,
|
|
81
|
+
zipWith: () => zipWith
|
|
82
|
+
});
|
|
83
|
+
module.exports = __toCommonJS(src_exports);
|
|
84
|
+
|
|
85
|
+
// src/array/chunk.ts
|
|
28
86
|
function chunk(arr, size) {
|
|
29
87
|
if (!Number.isInteger(size) || size <= 0) {
|
|
30
|
-
throw new Error(
|
|
88
|
+
throw new Error("Size must be an integer greater than zero.");
|
|
31
89
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
for (
|
|
35
|
-
|
|
36
|
-
|
|
90
|
+
const chunkLength = Math.ceil(arr.length / size);
|
|
91
|
+
const result = Array(chunkLength);
|
|
92
|
+
for (let index = 0; index < chunkLength; index++) {
|
|
93
|
+
const start = index * size;
|
|
94
|
+
const end = start + size;
|
|
37
95
|
result[index] = arr.slice(start, end);
|
|
38
96
|
}
|
|
39
97
|
return result;
|
|
40
98
|
}
|
|
41
99
|
|
|
42
|
-
|
|
43
|
-
* Computes the difference between two arrays.
|
|
44
|
-
*
|
|
45
|
-
* This function takes two arrays and returns a new array containing the elements
|
|
46
|
-
* that are present in the first array but not in the second array. It effectively
|
|
47
|
-
* filters out any elements from the first array that also appear in the second array.
|
|
48
|
-
*
|
|
49
|
-
* @template T
|
|
50
|
-
* @param {T[]} firstArr - The array from which to derive the difference. This is the primary array
|
|
51
|
-
* from which elements will be compared and filtered.
|
|
52
|
-
* @param {T[]} secondArr - The array containing elements to be excluded from the first array.
|
|
53
|
-
* Each element in this array will be checked against the first array, and if a match is found,
|
|
54
|
-
* that element will be excluded from the result.
|
|
55
|
-
* @returns {T[]} A new array containing the elements that are present in the first array but not
|
|
56
|
-
* in the second array.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* * const array1 = [1, 2, 3, 4, 5];
|
|
60
|
-
* const array2 = [2, 4];
|
|
61
|
-
* const result = difference(array1, array2);
|
|
62
|
-
* // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.
|
|
63
|
-
*/
|
|
100
|
+
// src/array/difference.ts
|
|
64
101
|
function difference(firstArr, secondArr) {
|
|
65
|
-
return firstArr.filter(
|
|
102
|
+
return firstArr.filter((item) => {
|
|
66
103
|
return !secondArr.includes(item);
|
|
67
104
|
});
|
|
68
105
|
}
|
|
69
106
|
|
|
70
|
-
|
|
71
|
-
* Computes the difference between two arrays after mapping their elements through a provided function.
|
|
72
|
-
*
|
|
73
|
-
* This function takes two arrays and a mapper function. It returns a new array containing the elements
|
|
74
|
-
* that are present in the first array but not in the second array, based on the identity calculated
|
|
75
|
-
* by the mapper function.
|
|
76
|
-
*
|
|
77
|
-
* Essentially, it filters out any elements from the first array that, when
|
|
78
|
-
* mapped, match an element in the mapped version of the second array.
|
|
79
|
-
*
|
|
80
|
-
* @template T, U
|
|
81
|
-
* @param {T[]} firstArr - The primary array from which to derive the difference.
|
|
82
|
-
* @param {T[]} secondArr - The array containing elements to be excluded from the first array.
|
|
83
|
-
* @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function
|
|
84
|
-
* is applied to each element in both arrays, and the comparison is made based on the mapped values.
|
|
85
|
-
* @returns {T[]} A new array containing the elements from the first array that do not have a corresponding
|
|
86
|
-
* mapped identity in the second array.
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
|
|
90
|
-
* const array2 = [{ id: 2 }, { id: 4 }];
|
|
91
|
-
* const mapper = item => item.id;
|
|
92
|
-
* const result = differenceBy(array1, array2, mapper);
|
|
93
|
-
* // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.
|
|
94
|
-
*/
|
|
107
|
+
// src/array/differenceBy.ts
|
|
95
108
|
function differenceBy(firstArr, secondArr, mapper) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
99
|
-
return firstArr.filter(function (item) {
|
|
109
|
+
const mappedSecondArr = secondArr.map((item) => mapper(item));
|
|
110
|
+
return firstArr.filter((item) => {
|
|
100
111
|
return !mappedSecondArr.includes(mapper(item));
|
|
101
112
|
});
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
|
|
105
|
-
* Computes the difference between two arrays based on a custom equality function.
|
|
106
|
-
*
|
|
107
|
-
* This function takes two arrays and a custom comparison function. It returns a new array containing
|
|
108
|
-
* the elements that are present in the first array but not in the second array. The comparison to determine
|
|
109
|
-
* if elements are equal is made using the provided custom function.
|
|
110
|
-
*
|
|
111
|
-
* @template T
|
|
112
|
-
* @param {T[]} firstArr - The array from which to get the difference.
|
|
113
|
-
* @param {T[]} secondArr - The array containing elements to exclude from the first array.
|
|
114
|
-
* @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.
|
|
115
|
-
* @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array
|
|
116
|
-
* according to the custom equality function.
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
|
|
120
|
-
* const array2 = [{ id: 2 }, { id: 4 }];
|
|
121
|
-
* const areItemsEqual = (a, b) => a.id === b.id;
|
|
122
|
-
* const result = differenceWith(array1, array2, areItemsEqual);
|
|
123
|
-
* // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.
|
|
124
|
-
*/
|
|
115
|
+
// src/array/differenceWith.ts
|
|
125
116
|
function differenceWith(firstArr, secondArr, areItemsEqual) {
|
|
126
|
-
return firstArr.filter(
|
|
127
|
-
return secondArr.every(
|
|
117
|
+
return firstArr.filter((firstItem) => {
|
|
118
|
+
return secondArr.every((secondItem) => {
|
|
128
119
|
return !areItemsEqual(firstItem, secondItem);
|
|
129
120
|
});
|
|
130
121
|
});
|
|
131
122
|
}
|
|
132
123
|
|
|
133
|
-
|
|
134
|
-
* Removes a specified number of elements from the beginning of an array and returns the rest.
|
|
135
|
-
*
|
|
136
|
-
* This function takes an array and a number, and returns a new array with the specified number
|
|
137
|
-
* of elements removed from the start.
|
|
138
|
-
*
|
|
139
|
-
* @param {T[]} arr - The array from which to drop elements.
|
|
140
|
-
* @param {number} itemsCount - The number of elements to drop from the beginning of the array.
|
|
141
|
-
* @returns {T[]} A new array with the specified number of elements removed from the start.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* * const array = [1, 2, 3, 4, 5];
|
|
145
|
-
* const result = drop(array, 2);
|
|
146
|
-
* // result will be [3, 4, 5] since the first two elements are dropped.
|
|
147
|
-
*/
|
|
124
|
+
// src/array/drop.ts
|
|
148
125
|
function drop(arr, itemsCount) {
|
|
149
126
|
return arr.slice(itemsCount);
|
|
150
127
|
}
|
|
151
128
|
|
|
152
|
-
|
|
153
|
-
* Removes a specified number of elements from the end of an array and returns the rest.
|
|
154
|
-
*
|
|
155
|
-
* This function takes an array and a number, and returns a new array with the specified number
|
|
156
|
-
* of elements removed from the end.
|
|
157
|
-
*
|
|
158
|
-
* @param {T[]} arr - The array from which to drop elements.
|
|
159
|
-
* @param {number} itemsCount - The number of elements to drop from the end of the array.
|
|
160
|
-
* @returns {T[]} A new array with the specified number of elements removed from the end.
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* * const array = [1, 2, 3, 4, 5];
|
|
164
|
-
* const result = dropRight(array, 2);
|
|
165
|
-
* // result will be [1, 2, 3] since the last two elements are dropped.
|
|
166
|
-
*/
|
|
129
|
+
// src/array/dropRight.ts
|
|
167
130
|
function dropRight(arr, itemsCount) {
|
|
168
131
|
return arr.slice(0, -itemsCount);
|
|
169
132
|
}
|
|
170
133
|
|
|
171
|
-
|
|
172
|
-
* Removes elements from the beginning of an array until the predicate returns false.
|
|
173
|
-
*
|
|
174
|
-
* This function iterates over an array and drops elements from the start until the provided
|
|
175
|
-
* predicate function returns false. It then returns a new array with the remaining elements.
|
|
176
|
-
*
|
|
177
|
-
* @param {T[]} arr - The array from which to drop elements.
|
|
178
|
-
* @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
|
|
179
|
-
* whether to continue dropping elements. The function is called with each element, and dropping
|
|
180
|
-
* continues as long as it returns true.
|
|
181
|
-
* @returns {T[]} A new array with the elements remaining after the predicate returns false.
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* const array = [1, 2, 3, 4, 5];
|
|
185
|
-
* const result = dropWhile(array, x => x < 3);
|
|
186
|
-
* // result will be [3, 4, 5] since elements less than 3 are dropped.
|
|
187
|
-
*/
|
|
134
|
+
// src/array/dropWhile.ts
|
|
188
135
|
function dropWhile(arr, canContinueDropping) {
|
|
189
|
-
|
|
190
|
-
return !canContinueDropping(item);
|
|
191
|
-
});
|
|
136
|
+
const dropEndIndex = arr.findIndex((item) => !canContinueDropping(item));
|
|
192
137
|
return arr.slice(dropEndIndex);
|
|
193
138
|
}
|
|
194
139
|
|
|
195
|
-
|
|
196
|
-
* Removes elements from the end of an array until the predicate returns false.
|
|
197
|
-
*
|
|
198
|
-
* This function iterates over an array from the end and drops elements until the provided
|
|
199
|
-
* predicate function returns false. It then returns a new array with the remaining elements.
|
|
200
|
-
*
|
|
201
|
-
* @param {T[]} arr - The array from which to drop elements.
|
|
202
|
-
* @param {function(item: T): boolean} canContinueDropping - A predicate function that determines
|
|
203
|
-
* whether to continue dropping elements. The function is called with each element from the end,
|
|
204
|
-
* and dropping continues as long as it returns true.
|
|
205
|
-
* @returns {T[]} A new array with the elements remaining after the predicate returns false.
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* const array = [1, 2, 3, 4, 5];
|
|
209
|
-
* const result = dropRightWhile(array, x => x > 3);
|
|
210
|
-
* // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.
|
|
211
|
-
*/
|
|
140
|
+
// src/array/dropRightWhile.ts
|
|
212
141
|
function dropRightWhile(arr, canContinueDropping) {
|
|
213
|
-
|
|
214
|
-
|
|
142
|
+
const reversed = arr.slice().reverse();
|
|
143
|
+
const dropped = dropWhile(reversed, canContinueDropping);
|
|
215
144
|
return dropped.slice().reverse();
|
|
216
145
|
}
|
|
217
146
|
|
|
218
|
-
|
|
219
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
220
|
-
if (null != t) {
|
|
221
|
-
var e,
|
|
222
|
-
n,
|
|
223
|
-
i,
|
|
224
|
-
u,
|
|
225
|
-
a = [],
|
|
226
|
-
f = !0,
|
|
227
|
-
o = !1;
|
|
228
|
-
try {
|
|
229
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
230
|
-
if (Object(t) !== t) return;
|
|
231
|
-
f = !1;
|
|
232
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
233
|
-
} catch (r) {
|
|
234
|
-
o = !0, n = r;
|
|
235
|
-
} finally {
|
|
236
|
-
try {
|
|
237
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
238
|
-
} finally {
|
|
239
|
-
if (o) throw n;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return a;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
function ownKeys(e, r) {
|
|
246
|
-
var t = Object.keys(e);
|
|
247
|
-
if (Object.getOwnPropertySymbols) {
|
|
248
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
249
|
-
r && (o = o.filter(function (r) {
|
|
250
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
251
|
-
})), t.push.apply(t, o);
|
|
252
|
-
}
|
|
253
|
-
return t;
|
|
254
|
-
}
|
|
255
|
-
function _objectSpread2(e) {
|
|
256
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
257
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
258
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
259
|
-
_defineProperty(e, r, t[r]);
|
|
260
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
261
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
return e;
|
|
265
|
-
}
|
|
266
|
-
function _toPrimitive(t, r) {
|
|
267
|
-
if ("object" != typeof t || !t) return t;
|
|
268
|
-
var e = t[Symbol.toPrimitive];
|
|
269
|
-
if (void 0 !== e) {
|
|
270
|
-
var i = e.call(t, r || "default");
|
|
271
|
-
if ("object" != typeof i) return i;
|
|
272
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
273
|
-
}
|
|
274
|
-
return ("string" === r ? String : Number)(t);
|
|
275
|
-
}
|
|
276
|
-
function _toPropertyKey(t) {
|
|
277
|
-
var i = _toPrimitive(t, "string");
|
|
278
|
-
return "symbol" == typeof i ? i : i + "";
|
|
279
|
-
}
|
|
280
|
-
function _defineProperty(obj, key, value) {
|
|
281
|
-
key = _toPropertyKey(key);
|
|
282
|
-
if (key in obj) {
|
|
283
|
-
Object.defineProperty(obj, key, {
|
|
284
|
-
value: value,
|
|
285
|
-
enumerable: true,
|
|
286
|
-
configurable: true,
|
|
287
|
-
writable: true
|
|
288
|
-
});
|
|
289
|
-
} else {
|
|
290
|
-
obj[key] = value;
|
|
291
|
-
}
|
|
292
|
-
return obj;
|
|
293
|
-
}
|
|
294
|
-
function _slicedToArray(arr, i) {
|
|
295
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
296
|
-
}
|
|
297
|
-
function _toConsumableArray(arr) {
|
|
298
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
299
|
-
}
|
|
300
|
-
function _arrayWithoutHoles(arr) {
|
|
301
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
302
|
-
}
|
|
303
|
-
function _arrayWithHoles(arr) {
|
|
304
|
-
if (Array.isArray(arr)) return arr;
|
|
305
|
-
}
|
|
306
|
-
function _iterableToArray(iter) {
|
|
307
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
308
|
-
}
|
|
309
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
310
|
-
if (!o) return;
|
|
311
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
312
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
313
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
314
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
315
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
316
|
-
}
|
|
317
|
-
function _arrayLikeToArray(arr, len) {
|
|
318
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
319
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
320
|
-
return arr2;
|
|
321
|
-
}
|
|
322
|
-
function _nonIterableSpread() {
|
|
323
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
324
|
-
}
|
|
325
|
-
function _nonIterableRest() {
|
|
326
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
327
|
-
}
|
|
328
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
329
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
330
|
-
if (!it) {
|
|
331
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
332
|
-
if (it) o = it;
|
|
333
|
-
var i = 0;
|
|
334
|
-
var F = function () {};
|
|
335
|
-
return {
|
|
336
|
-
s: F,
|
|
337
|
-
n: function () {
|
|
338
|
-
if (i >= o.length) return {
|
|
339
|
-
done: true
|
|
340
|
-
};
|
|
341
|
-
return {
|
|
342
|
-
done: false,
|
|
343
|
-
value: o[i++]
|
|
344
|
-
};
|
|
345
|
-
},
|
|
346
|
-
e: function (e) {
|
|
347
|
-
throw e;
|
|
348
|
-
},
|
|
349
|
-
f: F
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
353
|
-
}
|
|
354
|
-
var normalCompletion = true,
|
|
355
|
-
didErr = false,
|
|
356
|
-
err;
|
|
357
|
-
return {
|
|
358
|
-
s: function () {
|
|
359
|
-
it = it.call(o);
|
|
360
|
-
},
|
|
361
|
-
n: function () {
|
|
362
|
-
var step = it.next();
|
|
363
|
-
normalCompletion = step.done;
|
|
364
|
-
return step;
|
|
365
|
-
},
|
|
366
|
-
e: function (e) {
|
|
367
|
-
didErr = true;
|
|
368
|
-
err = e;
|
|
369
|
-
},
|
|
370
|
-
f: function () {
|
|
371
|
-
try {
|
|
372
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
373
|
-
} finally {
|
|
374
|
-
if (didErr) throw err;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Groups the elements of an array based on a provided key-generating function.
|
|
382
|
-
*
|
|
383
|
-
* This function takes an array and a function that generates a key from each element. It returns
|
|
384
|
-
* an object where the keys are the generated keys and the values are arrays of elements that share
|
|
385
|
-
* the same key.
|
|
386
|
-
*
|
|
387
|
-
* @param {T[]} arr - The array to group.
|
|
388
|
-
* @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.
|
|
389
|
-
* @returns {Record<K, T[]>} An object where each key is associated with an array of elements that
|
|
390
|
-
* share that key.
|
|
391
|
-
*
|
|
392
|
-
* @example
|
|
393
|
-
* const array = [
|
|
394
|
-
* { category: 'fruit', name: 'apple' },
|
|
395
|
-
* { category: 'fruit', name: 'banana' },
|
|
396
|
-
* { category: 'vegetable', name: 'carrot' }
|
|
397
|
-
* ];
|
|
398
|
-
* const result = groupBy(array, item => item.category);
|
|
399
|
-
* // result will be:
|
|
400
|
-
* // {
|
|
401
|
-
* // fruit: [
|
|
402
|
-
* // { category: 'fruit', name: 'apple' },
|
|
403
|
-
* // { category: 'fruit', name: 'banana' }
|
|
404
|
-
* // ],
|
|
405
|
-
* // vegetable: [
|
|
406
|
-
* // { category: 'vegetable', name: 'carrot' }
|
|
407
|
-
* // ]
|
|
408
|
-
* // }
|
|
409
|
-
*/
|
|
147
|
+
// src/array/groupBy.ts
|
|
410
148
|
function groupBy(arr, getKeyFromItem) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
var item = _step.value;
|
|
417
|
-
var key = getKeyFromItem(item);
|
|
418
|
-
if (result[key] == null) {
|
|
419
|
-
result[key] = [];
|
|
420
|
-
}
|
|
421
|
-
result[key].push(item);
|
|
149
|
+
const result = {};
|
|
150
|
+
for (const item of arr) {
|
|
151
|
+
const key = getKeyFromItem(item);
|
|
152
|
+
if (result[key] == null) {
|
|
153
|
+
result[key] = [];
|
|
422
154
|
}
|
|
423
|
-
|
|
424
|
-
_iterator.e(err);
|
|
425
|
-
} finally {
|
|
426
|
-
_iterator.f();
|
|
155
|
+
result[key].push(item);
|
|
427
156
|
}
|
|
428
157
|
return result;
|
|
429
158
|
}
|
|
430
159
|
|
|
431
|
-
|
|
432
|
-
* Returns the intersection of two arrays.
|
|
433
|
-
*
|
|
434
|
-
* This function takes two arrays and returns a new array containing the elements that are
|
|
435
|
-
* present in both arrays. It effectively filters out any elements from the first array that
|
|
436
|
-
* are not found in the second array.
|
|
437
|
-
*
|
|
438
|
-
* @param {T[]} firstArr - The first array to compare.
|
|
439
|
-
* @param {T[]} secondArr - The second array to compare.
|
|
440
|
-
* @returns {T[]} A new array containing the elements that are present in both arrays.
|
|
441
|
-
*
|
|
442
|
-
* @example
|
|
443
|
-
* const array1 = [1, 2, 3, 4, 5];
|
|
444
|
-
* const array2 = [3, 4, 5, 6, 7];
|
|
445
|
-
* const result = intersection(array1, array2);
|
|
446
|
-
* // result will be [3, 4, 5] since these elements are in both arrays.
|
|
447
|
-
*/
|
|
160
|
+
// src/array/intersection.ts
|
|
448
161
|
function intersection(firstArr, secondArr) {
|
|
449
|
-
return firstArr.filter(
|
|
162
|
+
return firstArr.filter((item) => {
|
|
450
163
|
return secondArr.includes(item);
|
|
451
164
|
});
|
|
452
165
|
}
|
|
453
166
|
|
|
454
|
-
|
|
455
|
-
* Returns the intersection of two arrays based on a mapping function.
|
|
456
|
-
*
|
|
457
|
-
* This function takes two arrays and a mapping function. It returns a new array containing
|
|
458
|
-
* the elements from the first array that, when mapped using the provided function, have matching
|
|
459
|
-
* mapped elements in the second array. It effectively filters out any elements from the first array
|
|
460
|
-
* that do not have corresponding mapped values in the second array.
|
|
461
|
-
*
|
|
462
|
-
* @param {T[]} firstArr - The first array to compare.
|
|
463
|
-
* @param {T[]} secondArr - The second array to compare.
|
|
464
|
-
* @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.
|
|
465
|
-
* @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.
|
|
466
|
-
*
|
|
467
|
-
* @example
|
|
468
|
-
* const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
|
|
469
|
-
* const array2 = [{ id: 2 }, { id: 4 }];
|
|
470
|
-
* const mapper = item => item.id;
|
|
471
|
-
* const result = intersectionBy(array1, array2, mapper);
|
|
472
|
-
* // result will be [{ id: 2 }] since only this element has a matching id in both arrays.
|
|
473
|
-
*/
|
|
167
|
+
// src/array/intersectionBy.ts
|
|
474
168
|
function intersectionBy(firstArr, secondArr, mapper) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
});
|
|
478
|
-
return firstArr.filter(function (item) {
|
|
169
|
+
const mappedSecondArr = secondArr.map((x) => mapper(x));
|
|
170
|
+
return firstArr.filter((item) => {
|
|
479
171
|
return mappedSecondArr.includes(mapper(item));
|
|
480
172
|
});
|
|
481
173
|
}
|
|
482
174
|
|
|
483
|
-
|
|
484
|
-
* Returns the intersection of two arrays based on a custom equality function.
|
|
485
|
-
*
|
|
486
|
-
* This function takes two arrays and a custom equality function. It returns a new array containing
|
|
487
|
-
* the elements from the first array that have matching elements in the second array, as determined
|
|
488
|
-
* by the custom equality function. It effectively filters out any elements from the first array that
|
|
489
|
-
* do not have corresponding matches in the second array according to the equality function.
|
|
490
|
-
*
|
|
491
|
-
* @param {T[]} firstArr - The first array to compare.
|
|
492
|
-
* @param {T[]} secondArr - The second array to compare.
|
|
493
|
-
* @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
|
|
494
|
-
* This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.
|
|
495
|
-
* @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.
|
|
496
|
-
*
|
|
497
|
-
* @example
|
|
498
|
-
* * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
|
|
499
|
-
* const array2 = [{ id: 2 }, { id: 4 }];
|
|
500
|
-
* const areItemsEqual = (a, b) => a.id === b.id;
|
|
501
|
-
* const result = intersectionWith(array1, array2, areItemsEqual);
|
|
502
|
-
* // result will be [{ id: 2 }] since this element has a matching id in both arrays.
|
|
503
|
-
*/
|
|
175
|
+
// src/array/intersectionWith.ts
|
|
504
176
|
function intersectionWith(firstArr, secondArr, areItemsEqual) {
|
|
505
|
-
return firstArr.filter(
|
|
506
|
-
return secondArr.some(
|
|
177
|
+
return firstArr.filter((firstItem) => {
|
|
178
|
+
return secondArr.some((secondItem) => {
|
|
507
179
|
return areItemsEqual(firstItem, secondItem);
|
|
508
180
|
});
|
|
509
181
|
});
|
|
510
182
|
}
|
|
511
183
|
|
|
512
|
-
|
|
513
|
-
* Splits an array into two groups based on a predicate function.
|
|
514
|
-
*
|
|
515
|
-
* This function takes an array and a predicate function. It returns a tuple of two arrays:
|
|
516
|
-
* the first array contains elements for which the predicate function returns true, and
|
|
517
|
-
* the second array contains elements for which the predicate function returns false.
|
|
518
|
-
*
|
|
519
|
-
* @param {T[]} arr - The array to partition.
|
|
520
|
-
* @param {(value: T) => boolean} isInTruthy - A predicate function that determines
|
|
521
|
-
* whether an element should be placed in the truthy array. The function is called with each
|
|
522
|
-
* element of the array.
|
|
523
|
-
* @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for
|
|
524
|
-
* which the predicate returned true, and the second array contains elements for which the
|
|
525
|
-
* predicate returned false.
|
|
526
|
-
*
|
|
527
|
-
* @example
|
|
528
|
-
* const array = [1, 2, 3, 4, 5];
|
|
529
|
-
* const isEven = x => x % 2 === 0;
|
|
530
|
-
* const [even, odd] = partition(array, isEven);
|
|
531
|
-
* // even will be [2, 4], and odd will be [1, 3, 5]
|
|
532
|
-
*/
|
|
184
|
+
// src/array/partition.ts
|
|
533
185
|
function partition(arr, isInTruthy) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
if (isInTruthy(item)) {
|
|
542
|
-
truthy.push(item);
|
|
543
|
-
} else {
|
|
544
|
-
falsy.push(item);
|
|
545
|
-
}
|
|
186
|
+
const truthy = [];
|
|
187
|
+
const falsy = [];
|
|
188
|
+
for (const item of arr) {
|
|
189
|
+
if (isInTruthy(item)) {
|
|
190
|
+
truthy.push(item);
|
|
191
|
+
} else {
|
|
192
|
+
falsy.push(item);
|
|
546
193
|
}
|
|
547
|
-
} catch (err) {
|
|
548
|
-
_iterator.e(err);
|
|
549
|
-
} finally {
|
|
550
|
-
_iterator.f();
|
|
551
194
|
}
|
|
552
195
|
return [truthy, falsy];
|
|
553
196
|
}
|
|
554
197
|
|
|
555
|
-
|
|
556
|
-
* Returns a random element from an array.
|
|
557
|
-
*
|
|
558
|
-
* This function takes an array and returns a single element selected randomly from the array.
|
|
559
|
-
*
|
|
560
|
-
* @param {T[]} arr - The array to sample from.
|
|
561
|
-
* @returns {T} A random element from the array.
|
|
562
|
-
*
|
|
563
|
-
* @example
|
|
564
|
-
* const array = [1, 2, 3, 4, 5];
|
|
565
|
-
* const randomElement = sample(array);
|
|
566
|
-
* // randomElement will be one of the elements from the array, selected randomly.
|
|
567
|
-
*/
|
|
198
|
+
// src/array/sample.ts
|
|
568
199
|
function sample(arr) {
|
|
569
|
-
|
|
200
|
+
const randomIndex = Math.floor(Math.random() * arr.length);
|
|
570
201
|
return arr[randomIndex];
|
|
571
202
|
}
|
|
572
203
|
|
|
573
|
-
|
|
574
|
-
* Randomizes the order of elements in an array using the Fisher-Yates algorithm.
|
|
575
|
-
*
|
|
576
|
-
* This function takes an array and returns a new array with its elements shuffled in a random order.
|
|
577
|
-
*
|
|
578
|
-
* @param {T[]} arr - The array to shuffle.
|
|
579
|
-
* @returns {T[]} A new array with its elements shuffled in random order.
|
|
580
|
-
*
|
|
581
|
-
* @example
|
|
582
|
-
* const array = [1, 2, 3, 4, 5];
|
|
583
|
-
* const shuffledArray = shuffle(array);
|
|
584
|
-
* // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]
|
|
585
|
-
*/
|
|
204
|
+
// src/array/shuffle.ts
|
|
586
205
|
function shuffle(arr) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
for (var i = arr.length - 1; i >= 1; i--) {
|
|
591
|
-
var j = Math.floor(Math.random() * (i + 1));
|
|
592
|
-
var _ref = [arr[j], arr[i]];
|
|
593
|
-
arr[i] = _ref[0];
|
|
594
|
-
arr[j] = _ref[1];
|
|
206
|
+
for (let i = arr.length - 1; i >= 1; i--) {
|
|
207
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
208
|
+
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
595
209
|
}
|
|
596
210
|
return arr;
|
|
597
211
|
}
|
|
598
212
|
|
|
599
|
-
|
|
600
|
-
* Returns a new array containing the first `count` elements from the input array `arr`.
|
|
601
|
-
* If `count` is greater than the length of `arr`, the entire array is returned.
|
|
602
|
-
*
|
|
603
|
-
* @template T - Type of elements in the input array.
|
|
604
|
-
*
|
|
605
|
-
* @param {T[]} arr - The array to take elements from.
|
|
606
|
-
* @param {number} count - The number of elements to take.
|
|
607
|
-
* @returns {T[]} A new array containing the first `count` elements from `arr`.
|
|
608
|
-
*
|
|
609
|
-
* @example
|
|
610
|
-
* // Returns [1, 2, 3]
|
|
611
|
-
* take([1, 2, 3, 4, 5], 3);
|
|
612
|
-
*
|
|
613
|
-
* @example
|
|
614
|
-
* // Returns ['a', 'b']
|
|
615
|
-
* take(['a', 'b', 'c'], 2);
|
|
616
|
-
*
|
|
617
|
-
* @example
|
|
618
|
-
* // Returns [1, 2, 3]
|
|
619
|
-
* take([1, 2, 3], 5);
|
|
620
|
-
*/
|
|
213
|
+
// src/array/take.ts
|
|
621
214
|
function take(arr, count) {
|
|
622
215
|
return arr.slice(0, count);
|
|
623
216
|
}
|
|
624
217
|
|
|
625
|
-
|
|
626
|
-
* Returns a new array containing the last `count` elements from the input array `arr`.
|
|
627
|
-
* If `count` is greater than the length of `arr`, the entire array is returned.
|
|
628
|
-
*
|
|
629
|
-
* @param {T[]} arr - The array to take elements from.
|
|
630
|
-
* @param {number} count - The number of elements to take.
|
|
631
|
-
* @returns {T[]} A new array containing the last `count` elements from `arr`.
|
|
632
|
-
*
|
|
633
|
-
* @example
|
|
634
|
-
* // Returns [4, 5]
|
|
635
|
-
* takeRight([1, 2, 3, 4, 5], 2);
|
|
636
|
-
*
|
|
637
|
-
* @example
|
|
638
|
-
* // Returns ['b', 'c']
|
|
639
|
-
* takeRight(['a', 'b', 'c'], 2);
|
|
640
|
-
*
|
|
641
|
-
* @example
|
|
642
|
-
* // Returns [1, 2, 3]
|
|
643
|
-
* takeRight([1, 2, 3], 5);
|
|
644
|
-
*/
|
|
218
|
+
// src/array/takeRight.ts
|
|
645
219
|
function takeRight(arr, count) {
|
|
646
220
|
if (count === 0) {
|
|
647
221
|
return [];
|
|
@@ -649,25 +223,9 @@ function takeRight(arr, count) {
|
|
|
649
223
|
return arr.slice(-count);
|
|
650
224
|
}
|
|
651
225
|
|
|
652
|
-
|
|
653
|
-
* Takes elements from the end of the array while the predicate function returns `true`.
|
|
654
|
-
*
|
|
655
|
-
* @template T - Type of elements in the input array.
|
|
656
|
-
*
|
|
657
|
-
* @param {T[]} arr - The array to take elements from.
|
|
658
|
-
* @param {function(T): boolean} shouldContinueTaking - The function invoked per element.
|
|
659
|
-
* @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.
|
|
660
|
-
*
|
|
661
|
-
* @example
|
|
662
|
-
* // Returns [3, 2, 1]
|
|
663
|
-
* takeRightWhile([5, 4, 3, 2, 1], n => n < 4);
|
|
664
|
-
*
|
|
665
|
-
* @example
|
|
666
|
-
* // Returns []
|
|
667
|
-
* takeRightWhile([1, 2, 3], n => n > 3);
|
|
668
|
-
*/
|
|
226
|
+
// src/array/takeRightWhile.ts
|
|
669
227
|
function takeRightWhile(arr, shouldContinueTaking) {
|
|
670
|
-
for (
|
|
228
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
671
229
|
if (!shouldContinueTaking(arr[i])) {
|
|
672
230
|
return arr.slice(i + 1);
|
|
673
231
|
}
|
|
@@ -675,406 +233,127 @@ function takeRightWhile(arr, shouldContinueTaking) {
|
|
|
675
233
|
return arr.slice();
|
|
676
234
|
}
|
|
677
235
|
|
|
678
|
-
|
|
679
|
-
* Returns a new array containing the leading elements of the provided array
|
|
680
|
-
* that satisfy the provided predicate function. It stops taking elements as soon
|
|
681
|
-
* as an element does not satisfy the predicate.
|
|
682
|
-
*
|
|
683
|
-
* @template T - The type of elements in the array.
|
|
684
|
-
* @param {T[]} arr - The array to process.
|
|
685
|
-
* @param {(element: T) => boolean} shouldContinueTaking - The predicate function that is called with each element. Elements are included in the result as long as this function returns true.
|
|
686
|
-
* @returns {T[]} A new array containing the leading elements that satisfy the predicate.
|
|
687
|
-
*
|
|
688
|
-
* @example
|
|
689
|
-
* // Returns [1, 2]
|
|
690
|
-
* takeWhile([1, 2, 3, 4], x => x < 3);
|
|
691
|
-
*
|
|
692
|
-
* @example
|
|
693
|
-
* // Returns []
|
|
694
|
-
* takeWhile([1, 2, 3, 4], x => x > 3);
|
|
695
|
-
*/
|
|
236
|
+
// src/array/takeWhile.ts
|
|
696
237
|
function takeWhile(arr, shouldContinueTaking) {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
702
|
-
var item = _step.value;
|
|
703
|
-
if (!shouldContinueTaking(item)) {
|
|
704
|
-
break;
|
|
705
|
-
}
|
|
706
|
-
result.push(item);
|
|
238
|
+
const result = [];
|
|
239
|
+
for (const item of arr) {
|
|
240
|
+
if (!shouldContinueTaking(item)) {
|
|
241
|
+
break;
|
|
707
242
|
}
|
|
708
|
-
|
|
709
|
-
_iterator.e(err);
|
|
710
|
-
} finally {
|
|
711
|
-
_iterator.f();
|
|
243
|
+
result.push(item);
|
|
712
244
|
}
|
|
713
245
|
return result;
|
|
714
246
|
}
|
|
715
247
|
|
|
716
|
-
|
|
717
|
-
* Creates a duplicate-free version of an array.
|
|
718
|
-
*
|
|
719
|
-
* This function takes an array and returns a new array containing only the unique values
|
|
720
|
-
* from the original array, preserving the order of first occurrence.
|
|
721
|
-
*
|
|
722
|
-
* @param {T[]} arr - The array to process.
|
|
723
|
-
* @returns {T[]} A new array with only unique values from the original array.
|
|
724
|
-
*
|
|
725
|
-
* @example
|
|
726
|
-
* * const array = [1, 2, 2, 3, 4, 4, 5];
|
|
727
|
-
* const result = uniq(array);
|
|
728
|
-
* // result will be [1, 2, 3, 4, 5]
|
|
729
|
-
*/
|
|
248
|
+
// src/array/uniq.ts
|
|
730
249
|
function uniq(arr) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
736
|
-
var item = _step.value;
|
|
737
|
-
if (result.includes(item)) {
|
|
738
|
-
continue;
|
|
739
|
-
}
|
|
740
|
-
result.push(item);
|
|
250
|
+
const result = [];
|
|
251
|
+
for (const item of arr) {
|
|
252
|
+
if (result.includes(item)) {
|
|
253
|
+
continue;
|
|
741
254
|
}
|
|
742
|
-
|
|
743
|
-
_iterator.e(err);
|
|
744
|
-
} finally {
|
|
745
|
-
_iterator.f();
|
|
255
|
+
result.push(item);
|
|
746
256
|
}
|
|
747
257
|
return result;
|
|
748
258
|
}
|
|
749
259
|
|
|
750
|
-
|
|
751
|
-
* Creates an array of unique values from all given arrays.
|
|
752
|
-
*
|
|
753
|
-
* This function takes two arrays, merges them into a single array, and returns a new array
|
|
754
|
-
* containing only the unique values from the merged array.
|
|
755
|
-
*
|
|
756
|
-
* @param {T[]} arr1 - The first array to merge and filter for unique values.
|
|
757
|
-
* @param {T[]} arr2 - The second array to merge and filter for unique values.
|
|
758
|
-
* @returns {T[]} A new array of unique values.
|
|
759
|
-
*
|
|
760
|
-
* @example
|
|
761
|
-
* const array1 = [1, 2, 3];
|
|
762
|
-
* const array2 = [3, 4, 5];
|
|
763
|
-
* const result = union(array1, array2);
|
|
764
|
-
* // result will be [1, 2, 3, 4, 5]
|
|
765
|
-
*/
|
|
260
|
+
// src/array/union.ts
|
|
766
261
|
function union(arr1, arr2) {
|
|
767
262
|
return uniq(arr1.concat(arr2));
|
|
768
263
|
}
|
|
769
264
|
|
|
770
|
-
|
|
771
|
-
* Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.
|
|
772
|
-
*
|
|
773
|
-
* @param {T[]} arr1 - The first array.
|
|
774
|
-
* @param {T[]} arr2 - The second array.
|
|
775
|
-
* @param {function(item: T): U} mapper - The function to map array elements to comparison values.
|
|
776
|
-
* @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.
|
|
777
|
-
*
|
|
778
|
-
* @example
|
|
779
|
-
* // Custom mapping function for numbers (modulo comparison)
|
|
780
|
-
* const moduloMapper = (x) => x % 3;
|
|
781
|
-
* unionBy([1, 2, 3], [4, 5, 6], moduloMapper);
|
|
782
|
-
* // Returns [1, 2, 3]
|
|
783
|
-
*
|
|
784
|
-
* @example
|
|
785
|
-
* // Custom mapping function for objects with an 'id' property
|
|
786
|
-
* const idMapper = (obj) => obj.id;
|
|
787
|
-
* unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
|
|
788
|
-
* // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]
|
|
789
|
-
*/
|
|
265
|
+
// src/array/unionBy.ts
|
|
790
266
|
function unionBy(arr1, arr2, mapper) {
|
|
791
|
-
|
|
792
|
-
for (
|
|
793
|
-
|
|
794
|
-
var key = mapper(item);
|
|
267
|
+
const map = /* @__PURE__ */ new Map();
|
|
268
|
+
for (const item of [...arr1, ...arr2]) {
|
|
269
|
+
const key = mapper(item);
|
|
795
270
|
if (!map.has(key)) {
|
|
796
271
|
map.set(key, item);
|
|
797
272
|
}
|
|
798
273
|
}
|
|
799
|
-
return
|
|
274
|
+
return [...map.values()];
|
|
800
275
|
}
|
|
801
276
|
|
|
802
|
-
|
|
803
|
-
* The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.
|
|
804
|
-
*
|
|
805
|
-
* It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.
|
|
806
|
-
*
|
|
807
|
-
* @example
|
|
808
|
-
* ```ts
|
|
809
|
-
* uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
|
|
810
|
-
* // [1, 2, 3, 5, 7]
|
|
811
|
-
* ```
|
|
812
|
-
*/
|
|
277
|
+
// src/array/uniqWith.ts
|
|
813
278
|
function uniqWith(arr, areItemsEqual) {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
var item = _step.value;
|
|
820
|
-
var isUniq = result.every(function (v) {
|
|
821
|
-
return !areItemsEqual(v, item);
|
|
822
|
-
});
|
|
823
|
-
if (isUniq) {
|
|
824
|
-
result.push(item);
|
|
825
|
-
}
|
|
826
|
-
};
|
|
827
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
828
|
-
_loop();
|
|
279
|
+
const result = [];
|
|
280
|
+
for (const item of arr) {
|
|
281
|
+
const isUniq = result.every((v) => !areItemsEqual(v, item));
|
|
282
|
+
if (isUniq) {
|
|
283
|
+
result.push(item);
|
|
829
284
|
}
|
|
830
|
-
} catch (err) {
|
|
831
|
-
_iterator.e(err);
|
|
832
|
-
} finally {
|
|
833
|
-
_iterator.f();
|
|
834
285
|
}
|
|
835
286
|
return result;
|
|
836
287
|
}
|
|
837
288
|
|
|
838
|
-
|
|
839
|
-
* Creates an array of unique values from two given arrays based on a custom equality function.
|
|
840
|
-
*
|
|
841
|
-
* This function takes two arrays and a custom equality function, merges the arrays, and returns
|
|
842
|
-
* a new array containing only the unique values as determined by the custom equality function.
|
|
843
|
-
*
|
|
844
|
-
* @param {T[]} arr1 - The first array to merge and filter for unique values.
|
|
845
|
-
* @param {T[]} arr2 - The second array to merge and filter for unique values.
|
|
846
|
-
* @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
|
|
847
|
-
* It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.
|
|
848
|
-
* @returns {T[]} A new array of unique values based on the custom equality function.
|
|
849
|
-
*
|
|
850
|
-
* @example
|
|
851
|
-
* const array1 = [{ id: 1 }, { id: 2 }];
|
|
852
|
-
* const array2 = [{ id: 2 }, { id: 3 }];
|
|
853
|
-
* const areItemsEqual = (a, b) => a.id === b.id;
|
|
854
|
-
* const result = unionWith(array1, array2, areItemsEqual);
|
|
855
|
-
* // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays
|
|
856
|
-
*/
|
|
289
|
+
// src/array/unionWith.ts
|
|
857
290
|
function unionWith(arr1, arr2, areItemsEqual) {
|
|
858
291
|
return uniqWith(arr1.concat(arr2), areItemsEqual);
|
|
859
292
|
}
|
|
860
293
|
|
|
861
|
-
|
|
862
|
-
* The `uniqBy` function takes an array as its first argument and a 'converter' function as the second. It maps the array elements using the converter function, then removes any duplicates.
|
|
863
|
-
*
|
|
864
|
-
* It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.
|
|
865
|
-
*
|
|
866
|
-
* @example
|
|
867
|
-
* ```ts
|
|
868
|
-
* uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
|
|
869
|
-
* // [1.2, 2.1, 3.3, 5.7, 7.19]
|
|
870
|
-
* ```
|
|
871
|
-
*/
|
|
294
|
+
// src/array/uniqBy.ts
|
|
872
295
|
function uniqBy(arr, converter) {
|
|
873
|
-
return uniqWith(arr,
|
|
874
|
-
return converter(item1) === converter(item2);
|
|
875
|
-
});
|
|
296
|
+
return uniqWith(arr, (item1, item2) => converter(item1) === converter(item2));
|
|
876
297
|
}
|
|
877
298
|
|
|
878
|
-
|
|
879
|
-
* Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
|
|
880
|
-
* which are in either of the arrays, but not in their intersection.
|
|
881
|
-
*
|
|
882
|
-
* @param {T[]} arr1 - The first array.
|
|
883
|
-
* @param {T[]} arr2 - The second array.
|
|
884
|
-
* @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.
|
|
885
|
-
*
|
|
886
|
-
* @example
|
|
887
|
-
* // Returns [1, 2, 5, 6]
|
|
888
|
-
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
|
889
|
-
*
|
|
890
|
-
* @example
|
|
891
|
-
* // Returns ['a', 'c']
|
|
892
|
-
* xor(['a', 'b'], ['b', 'c']);
|
|
893
|
-
*/
|
|
299
|
+
// src/array/xor.ts
|
|
894
300
|
function xor(arr1, arr2) {
|
|
895
301
|
return difference(union(arr1, arr2), intersection(arr1, arr2));
|
|
896
302
|
}
|
|
897
303
|
|
|
898
|
-
|
|
899
|
-
* Computes the symmetric difference between two arrays using a custom mapping function.
|
|
900
|
-
* The symmetric difference is the set of elements which are in either of the arrays,
|
|
901
|
-
* but not in their intersection, determined by the result of the mapping function.
|
|
902
|
-
*
|
|
903
|
-
* @template T - Type of elements in the input arrays.
|
|
904
|
-
* @template U - Type of the values returned by the mapping function.
|
|
905
|
-
*
|
|
906
|
-
* @param {T[]} arr1 - The first array.
|
|
907
|
-
* @param {T[]} arr2 - The second array.
|
|
908
|
-
* @param {function(item: T): U} mapper - The function to map array elements to comparison values.
|
|
909
|
-
* @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.
|
|
910
|
-
*
|
|
911
|
-
* @example
|
|
912
|
-
* // Custom mapping function for objects with an 'id' property
|
|
913
|
-
* const idMapper = obj => obj.id;
|
|
914
|
-
* xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
|
|
915
|
-
* // Returns [{ id: 1 }, { id: 3 }]
|
|
916
|
-
*/
|
|
304
|
+
// src/array/xorBy.ts
|
|
917
305
|
function xorBy(arr1, arr2, mapper) {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
return differenceBy(
|
|
306
|
+
const union2 = unionBy(arr1, arr2, mapper);
|
|
307
|
+
const intersection2 = intersectionBy(arr1, arr2, mapper);
|
|
308
|
+
return differenceBy(union2, intersection2, mapper);
|
|
921
309
|
}
|
|
922
310
|
|
|
923
|
-
|
|
924
|
-
* Computes the symmetric difference between two arrays using a custom equality function.
|
|
925
|
-
* The symmetric difference is the set of elements which are in either of the arrays,
|
|
926
|
-
* but not in their intersection.
|
|
927
|
-
*
|
|
928
|
-
* @template T - Type of elements in the input arrays.
|
|
929
|
-
*
|
|
930
|
-
* @param {T[]} arr1 - The first array.
|
|
931
|
-
* @param {T[]} arr2 - The second array.
|
|
932
|
-
* @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.
|
|
933
|
-
* @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.
|
|
934
|
-
*
|
|
935
|
-
* @example
|
|
936
|
-
* // Custom equality function for objects with an 'id' property
|
|
937
|
-
* const areObjectsEqual = (a, b) => a.id === b.id;
|
|
938
|
-
* xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);
|
|
939
|
-
* // Returns [{ id: 1 }, { id: 3 }]
|
|
940
|
-
*/
|
|
311
|
+
// src/array/xorWith.ts
|
|
941
312
|
function xorWith(arr1, arr2, areElementsEqual) {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
return differenceWith(
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
* @param {...T[][]} arrs - The arrays to zip together.
|
|
956
|
-
* @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.
|
|
957
|
-
*
|
|
958
|
-
* @example
|
|
959
|
-
* const arr1 = [1, 2, 3];
|
|
960
|
-
* const arr2 = ['a', 'b', 'c'];
|
|
961
|
-
* const result = zip(arr1, arr2);
|
|
962
|
-
* // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
|
|
963
|
-
*
|
|
964
|
-
* const arr3 = [true, false];
|
|
965
|
-
* const result2 = zip(arr1, arr2, arr3);
|
|
966
|
-
* // result2 will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
|
|
967
|
-
*/
|
|
968
|
-
|
|
969
|
-
function zip() {
|
|
970
|
-
var result = [];
|
|
971
|
-
for (var _len = arguments.length, arrs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
972
|
-
arrs[_key] = arguments[_key];
|
|
973
|
-
}
|
|
974
|
-
var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (x) {
|
|
975
|
-
return x.length;
|
|
976
|
-
})));
|
|
977
|
-
for (var i = 0; i < maxIndex; i++) {
|
|
978
|
-
var element = [];
|
|
979
|
-
var _iterator = _createForOfIteratorHelper(arrs),
|
|
980
|
-
_step;
|
|
981
|
-
try {
|
|
982
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
983
|
-
var arr = _step.value;
|
|
984
|
-
element.push(arr[i]);
|
|
985
|
-
}
|
|
986
|
-
} catch (err) {
|
|
987
|
-
_iterator.e(err);
|
|
988
|
-
} finally {
|
|
989
|
-
_iterator.f();
|
|
313
|
+
const union2 = unionWith(arr1, arr2, areElementsEqual);
|
|
314
|
+
const intersection2 = intersectionWith(arr1, arr2, areElementsEqual);
|
|
315
|
+
return differenceWith(union2, intersection2, areElementsEqual);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/array/zip.ts
|
|
319
|
+
function zip(...arrs) {
|
|
320
|
+
const result = [];
|
|
321
|
+
const maxIndex = Math.max(...arrs.map((x) => x.length));
|
|
322
|
+
for (let i = 0; i < maxIndex; i++) {
|
|
323
|
+
const element = [];
|
|
324
|
+
for (const arr of arrs) {
|
|
325
|
+
element.push(arr[i]);
|
|
990
326
|
}
|
|
991
327
|
result.push(element);
|
|
992
328
|
}
|
|
993
329
|
return result;
|
|
994
330
|
}
|
|
995
331
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
* @param {W[]} [arr4] - The fourth array to zip (optional).
|
|
1006
|
-
* @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|
1007
|
-
* @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|
1008
|
-
*
|
|
1009
|
-
* @example
|
|
1010
|
-
* // Example usage with two arrays:
|
|
1011
|
-
* const arr1 = [1, 2, 3];
|
|
1012
|
-
* const arr2 = [4, 5, 6];
|
|
1013
|
-
* const result = zipWith(arr1, arr2, (a, b) => a + b);
|
|
1014
|
-
* // result will be [5, 7, 9]
|
|
1015
|
-
*
|
|
1016
|
-
* @example
|
|
1017
|
-
* // Example usage with three arrays:
|
|
1018
|
-
* const arr1 = [1, 2];
|
|
1019
|
-
* const arr2 = [3, 4];
|
|
1020
|
-
* const arr3 = [5, 6];
|
|
1021
|
-
* const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);
|
|
1022
|
-
* // result will be [`135`, `246`]
|
|
1023
|
-
*/
|
|
1024
|
-
|
|
1025
|
-
function zipWith(arr1) {
|
|
1026
|
-
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1027
|
-
rest[_key - 1] = arguments[_key];
|
|
1028
|
-
}
|
|
1029
|
-
var arrs = [arr1].concat(_toConsumableArray(rest.slice(0, -1)));
|
|
1030
|
-
var combine = rest[rest.length - 1];
|
|
1031
|
-
var result = [];
|
|
1032
|
-
var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (arr) {
|
|
1033
|
-
return arr.length;
|
|
1034
|
-
})));
|
|
1035
|
-
var _loop = function _loop(i) {
|
|
1036
|
-
var elements = arrs.map(function (arr) {
|
|
1037
|
-
return arr[i];
|
|
1038
|
-
});
|
|
1039
|
-
result.push(combine.apply(void 0, _toConsumableArray(elements)));
|
|
1040
|
-
};
|
|
1041
|
-
for (var i = 0; i < maxIndex; i++) {
|
|
1042
|
-
_loop(i);
|
|
332
|
+
// src/array/zipWith.ts
|
|
333
|
+
function zipWith(arr1, ...rest) {
|
|
334
|
+
const arrs = [arr1, ...rest.slice(0, -1)];
|
|
335
|
+
const combine = rest[rest.length - 1];
|
|
336
|
+
const result = [];
|
|
337
|
+
const maxIndex = Math.max(...arrs.map((arr) => arr.length));
|
|
338
|
+
for (let i = 0; i < maxIndex; i++) {
|
|
339
|
+
const elements = arrs.map((arr) => arr[i]);
|
|
340
|
+
result.push(combine(...elements));
|
|
1043
341
|
}
|
|
1044
342
|
return result;
|
|
1045
343
|
}
|
|
1046
344
|
|
|
1047
|
-
|
|
1048
|
-
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
|
1049
|
-
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
|
1050
|
-
* method to cancel any pending execution.
|
|
1051
|
-
*
|
|
1052
|
-
* @param {() => void} func - The function to debounce.
|
|
1053
|
-
* @param {number} debounceMs - The number of milliseconds to delay.
|
|
1054
|
-
* @returns {{ (): void; cancel: () => void }} A new debounced function with a `cancel` method.
|
|
1055
|
-
*
|
|
1056
|
-
* @example
|
|
1057
|
-
* const debouncedFunction = debounce(() => {
|
|
1058
|
-
* console.log('Function executed');
|
|
1059
|
-
* }, 1000);
|
|
1060
|
-
*
|
|
1061
|
-
* // Will log 'Function executed' after 1 second if not called again in that time
|
|
1062
|
-
* debouncedFunction();
|
|
1063
|
-
*
|
|
1064
|
-
* // Will not log anything as the previous call is canceled
|
|
1065
|
-
* debouncedFunction.cancel();
|
|
1066
|
-
*/
|
|
345
|
+
// src/function/debounce.ts
|
|
1067
346
|
function debounce(func, debounceMs) {
|
|
1068
|
-
|
|
1069
|
-
|
|
347
|
+
let timeoutId = null;
|
|
348
|
+
const debounced = function() {
|
|
1070
349
|
if (timeoutId != null) {
|
|
1071
350
|
clearTimeout(timeoutId);
|
|
1072
351
|
}
|
|
1073
|
-
timeoutId = setTimeout(
|
|
352
|
+
timeoutId = setTimeout(() => {
|
|
1074
353
|
func();
|
|
1075
354
|
}, debounceMs);
|
|
1076
355
|
};
|
|
1077
|
-
debounced.cancel = function
|
|
356
|
+
debounced.cancel = function() {
|
|
1078
357
|
if (timeoutId != null) {
|
|
1079
358
|
clearTimeout(timeoutId);
|
|
1080
359
|
}
|
|
@@ -1082,65 +361,26 @@ function debounce(func, debounceMs) {
|
|
|
1082
361
|
return debounced;
|
|
1083
362
|
}
|
|
1084
363
|
|
|
1085
|
-
|
|
1086
|
-
* Creates a function that is restricted to invoking the provided function `func` once.
|
|
1087
|
-
* Repeated calls to the function will return the value from the first invocation.
|
|
1088
|
-
*
|
|
1089
|
-
* @param {F} func - The function to restrict.
|
|
1090
|
-
* @returns {F} A new function that invokes `func` once and caches the result.
|
|
1091
|
-
*
|
|
1092
|
-
* @example
|
|
1093
|
-
* const initialize = once(() => {
|
|
1094
|
-
* console.log('Initialized!');
|
|
1095
|
-
* return true;
|
|
1096
|
-
* });
|
|
1097
|
-
*
|
|
1098
|
-
* initialize(); // Logs: 'Initialized!' and returns true
|
|
1099
|
-
* initialize(); // Returns true without logging
|
|
1100
|
-
*/
|
|
364
|
+
// src/function/once.ts
|
|
1101
365
|
function once(func) {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
return function
|
|
366
|
+
let called = false;
|
|
367
|
+
let cache;
|
|
368
|
+
return function() {
|
|
1105
369
|
if (called) {
|
|
1106
370
|
return cache;
|
|
1107
371
|
}
|
|
1108
|
-
|
|
372
|
+
const result = func();
|
|
1109
373
|
called = true;
|
|
1110
374
|
cache = result;
|
|
1111
375
|
return result;
|
|
1112
376
|
};
|
|
1113
377
|
}
|
|
1114
378
|
|
|
1115
|
-
|
|
1116
|
-
* Creates a throttled function that only invokes the provided function at most once
|
|
1117
|
-
* per every `throttleMs` milliseconds. Subsequent calls to the throttled function
|
|
1118
|
-
* within the wait time will not trigger the execution of the original function.
|
|
1119
|
-
*
|
|
1120
|
-
* @param {() => void} func - The function to throttle.
|
|
1121
|
-
* @param {number} throttleMs - The number of milliseconds to throttle executions to.
|
|
1122
|
-
* @returns {() => void} A new throttled function.
|
|
1123
|
-
*
|
|
1124
|
-
* @example
|
|
1125
|
-
* const throttledFunction = throttle(() => {
|
|
1126
|
-
* console.log('Function executed');
|
|
1127
|
-
* }, 1000);
|
|
1128
|
-
*
|
|
1129
|
-
* // Will log 'Function executed' immediately
|
|
1130
|
-
* throttledFunction();
|
|
1131
|
-
*
|
|
1132
|
-
* // Will not log anything as it is within the throttle time
|
|
1133
|
-
* throttledFunction();
|
|
1134
|
-
*
|
|
1135
|
-
* // After 1 second
|
|
1136
|
-
* setTimeout(() => {
|
|
1137
|
-
* throttledFunction(); // Will log 'Function executed'
|
|
1138
|
-
* }, 1000);
|
|
1139
|
-
*/
|
|
379
|
+
// src/function/throttle.ts
|
|
1140
380
|
function throttle(func, throttleMs) {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
381
|
+
let lastCallTime;
|
|
382
|
+
const throttledFunction = function() {
|
|
383
|
+
const now = Date.now();
|
|
1144
384
|
if (lastCallTime == null || now - lastCallTime >= throttleMs) {
|
|
1145
385
|
lastCallTime = now;
|
|
1146
386
|
func();
|
|
@@ -1149,24 +389,7 @@ function throttle(func, throttleMs) {
|
|
|
1149
389
|
return throttledFunction;
|
|
1150
390
|
}
|
|
1151
391
|
|
|
1152
|
-
|
|
1153
|
-
* Clamps a number within the inclusive lower and upper bounds.
|
|
1154
|
-
*
|
|
1155
|
-
* This function takes a number and two bounds, and returns the number clamped within the specified bounds.
|
|
1156
|
-
* If only one bound is provided, it returns the minimum of the value and the bound.
|
|
1157
|
-
*
|
|
1158
|
-
* @param {number} value - The number to clamp.
|
|
1159
|
-
* @param {number} minimum - The minimum bound to clamp the number.
|
|
1160
|
-
* @param {number} maximum - The maximum bound to clamp the number.
|
|
1161
|
-
* @returns {number} The clamped number within the specified bounds.
|
|
1162
|
-
*
|
|
1163
|
-
* @example
|
|
1164
|
-
* * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
|
|
1165
|
-
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
|
|
1166
|
-
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
|
|
1167
|
-
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
|
|
1168
|
-
*/
|
|
1169
|
-
|
|
392
|
+
// src/math/clamp.ts
|
|
1170
393
|
function clamp(value, bound1, bound2) {
|
|
1171
394
|
if (bound2 == null) {
|
|
1172
395
|
return Math.min(value, bound1);
|
|
@@ -1174,113 +397,34 @@ function clamp(value, bound1, bound2) {
|
|
|
1174
397
|
return Math.min(Math.max(value, bound1), bound2);
|
|
1175
398
|
}
|
|
1176
399
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
* This function takes a number and an optional precision value, and returns the number rounded
|
|
1181
|
-
* to the specified number of decimal places.
|
|
1182
|
-
*
|
|
1183
|
-
* @param {number} value - The number to round.
|
|
1184
|
-
* @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.
|
|
1185
|
-
* @returns {number} The rounded number.
|
|
1186
|
-
*
|
|
1187
|
-
* @example
|
|
1188
|
-
* * const result1 = round(1.2345); // result1 will be 1
|
|
1189
|
-
* const result2 = round(1.2345, 2); // result2 will be 1.23
|
|
1190
|
-
* const result3 = round(1.2345, 3); // result3 will be 1.235
|
|
1191
|
-
*/
|
|
1192
|
-
function round(value) {
|
|
1193
|
-
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1194
|
-
var multiplier = Math.pow(10, precision);
|
|
400
|
+
// src/math/round.ts
|
|
401
|
+
function round(value, precision = 0) {
|
|
402
|
+
const multiplier = Math.pow(10, precision);
|
|
1195
403
|
return Math.round(value * multiplier) / multiplier;
|
|
1196
404
|
}
|
|
1197
405
|
|
|
1198
|
-
|
|
1199
|
-
* Calculates the sum of an array of numbers.
|
|
1200
|
-
*
|
|
1201
|
-
* This function takes an array of numbers and returns the sum of all the elements in the array.
|
|
1202
|
-
*
|
|
1203
|
-
* @param {number[]} nums - An array of numbers to be summed.
|
|
1204
|
-
* @returns {number} The sum of all the numbers in the array.
|
|
1205
|
-
*
|
|
1206
|
-
* @example
|
|
1207
|
-
* * const numbers = [1, 2, 3, 4, 5];
|
|
1208
|
-
* const result = sum(numbers);
|
|
1209
|
-
* // result will be 15
|
|
1210
|
-
*/
|
|
406
|
+
// src/math/sum.ts
|
|
1211
407
|
function sum(nums) {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
try {
|
|
1216
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1217
|
-
var num = _step.value;
|
|
1218
|
-
result += num;
|
|
1219
|
-
}
|
|
1220
|
-
} catch (err) {
|
|
1221
|
-
_iterator.e(err);
|
|
1222
|
-
} finally {
|
|
1223
|
-
_iterator.f();
|
|
408
|
+
let result = 0;
|
|
409
|
+
for (const num of nums) {
|
|
410
|
+
result += num;
|
|
1224
411
|
}
|
|
1225
412
|
return result;
|
|
1226
413
|
}
|
|
1227
414
|
|
|
1228
|
-
|
|
1229
|
-
* Creates a new object with specified keys omitted.
|
|
1230
|
-
*
|
|
1231
|
-
* This function takes an object and an array of keys, and returns a new object that
|
|
1232
|
-
* excludes the properties corresponding to the specified keys.
|
|
1233
|
-
*
|
|
1234
|
-
* @param {T} obj - The object to omit keys from.
|
|
1235
|
-
* @param {K[]} keys - An array of keys to be omitted from the object.
|
|
1236
|
-
* @returns {Omit<T, K>} A new object with the specified keys omitted.
|
|
1237
|
-
*
|
|
1238
|
-
* @example
|
|
1239
|
-
* * const obj = { a: 1, b: 2, c: 3 };
|
|
1240
|
-
* const result = omit(obj, ['b', 'c']);
|
|
1241
|
-
* // result will be { a: 1 }
|
|
1242
|
-
*/
|
|
415
|
+
// src/object/omit.ts
|
|
1243
416
|
function omit(obj, keys) {
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
try {
|
|
1248
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1249
|
-
var key = _step.value;
|
|
1250
|
-
delete result[key];
|
|
1251
|
-
}
|
|
1252
|
-
} catch (err) {
|
|
1253
|
-
_iterator.e(err);
|
|
1254
|
-
} finally {
|
|
1255
|
-
_iterator.f();
|
|
417
|
+
const result = __spreadValues({}, obj);
|
|
418
|
+
for (const key of keys) {
|
|
419
|
+
delete result[key];
|
|
1256
420
|
}
|
|
1257
421
|
return result;
|
|
1258
422
|
}
|
|
1259
423
|
|
|
1260
|
-
|
|
1261
|
-
* Creates a new object composed of the properties that do not satisfy the predicate function.
|
|
1262
|
-
*
|
|
1263
|
-
* This function takes an object and a predicate function, and returns a new object that
|
|
1264
|
-
* includes only the properties for which the predicate function returns false.
|
|
1265
|
-
*
|
|
1266
|
-
* @param {T} obj - The object to omit properties from.
|
|
1267
|
-
* @param {(value: T[string], key: string) => boolean} shouldOmit - A predicate function that determines
|
|
1268
|
-
* whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
|
|
1269
|
-
* if the property should be omitted, and `false` otherwise.
|
|
1270
|
-
* @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.
|
|
1271
|
-
*
|
|
1272
|
-
* @example
|
|
1273
|
-
* const obj = { a: 1, b: 'omit', c: 3 };
|
|
1274
|
-
* const shouldOmit = (key, value) => typeof value === 'string';
|
|
1275
|
-
* const result = omitBy(obj, shouldOmit);
|
|
1276
|
-
* // result will be { a: 1, c: 3 }
|
|
1277
|
-
*/
|
|
424
|
+
// src/object/omitBy.ts
|
|
1278
425
|
function omitBy(obj, shouldOmit) {
|
|
1279
|
-
|
|
1280
|
-
for (
|
|
1281
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
1282
|
-
key = _Object$entries$_i[0],
|
|
1283
|
-
value = _Object$entries$_i[1];
|
|
426
|
+
const result = {};
|
|
427
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1284
428
|
if (shouldOmit(value, key)) {
|
|
1285
429
|
continue;
|
|
1286
430
|
}
|
|
@@ -1289,62 +433,19 @@ function omitBy(obj, shouldOmit) {
|
|
|
1289
433
|
return result;
|
|
1290
434
|
}
|
|
1291
435
|
|
|
1292
|
-
|
|
1293
|
-
* Creates a new object composed of the picked object properties.
|
|
1294
|
-
*
|
|
1295
|
-
* This function takes an object and an array of keys, and returns a new object that
|
|
1296
|
-
* includes only the properties corresponding to the specified keys.
|
|
1297
|
-
*
|
|
1298
|
-
* @param {T} obj - The object to pick keys from.
|
|
1299
|
-
* @param {K[]} keys - An array of keys to be picked from the object.
|
|
1300
|
-
* @returns {Pick<T, K>} A new object with the specified keys picked.
|
|
1301
|
-
*
|
|
1302
|
-
* @example
|
|
1303
|
-
* * const obj = { a: 1, b: 2, c: 3 };
|
|
1304
|
-
* const result = pick(obj, ['a', 'c']);
|
|
1305
|
-
* // result will be { a: 1, c: 3 }
|
|
1306
|
-
*/
|
|
436
|
+
// src/object/pick.ts
|
|
1307
437
|
function pick(obj, keys) {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
try {
|
|
1312
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1313
|
-
var key = _step.value;
|
|
1314
|
-
result[key] = obj[key];
|
|
1315
|
-
}
|
|
1316
|
-
} catch (err) {
|
|
1317
|
-
_iterator.e(err);
|
|
1318
|
-
} finally {
|
|
1319
|
-
_iterator.f();
|
|
438
|
+
const result = {};
|
|
439
|
+
for (const key of keys) {
|
|
440
|
+
result[key] = obj[key];
|
|
1320
441
|
}
|
|
1321
442
|
return result;
|
|
1322
443
|
}
|
|
1323
444
|
|
|
1324
|
-
|
|
1325
|
-
* Creates a new object composed of the properties that satisfy the predicate function.
|
|
1326
|
-
*
|
|
1327
|
-
* This function takes an object and a predicate function, and returns a new object that
|
|
1328
|
-
* includes only the properties for which the predicate function returns true.
|
|
1329
|
-
*
|
|
1330
|
-
* @param {T} obj - The object to pick properties from.
|
|
1331
|
-
* @param {(value: T[keyof T], key: string) => boolean} shouldPick - A predicate function that determines
|
|
1332
|
-
* whether a property should be picked. It takes the property's key and value as arguments and returns `true`
|
|
1333
|
-
* if the property should be picked, and `false` otherwise.
|
|
1334
|
-
* @returns {Partial<T>} A new object with the properties that satisfy the predicate function.
|
|
1335
|
-
*
|
|
1336
|
-
* @example
|
|
1337
|
-
* const obj = { a: 1, b: 'pick', c: 3 };
|
|
1338
|
-
* const shouldPick = (value) => typeof value === 'string';
|
|
1339
|
-
* const result = pickBy(obj, shouldPick);
|
|
1340
|
-
* // result will be { b: 'pick' }
|
|
1341
|
-
*/
|
|
445
|
+
// src/object/pickBy.ts
|
|
1342
446
|
function pickBy(obj, shouldPick) {
|
|
1343
|
-
|
|
1344
|
-
for (
|
|
1345
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
1346
|
-
key = _Object$entries$_i[0],
|
|
1347
|
-
value = _Object$entries$_i[1];
|
|
447
|
+
const result = {};
|
|
448
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1348
449
|
if (!shouldPick(value, key)) {
|
|
1349
450
|
continue;
|
|
1350
451
|
}
|
|
@@ -1353,162 +454,78 @@ function pickBy(obj, shouldPick) {
|
|
|
1353
454
|
return result;
|
|
1354
455
|
}
|
|
1355
456
|
|
|
1356
|
-
|
|
1357
|
-
* Checks if a given value is null or undefined.
|
|
1358
|
-
*
|
|
1359
|
-
* This function tests whether the provided value is either `null` or `undefined`.
|
|
1360
|
-
* It returns `true` if the value is `null` or `undefined`, and `false` otherwise.
|
|
1361
|
-
*
|
|
1362
|
-
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.
|
|
1363
|
-
*
|
|
1364
|
-
* @param {unknown} x - The value to test for null or undefined.
|
|
1365
|
-
* @returns {boolean} `true` if the value is null or undefined, `false` otherwise.
|
|
1366
|
-
*
|
|
1367
|
-
* @example
|
|
1368
|
-
* * const value1 = null;
|
|
1369
|
-
* const value2 = undefined;
|
|
1370
|
-
* const value3 = 42;
|
|
1371
|
-
* const result1 = isNil(value1); // true
|
|
1372
|
-
* const result2 = isNil(value2); // true
|
|
1373
|
-
* const result3 = isNil(value3); // false
|
|
1374
|
-
*/
|
|
457
|
+
// src/predicate/isNil.ts
|
|
1375
458
|
function isNil(x) {
|
|
1376
|
-
return x
|
|
459
|
+
return x === null || x === void 0;
|
|
1377
460
|
}
|
|
1378
461
|
|
|
1379
|
-
|
|
1380
|
-
* Checks if the given value is not null nor undefined.
|
|
1381
|
-
*
|
|
1382
|
-
* The main use of this function is to be used with TypeScript as a type predicate.
|
|
1383
|
-
*
|
|
1384
|
-
* @param {T | null | undefined} x - The value to test if it is not null nor undefined.
|
|
1385
|
-
* @returns {x is T} True if the value is not null nor undefined, false otherwise.
|
|
1386
|
-
*
|
|
1387
|
-
* @example
|
|
1388
|
-
* // Here the type of `arr` is (number | undefined)[]
|
|
1389
|
-
* const arr = [1, undefined, 3];
|
|
1390
|
-
* // Here the type of `result` is number[]
|
|
1391
|
-
* const result = arr.filter(isNotNil);
|
|
1392
|
-
* // result will be [1, 3]
|
|
1393
|
-
*/
|
|
462
|
+
// src/predicate/isNotNil.ts
|
|
1394
463
|
function isNotNil(x) {
|
|
1395
|
-
return x
|
|
464
|
+
return x !== null && x !== void 0;
|
|
1396
465
|
}
|
|
1397
466
|
|
|
1398
|
-
|
|
1399
|
-
* Checks if the given value is null.
|
|
1400
|
-
*
|
|
1401
|
-
* This function tests whether the provided value is strictly equal to `null`.
|
|
1402
|
-
* It returns `true` if the value is `null`, and `false` otherwise.
|
|
1403
|
-
*
|
|
1404
|
-
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.
|
|
1405
|
-
*
|
|
1406
|
-
* @param {unknown} x - The value to test if it is null.
|
|
1407
|
-
* @returns {x is null} True if the value is null, false otherwise.
|
|
1408
|
-
*
|
|
1409
|
-
* @example
|
|
1410
|
-
* * const value1 = null;
|
|
1411
|
-
* const value2 = undefined;
|
|
1412
|
-
* const value3 = 42;
|
|
1413
|
-
*
|
|
1414
|
-
* console.log(isNull(value1)); // true
|
|
1415
|
-
* console.log(isNull(value2)); // false
|
|
1416
|
-
* console.log(isNull(value3)); // false
|
|
1417
|
-
*/
|
|
467
|
+
// src/predicate/isNull.ts
|
|
1418
468
|
function isNull(x) {
|
|
1419
469
|
return x === null;
|
|
1420
470
|
}
|
|
1421
471
|
|
|
1422
|
-
|
|
1423
|
-
* Checks if the given value is undefined.
|
|
1424
|
-
*
|
|
1425
|
-
* This function tests whether the provided value is strictly equal to `undefined`.
|
|
1426
|
-
* It returns `true` if the value is `undefined`, and `false` otherwise.
|
|
1427
|
-
*
|
|
1428
|
-
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.
|
|
1429
|
-
*
|
|
1430
|
-
* @param {unknown} x - The value to test if it is undefined.
|
|
1431
|
-
* @returns {x is undefined} true if the value is undefined, false otherwise.
|
|
1432
|
-
*
|
|
1433
|
-
* @example
|
|
1434
|
-
* * const value1 = undefined;
|
|
1435
|
-
* const value2 = null;
|
|
1436
|
-
* const value3 = 42;
|
|
1437
|
-
*
|
|
1438
|
-
* console.log(isUndefined(value1)); // true
|
|
1439
|
-
* console.log(isUndefined(value2)); // false
|
|
1440
|
-
* console.log(isUndefined(value3)); // false
|
|
1441
|
-
*/
|
|
472
|
+
// src/predicate/isUndefined.ts
|
|
1442
473
|
function isUndefined(x) {
|
|
1443
|
-
return x ===
|
|
474
|
+
return x === void 0;
|
|
1444
475
|
}
|
|
1445
476
|
|
|
1446
|
-
|
|
1447
|
-
* Delays the execution of code for a specified number of milliseconds.
|
|
1448
|
-
*
|
|
1449
|
-
* This function returns a Promise that resolves after the specified delay, allowing you to use it
|
|
1450
|
-
* with async/await to pause execution.
|
|
1451
|
-
*
|
|
1452
|
-
* @param {number} ms - The number of milliseconds to delay.
|
|
1453
|
-
* @returns {Promise<void>} A Promise that resolves after the specified delay.
|
|
1454
|
-
*
|
|
1455
|
-
* @example
|
|
1456
|
-
* async function foo() {
|
|
1457
|
-
* console.log('Start');
|
|
1458
|
-
* await delay(1000); // Delays execution for 1 second
|
|
1459
|
-
* console.log('End');
|
|
1460
|
-
* }
|
|
1461
|
-
*
|
|
1462
|
-
* foo();
|
|
1463
|
-
*/
|
|
477
|
+
// src/promise/delay.ts
|
|
1464
478
|
function delay(ms) {
|
|
1465
|
-
return new Promise(
|
|
479
|
+
return new Promise((resolve) => {
|
|
1466
480
|
setTimeout(resolve, ms);
|
|
1467
481
|
});
|
|
1468
482
|
}
|
|
1469
|
-
|
|
1470
|
-
exports
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
483
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
484
|
+
0 && (module.exports = {
|
|
485
|
+
chunk,
|
|
486
|
+
clamp,
|
|
487
|
+
debounce,
|
|
488
|
+
delay,
|
|
489
|
+
difference,
|
|
490
|
+
differenceBy,
|
|
491
|
+
differenceWith,
|
|
492
|
+
drop,
|
|
493
|
+
dropRight,
|
|
494
|
+
dropRightWhile,
|
|
495
|
+
dropWhile,
|
|
496
|
+
groupBy,
|
|
497
|
+
intersection,
|
|
498
|
+
intersectionBy,
|
|
499
|
+
intersectionWith,
|
|
500
|
+
isNil,
|
|
501
|
+
isNotNil,
|
|
502
|
+
isNull,
|
|
503
|
+
isUndefined,
|
|
504
|
+
omit,
|
|
505
|
+
omitBy,
|
|
506
|
+
once,
|
|
507
|
+
partition,
|
|
508
|
+
pick,
|
|
509
|
+
pickBy,
|
|
510
|
+
round,
|
|
511
|
+
sample,
|
|
512
|
+
shuffle,
|
|
513
|
+
sum,
|
|
514
|
+
take,
|
|
515
|
+
takeRight,
|
|
516
|
+
takeRightWhile,
|
|
517
|
+
takeWhile,
|
|
518
|
+
throttle,
|
|
519
|
+
union,
|
|
520
|
+
unionBy,
|
|
521
|
+
unionWith,
|
|
522
|
+
uniq,
|
|
523
|
+
uniqBy,
|
|
524
|
+
uniqWith,
|
|
525
|
+
xor,
|
|
526
|
+
xorBy,
|
|
527
|
+
xorWith,
|
|
528
|
+
zip,
|
|
529
|
+
zipWith
|
|
530
|
+
});
|
|
531
|
+
//# sourceMappingURL=index.js.map
|