es-toolkit 1.0.3 → 1.0.4-dev.41
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/README.md +0 -1
- 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-23DC774L.mjs +13 -0
- package/dist/chunk-23DC774L.mjs.map +1 -0
- package/dist/chunk-2MM5EJJX.mjs +21 -0
- package/dist/chunk-2MM5EJJX.mjs.map +1 -0
- package/dist/chunk-2PB2OCC6.mjs +11 -0
- package/dist/chunk-2PB2OCC6.mjs.map +1 -0
- package/dist/chunk-3PFYAKOD.mjs +10 -0
- package/dist/chunk-3PFYAKOD.mjs.map +1 -0
- package/dist/chunk-4USR24DP.mjs +23 -0
- package/dist/chunk-4USR24DP.mjs.map +1 -0
- package/dist/chunk-6BCRFIEW.mjs +9 -0
- package/dist/chunk-6BCRFIEW.mjs.map +1 -0
- package/dist/chunk-6GRNTXI3.mjs +9 -0
- package/dist/chunk-6GRNTXI3.mjs.map +1 -0
- package/dist/chunk-6LDIBBWQ.mjs +15 -0
- package/dist/chunk-6LDIBBWQ.mjs.map +1 -0
- package/dist/chunk-7LAOIS6P.mjs +13 -0
- package/dist/chunk-7LAOIS6P.mjs.map +1 -0
- package/dist/chunk-AFYV2UVZ.mjs +13 -0
- package/dist/chunk-AFYV2UVZ.mjs.map +1 -0
- package/dist/chunk-ANJSX6WH.mjs +12 -0
- package/dist/chunk-ANJSX6WH.mjs.map +1 -0
- package/dist/chunk-ARZ5BDR6.mjs +1 -0
- package/dist/chunk-ARZ5BDR6.mjs.map +1 -0
- package/dist/chunk-B5P232BA.mjs +13 -0
- package/dist/chunk-B5P232BA.mjs.map +1 -0
- package/dist/chunk-EJGAXTF7.mjs +1 -0
- package/dist/chunk-EJGAXTF7.mjs.map +1 -0
- package/dist/chunk-GLAZTR32.mjs +13 -0
- package/dist/chunk-GLAZTR32.mjs.map +1 -0
- package/dist/chunk-HOQRMBSB.mjs +9 -0
- package/dist/chunk-HOQRMBSB.mjs.map +1 -0
- package/dist/chunk-IFCX35BI.mjs +14 -0
- package/dist/chunk-IFCX35BI.mjs.map +1 -0
- package/dist/chunk-IJLQVGW4.mjs +1 -0
- package/dist/chunk-IJLQVGW4.mjs.map +1 -0
- package/dist/chunk-J6SWM4X6.mjs +17 -0
- package/dist/chunk-J6SWM4X6.mjs.map +1 -0
- package/dist/chunk-JDMFIUGM.mjs +16 -0
- package/dist/chunk-JDMFIUGM.mjs.map +1 -0
- package/dist/chunk-KBJTBR5T.mjs +9 -0
- package/dist/chunk-KBJTBR5T.mjs.map +1 -0
- package/dist/chunk-L25VRQ54.mjs +18 -0
- package/dist/chunk-L25VRQ54.mjs.map +1 -0
- package/dist/chunk-L3C6TG2V.mjs +12 -0
- package/dist/chunk-L3C6TG2V.mjs.map +1 -0
- package/dist/chunk-LLOAPSQ6.mjs +16 -0
- package/dist/chunk-LLOAPSQ6.mjs.map +1 -0
- package/dist/chunk-M3SHJ3LL.mjs +13 -0
- package/dist/chunk-M3SHJ3LL.mjs.map +1 -0
- package/dist/chunk-MAJSPFA6.mjs +1 -0
- package/dist/chunk-MAJSPFA6.mjs.map +1 -0
- package/dist/chunk-MQZ5D4IU.mjs +17 -0
- package/dist/chunk-MQZ5D4IU.mjs.map +1 -0
- package/dist/chunk-OLBUAFBX.mjs +9 -0
- package/dist/chunk-OLBUAFBX.mjs.map +1 -0
- package/dist/chunk-OS5PZ4B4.mjs +19 -0
- package/dist/chunk-OS5PZ4B4.mjs.map +1 -0
- package/dist/chunk-PHG5JCSW.mjs +10 -0
- package/dist/chunk-PHG5JCSW.mjs.map +1 -0
- package/dist/chunk-PRTIPC5X.mjs +17 -0
- package/dist/chunk-PRTIPC5X.mjs.map +1 -0
- package/dist/chunk-PUQLVKMB.mjs +12 -0
- package/dist/chunk-PUQLVKMB.mjs.map +1 -0
- package/dist/chunk-QC3SFAQJ.mjs +19 -0
- package/dist/chunk-QC3SFAQJ.mjs.map +1 -0
- package/dist/chunk-RK6PRCEJ.mjs +12 -0
- package/dist/chunk-RK6PRCEJ.mjs.map +1 -0
- package/dist/chunk-SF3V7XXM.mjs +16 -0
- package/dist/chunk-SF3V7XXM.mjs.map +1 -0
- package/dist/chunk-SPLO5OZW.mjs +16 -0
- package/dist/chunk-SPLO5OZW.mjs.map +1 -0
- package/dist/chunk-SQOYF647.mjs +16 -0
- package/dist/chunk-SQOYF647.mjs.map +1 -0
- package/dist/chunk-SYQTG4N4.mjs +1 -0
- package/dist/chunk-SYQTG4N4.mjs.map +1 -0
- package/dist/chunk-T2C2WVFL.mjs +16 -0
- package/dist/chunk-T2C2WVFL.mjs.map +1 -0
- package/dist/chunk-T5JCRGXA.mjs +1 -0
- package/dist/chunk-T5JCRGXA.mjs.map +1 -0
- package/dist/chunk-TCHT4HCP.mjs +21 -0
- package/dist/chunk-TCHT4HCP.mjs.map +1 -0
- package/dist/chunk-TF6N37OE.mjs +18 -0
- package/dist/chunk-TF6N37OE.mjs.map +1 -0
- package/dist/chunk-TK2EDHSP.mjs +13 -0
- package/dist/chunk-TK2EDHSP.mjs.map +1 -0
- package/dist/chunk-TULUUJ3E.mjs +21 -0
- package/dist/chunk-TULUUJ3E.mjs.map +1 -0
- package/dist/chunk-UFAA5WKR.mjs +19 -0
- package/dist/chunk-UFAA5WKR.mjs.map +1 -0
- package/dist/chunk-V6LXSPMF.mjs +17 -0
- package/dist/chunk-V6LXSPMF.mjs.map +1 -0
- package/dist/chunk-Y6ZRNII6.mjs +9 -0
- package/dist/chunk-Y6ZRNII6.mjs.map +1 -0
- package/dist/chunk-YEZIGQJG.mjs +13 -0
- package/dist/chunk-YEZIGQJG.mjs.map +1 -0
- package/dist/chunk-YHY2XTJW.mjs +10 -0
- package/dist/chunk-YHY2XTJW.mjs.map +1 -0
- package/dist/chunk-YNRYG5OB.mjs +11 -0
- package/dist/chunk-YNRYG5OB.mjs.map +1 -0
- package/dist/chunk-ZBG3EYM3.mjs +11 -0
- package/dist/chunk-ZBG3EYM3.mjs.map +1 -0
- package/dist/chunk-ZQNAZPSK.mjs +9 -0
- package/dist/chunk-ZQNAZPSK.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 +121 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: T[], itemsCount: number): T[] {\n return arr.slice(itemsCount);\n}\n"],"mappings":";AAeO,SAAS,KAAQ,KAAU,YAAyB;AACzD,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: T[], itemsCount: number): T[] {\n return arr.slice(0, -itemsCount);\n}\n"],"mappings":";AAeO,SAAS,UAAa,KAAU,YAAyB;AAC9D,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dropWhile
|
|
3
|
+
} from "./chunk-3PFYAKOD.mjs";
|
|
4
|
+
|
|
5
|
+
// src/array/dropRightWhile.ts
|
|
6
|
+
function dropRightWhile(arr, canContinueDropping) {
|
|
7
|
+
const reversed = arr.slice().reverse();
|
|
8
|
+
const dropped = dropWhile(reversed, canContinueDropping);
|
|
9
|
+
return dropped.slice().reverse();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
dropRightWhile
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=chunk-6LDIBBWQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/dropRightWhile.ts"],"sourcesContent":["import { dropWhile } from './dropWhile';\n\n/**\n * Removes elements from the end of an array until the predicate returns false.\n *\n * This function iterates over an array from the end and drops elements until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {function(item: T): boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element from the end,\n * and dropping continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRightWhile(array, x => x > 3);\n * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.\n */\nexport function dropRightWhile<T>(arr: T[], canContinueDropping: (item: T) => boolean) {\n const reversed = arr.slice().reverse();\n const dropped = dropWhile(reversed, canContinueDropping);\n return dropped.slice().reverse();\n}\n"],"mappings":";;;;;AAmBO,SAAS,eAAkB,KAAU,qBAA2C;AACrF,QAAM,WAAW,IAAI,MAAM,EAAE,QAAQ;AACrC,QAAM,UAAU,UAAU,UAAU,mBAAmB;AACvD,SAAO,QAAQ,MAAM,EAAE,QAAQ;AACjC;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/array/intersectionWith.ts
|
|
2
|
+
function intersectionWith(firstArr, secondArr, areItemsEqual) {
|
|
3
|
+
return firstArr.filter((firstItem) => {
|
|
4
|
+
return secondArr.some((secondItem) => {
|
|
5
|
+
return areItemsEqual(firstItem, secondItem);
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
intersectionWith
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-7LAOIS6P.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/intersectionWith.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @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.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,iBAAoB,UAAe,WAAgB,eAA6C;AAC9G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/object/pick.ts"],"sourcesContent":["/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n"],"mappings":";AAeO,SAAS,KAA2B,KAAQ,MAAuB;AACxE,QAAM,SAAS,CAAC;AAEhB,aAAW,OAAO,MAAM;AACtB,WAAO,GAAG,IAAI,IAAI,GAAG;AAAA,EACvB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/array/intersectionBy.ts
|
|
2
|
+
function intersectionBy(firstArr, secondArr, mapper) {
|
|
3
|
+
const mappedSecondArr = secondArr.map((x) => mapper(x));
|
|
4
|
+
return firstArr.filter((item) => {
|
|
5
|
+
return mappedSecondArr.includes(mapper(item));
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
intersectionBy
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=chunk-ANJSX6WH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/intersectionBy.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays based on a mapping function.\n *\n * This function takes two arrays and a mapping function. It returns a new array containing\n * the elements from the first array that, when mapped using the provided function, have matching\n * mapped elements in the second array. It effectively filters out any elements from the first array\n * that do not have corresponding mapped values in the second array.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = intersectionBy(array1, array2, mapper);\n * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.\n */\nexport function intersectionBy<T, U>(firstArr: T[], secondArr: T[], mapper: (item: T) => U): T[] {\n const mappedSecondArr = secondArr.map(x => mapper(x));\n\n return firstArr.filter(item => {\n return mappedSecondArr.includes(mapper(item));\n });\n}\n"],"mappings":";AAoBO,SAAS,eAAqB,UAAe,WAAgB,QAA6B;AAC/F,QAAM,kBAAkB,UAAU,IAAI,OAAK,OAAO,CAAC,CAAC;AAEpD,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAAA,EAC9C,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-ARZ5BDR6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n"],"mappings":";AAaO,SAAS,IAAI,MAAwB;AAC1C,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-EJGAXTF7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/union.ts"],"sourcesContent":["import { uniq } from './uniq';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: T[], arr2: T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n"],"mappings":";;;;;AAkBO,SAAS,MAAS,MAAW,MAAgB;AAClD,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/predicate/isUndefined.ts"],"sourcesContent":["/**\n * Checks if the given value is undefined.\n *\n * This function tests whether the provided value is strictly equal to `undefined`.\n * It returns `true` if the value is `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.\n *\n * @param {unknown} x - The value to test if it is undefined.\n * @returns {x is undefined} true if the value is undefined, false otherwise.\n *\n * @example\n * * const value1 = undefined;\n * const value2 = null;\n * const value3 = 42;\n *\n * console.log(isUndefined(value1)); // true\n * console.log(isUndefined(value2)); // false\n * console.log(isUndefined(value3)); // false\n */\nexport function isUndefined(x: unknown): x is undefined {\n return x === undefined;\n}\n"],"mappings":";AAoBO,SAAS,YAAY,GAA4B;AACtD,SAAO,MAAM;AACf;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/array/takeRightWhile.ts
|
|
2
|
+
function takeRightWhile(arr, shouldContinueTaking) {
|
|
3
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
4
|
+
if (!shouldContinueTaking(arr[i])) {
|
|
5
|
+
return arr.slice(i + 1);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return arr.slice();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
takeRightWhile
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=chunk-IFCX35BI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/takeRightWhile.ts"],"sourcesContent":["/**\n * Takes elements from the end of the array while the predicate function returns `true`.\n *\n * @template T - Type of elements in the input array.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {function(T): boolean} shouldContinueTaking - The function invoked per element.\n * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.\n *\n * @example\n * // Returns [3, 2, 1]\n * takeRightWhile([5, 4, 3, 2, 1], n => n < 4);\n *\n * @example\n * // Returns []\n * takeRightWhile([1, 2, 3], n => n > 3);\n */\nexport function takeRightWhile<T>(arr: T[], shouldContinueTaking: (item: T) => boolean): T[] {\n for (let i = arr.length - 1; i >= 0; i--) {\n if (!shouldContinueTaking(arr[i])) {\n return arr.slice(i + 1);\n }\n }\n\n return arr.slice();\n}\n"],"mappings":";AAiBO,SAAS,eAAkB,KAAU,sBAAiD;AAC3F,WAAS,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK;AACxC,QAAI,CAAC,qBAAqB,IAAI,CAAC,CAAC,GAAG;AACjC,aAAO,IAAI,MAAM,IAAI,CAAC;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,IAAI,MAAM;AACnB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-IJLQVGW4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "./chunk-2MM5EJJX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/object/omit.ts
|
|
6
|
+
function omit(obj, keys) {
|
|
7
|
+
const result = __spreadValues({}, obj);
|
|
8
|
+
for (const key of keys) {
|
|
9
|
+
delete result[key];
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
omit
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-J6SWM4X6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/object/omit.ts"],"sourcesContent":["/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n"],"mappings":";;;;;AAeO,SAAS,KAA2B,KAAQ,MAAuB;AACxE,QAAM,SAAS,mBAAK;AAEpB,aAAW,OAAO,MAAM;AACtB,WAAO,OAAO,GAAG;AAAA,EACnB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/array/uniq.ts
|
|
2
|
+
function uniq(arr) {
|
|
3
|
+
const result = [];
|
|
4
|
+
for (const item of arr) {
|
|
5
|
+
if (result.includes(item)) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
result.push(item);
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
uniq
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-JDMFIUGM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/uniq.ts"],"sourcesContent":["/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: T[]): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (result.includes(item)) {\n continue;\n }\n\n result.push(item);\n }\n\n return result;\n}\n"],"mappings":";AAcO,SAAS,KAAQ,KAAe;AACrC,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,QAAI,OAAO,SAAS,IAAI,GAAG;AACzB;AAAA,IACF;AAEA,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/predicate/isNil.ts"],"sourcesContent":["/**\n * Checks if a given value is null or undefined.\n *\n * This function tests whether the provided value is either `null` or `undefined`.\n * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.\n *\n * @param {unknown} x - The value to test for null or undefined.\n * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.\n *\n * @example\n * * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * const result1 = isNil(value1); // true\n * const result2 = isNil(value2); // true\n * const result3 = isNil(value3); // false\n */\nexport function isNil(x: unknown): x is null | undefined {\n return x === null || x === undefined;\n}\n"],"mappings":";AAmBO,SAAS,MAAM,GAAmC;AACvD,SAAO,MAAM,QAAQ,MAAM;AAC7B;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/array/zip.ts
|
|
2
|
+
function zip(...arrs) {
|
|
3
|
+
const result = [];
|
|
4
|
+
const maxIndex = Math.max(...arrs.map((x) => x.length));
|
|
5
|
+
for (let i = 0; i < maxIndex; i++) {
|
|
6
|
+
const element = [];
|
|
7
|
+
for (const arr of arrs) {
|
|
8
|
+
element.push(arr[i]);
|
|
9
|
+
}
|
|
10
|
+
result.push(element);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
zip
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=chunk-L25VRQ54.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/zip.ts"],"sourcesContent":["/**\n * Combines multiple arrays into a single array of tuples.\n *\n * This function takes multiple arrays and returns a new array where each element is a tuple\n * containing the corresponding elements from the input arrays. If the input arrays are of\n * different lengths, the resulting array will have the length of the longest input array,\n * with undefined values for missing elements.\n *\n * @param {...T[][]} arrs - The arrays to zip together.\n * @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.\n *\n * @example\n * const arr1 = [1, 2, 3];\n * const arr2 = ['a', 'b', 'c'];\n * const result = zip(arr1, arr2);\n * // result will be [[1, 'a'], [2, 'b'], [3, 'c']]\n *\n * const arr3 = [true, false];\n * const result2 = zip(arr1, arr2, arr3);\n * // result2 will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]\n */\nexport function zip<T>(arr1: T[]): Array<[T]>;\nexport function zip<T, U>(arr1: T[], arr2: U[]): Array<[T, U]>;\nexport function zip<T, U, V>(arr1: T[], arr2: U[], arr3: V[]): Array<[T, U, V]>;\nexport function zip<T, U, V, W>(arr1: T[], arr2: U[], arr3: V[], arr4: W[]): Array<[T, U, V, W]>;\nexport function zip<T>(...arrs: T[][]): T[][] {\n const result: T[][] = [];\n\n const maxIndex = Math.max(...arrs.map(x => x.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const element: T[] = [];\n\n for (const arr of arrs) {\n element.push(arr[i]);\n }\n\n result.push(element);\n }\n\n return result;\n}\n"],"mappings":";AAyBO,SAAS,OAAU,MAAoB;AAC5C,QAAM,SAAgB,CAAC;AAEvB,QAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,OAAK,EAAE,MAAM,CAAC;AAEpD,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,UAAe,CAAC;AAEtB,eAAW,OAAO,MAAM;AACtB,cAAQ,KAAK,IAAI,CAAC,CAAC;AAAA,IACrB;AAEA,WAAO,KAAK,OAAO;AAAA,EACrB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/takeRight.ts"],"sourcesContent":["/**\n * Returns a new array containing the last `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {number} count - The number of elements to take.\n * @returns {T[]} A new array containing the last `count` elements from `arr`.\n *\n * @example\n * // Returns [4, 5]\n * takeRight([1, 2, 3, 4, 5], 2);\n *\n * @example\n * // Returns ['b', 'c']\n * takeRight(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * takeRight([1, 2, 3], 5);\n */\nexport function takeRight<T>(arr: T[], count: number): T[] {\n if (count === 0) {\n return [];\n }\n\n return arr.slice(-count);\n}\n"],"mappings":";AAoBO,SAAS,UAAa,KAAU,OAAoB;AACzD,MAAI,UAAU,GAAG;AACf,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,CAAC,KAAK;AACzB;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/array/takeWhile.ts
|
|
2
|
+
function takeWhile(arr, shouldContinueTaking) {
|
|
3
|
+
const result = [];
|
|
4
|
+
for (const item of arr) {
|
|
5
|
+
if (!shouldContinueTaking(item)) {
|
|
6
|
+
break;
|
|
7
|
+
}
|
|
8
|
+
result.push(item);
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
takeWhile
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-LLOAPSQ6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/takeWhile.ts"],"sourcesContent":["/**\n * Returns a new array containing the leading elements of the provided array\n * that satisfy the provided predicate function. It stops taking elements as soon\n * as an element does not satisfy the predicate.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @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.\n * @returns {T[]} A new array containing the leading elements that satisfy the predicate.\n *\n * @example\n * // Returns [1, 2]\n * takeWhile([1, 2, 3, 4], x => x < 3);\n *\n * @example\n * // Returns []\n * takeWhile([1, 2, 3, 4], x => x > 3);\n */\nexport function takeWhile<T>(arr: T[], shouldContinueTaking: (element: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (!shouldContinueTaking(item)) {\n break;\n }\n\n result.push(item);\n }\n\n return result;\n}\n"],"mappings":";AAkBO,SAAS,UAAa,KAAU,sBAAoD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,QAAI,CAAC,qBAAqB,IAAI,GAAG;AAC/B;AAAA,IACF;AAEA,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/array/differenceWith.ts
|
|
2
|
+
function differenceWith(firstArr, secondArr, areItemsEqual) {
|
|
3
|
+
return firstArr.filter((firstItem) => {
|
|
4
|
+
return secondArr.every((secondItem) => {
|
|
5
|
+
return !areItemsEqual(firstItem, secondItem);
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
differenceWith
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-M3SHJ3LL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/differenceWith.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom comparison function. It returns a new array containing\n * the elements that are present in the first array but not in the second array. The comparison to determine\n * if elements are equal is made using the provided custom function.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to get the difference.\n * @param {T[]} secondArr - The array containing elements to exclude from the first array.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.\n * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array\n * according to the custom equality function.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = differenceWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.\n */\nexport function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,eAAkB,UAAe,WAAgB,eAA6C;AAC5G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-MAJSPFA6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/function/throttle.ts
|
|
2
|
+
function throttle(func, throttleMs) {
|
|
3
|
+
let lastCallTime;
|
|
4
|
+
const throttledFunction = function() {
|
|
5
|
+
const now = Date.now();
|
|
6
|
+
if (lastCallTime == null || now - lastCallTime >= throttleMs) {
|
|
7
|
+
lastCallTime = now;
|
|
8
|
+
func();
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
return throttledFunction;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
throttle
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-MQZ5D4IU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/function/throttle.ts"],"sourcesContent":["/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @param {() => void} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {() => void} A new throttled function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n *\n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n *\n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle(func: () => void, throttleMs: number) {\n let lastCallTime: number | null;\n\n const throttledFunction = function () {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func();\n }\n };\n\n return throttledFunction;\n}\n"],"mappings":";AAyBO,SAAS,SAAS,MAAkB,YAAoB;AAC7D,MAAI;AAEJ,QAAM,oBAAoB,WAAY;AACpC,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,gBAAgB,QAAQ,MAAM,gBAAgB,YAAY;AAC5D,qBAAe;AACf,WAAK;AAAA,IACP;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/take.ts"],"sourcesContent":["/**\n * Returns a new array containing the first `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @template T - Type of elements in the input array.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {number} count - The number of elements to take.\n * @returns {T[]} A new array containing the first `count` elements from `arr`.\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3, 4, 5], 3);\n *\n * @example\n * // Returns ['a', 'b']\n * take(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3], 5);\n */\nexport function take<T>(arr: T[], count: number) {\n return arr.slice(0, count);\n}\n"],"mappings":";AAsBO,SAAS,KAAQ,KAAU,OAAe;AAC/C,SAAO,IAAI,MAAM,GAAG,KAAK;AAC3B;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/array/chunk.ts
|
|
2
|
+
function chunk(arr, size) {
|
|
3
|
+
if (!Number.isInteger(size) || size <= 0) {
|
|
4
|
+
throw new Error("Size must be an integer greater than zero.");
|
|
5
|
+
}
|
|
6
|
+
const chunkLength = Math.ceil(arr.length / size);
|
|
7
|
+
const result = Array(chunkLength);
|
|
8
|
+
for (let index = 0; index < chunkLength; index++) {
|
|
9
|
+
const start = index * size;
|
|
10
|
+
const end = start + size;
|
|
11
|
+
result[index] = arr.slice(start, end);
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
chunk
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-OS5PZ4B4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/chunk.ts"],"sourcesContent":["/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: T[], size: number): T[][] {\n if (!Number.isInteger(size) || size <= 0) {\n throw new Error('Size must be an integer greater than zero.');\n }\n\n const chunkLength = Math.ceil(arr.length / size);\n const result: T[][] = Array(chunkLength);\n\n for (let index = 0; index < chunkLength; index++) {\n const start = index * size;\n const end = start + size;\n\n result[index] = arr.slice(start, end);\n }\n\n return result;\n}\n"],"mappings":";AAuBO,SAAS,MAAS,KAAU,MAAqB;AACtD,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,QAAQ,GAAG;AACxC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,cAAc,KAAK,KAAK,IAAI,SAAS,IAAI;AAC/C,QAAM,SAAgB,MAAM,WAAW;AAEvC,WAAS,QAAQ,GAAG,QAAQ,aAAa,SAAS;AAChD,UAAM,QAAQ,QAAQ;AACtB,UAAM,MAAM,QAAQ;AAEpB,WAAO,KAAK,IAAI,IAAI,MAAM,OAAO,GAAG;AAAA,EACtC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/sample.ts"],"sourcesContent":["/**\n * Returns a random element from an array.\n *\n * This function takes an array and returns a single element selected randomly from the array.\n *\n * @param {T[]} arr - The array to sample from.\n * @returns {T} A random element from the array.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const randomElement = sample(array);\n * // randomElement will be one of the elements from the array, selected randomly.\n */\nexport function sample<T>(arr: T[]): T {\n const randomIndex = Math.floor(Math.random() * arr.length);\n return arr[randomIndex];\n}\n"],"mappings":";AAaO,SAAS,OAAU,KAAa;AACrC,QAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,IAAI,MAAM;AACzD,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/array/zipWith.ts
|
|
2
|
+
function zipWith(arr1, ...rest) {
|
|
3
|
+
const arrs = [arr1, ...rest.slice(0, -1)];
|
|
4
|
+
const combine = rest[rest.length - 1];
|
|
5
|
+
const result = [];
|
|
6
|
+
const maxIndex = Math.max(...arrs.map((arr) => arr.length));
|
|
7
|
+
for (let i = 0; i < maxIndex; i++) {
|
|
8
|
+
const elements = arrs.map((arr) => arr[i]);
|
|
9
|
+
result.push(combine(...elements));
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
zipWith
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-PRTIPC5X.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/zipWith.ts"],"sourcesContent":["/**\n * Combines multiple arrays into a single array using a custom combiner function.\n *\n * This function takes multiple arrays and a combiner function, and returns a new array where each element\n * is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @param {T[]} arr1 - The first array to zip.\n * @param {U[]} [arr2] - The second array to zip (optional).\n * @param {V[]} [arr3] - The third array to zip (optional).\n * @param {W[]} [arr4] - The fourth array to zip (optional).\n * @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.\n * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @example\n * // Example usage with two arrays:\n * const arr1 = [1, 2, 3];\n * const arr2 = [4, 5, 6];\n * const result = zipWith(arr1, arr2, (a, b) => a + b);\n * // result will be [5, 7, 9]\n *\n * @example\n * // Example usage with three arrays:\n * const arr1 = [1, 2];\n * const arr2 = [3, 4];\n * const arr3 = [5, 6];\n * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);\n * // result will be [`135`, `246`]\n */\nexport function zipWith<T, R>(arr1: T[], combine: (item: T) => R): R[];\nexport function zipWith<T, U, R>(arr1: T[], arr2: U[], combine: (item1: T, item2: U) => R): R[];\nexport function zipWith<T, U, V, R>(arr1: T[], arr2: U[], arr3: V[], combine: (item1: T, item2: U, item3: V) => R): R[];\nexport function zipWith<T, U, V, W, R>(\n arr1: T[],\n arr2: U[],\n arr3: V[],\n arr4: W[],\n combine: (item1: T, item2: U, item3: V, item4: W) => R\n): R[];\nexport function zipWith<T, R>(arr1: T[], ...rest: any[]): R[] {\n const arrs = [arr1, ...rest.slice(0, -1)];\n const combine = rest[rest.length - 1] as (...items: T[]) => R;\n\n const result: R[] = [];\n const maxIndex = Math.max(...arrs.map(arr => arr.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const elements: T[] = arrs.map(arr => arr[i]);\n result.push(combine(...elements));\n }\n\n return result;\n}\n"],"mappings":";AAsCO,SAAS,QAAc,SAAc,MAAkB;AAC5D,QAAM,OAAO,CAAC,MAAM,GAAG,KAAK,MAAM,GAAG,EAAE,CAAC;AACxC,QAAM,UAAU,KAAK,KAAK,SAAS,CAAC;AAEpC,QAAM,SAAc,CAAC;AACrB,QAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,SAAO,IAAI,MAAM,CAAC;AAExD,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,WAAgB,KAAK,IAAI,SAAO,IAAI,CAAC,CAAC;AAC5C,WAAO,KAAK,QAAQ,GAAG,QAAQ,CAAC;AAAA,EAClC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/array/differenceBy.ts
|
|
2
|
+
function differenceBy(firstArr, secondArr, mapper) {
|
|
3
|
+
const mappedSecondArr = secondArr.map((item) => mapper(item));
|
|
4
|
+
return firstArr.filter((item) => {
|
|
5
|
+
return !mappedSecondArr.includes(mapper(item));
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
differenceBy
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=chunk-PUQLVKMB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/differenceBy.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays after mapping their elements through a provided function.\n *\n * This function takes two arrays and a mapper function. It returns a new array containing the elements\n * that are present in the first array but not in the second array, based on the identity calculated\n * by the mapper function.\n *\n * Essentially, it filters out any elements from the first array that, when\n * mapped, match an element in the mapped version of the second array.\n *\n * @template T, U\n * @param {T[]} firstArr - The primary array from which to derive the difference.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function\n * is applied to each element in both arrays, and the comparison is made based on the mapped values.\n * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding\n * mapped identity in the second array.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = differenceBy(array1, array2, mapper);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.\n */\nexport function differenceBy<T, U>(firstArr: T[], secondArr: T[], mapper: (value: T) => U): T[] {\n const mappedSecondArr = secondArr.map(item => mapper(item));\n\n return firstArr.filter(item => {\n return !mappedSecondArr.includes(mapper(item));\n });\n}\n"],"mappings":";AAyBO,SAAS,aAAmB,UAAe,WAAgB,QAA8B;AAC9F,QAAM,kBAAkB,UAAU,IAAI,UAAQ,OAAO,IAAI,CAAC;AAE1D,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAAA,EAC/C,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
union
|
|
3
|
+
} from "./chunk-GLAZTR32.mjs";
|
|
4
|
+
import {
|
|
5
|
+
intersection
|
|
6
|
+
} from "./chunk-YNRYG5OB.mjs";
|
|
7
|
+
import {
|
|
8
|
+
difference
|
|
9
|
+
} from "./chunk-2PB2OCC6.mjs";
|
|
10
|
+
|
|
11
|
+
// src/array/xor.ts
|
|
12
|
+
function xor(arr1, arr2) {
|
|
13
|
+
return difference(union(arr1, arr2), intersection(arr1, arr2));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
xor
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-QC3SFAQJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/xor.ts"],"sourcesContent":["import { difference } from './difference';\nimport { intersection } from './intersection';\nimport { union } from './union';\n\n/**\n * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements\n * which are in either of the arrays, but not in their intersection.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.\n *\n * @example\n * // Returns [1, 2, 5, 6]\n * xor([1, 2, 3, 4], [3, 4, 5, 6]);\n *\n * @example\n * // Returns ['a', 'c']\n * xor(['a', 'b'], ['b', 'c']);\n */\nexport function xor<T>(arr1: T[], arr2: T[]): T[] {\n return difference(union(arr1, arr2), intersection(arr1, arr2));\n}\n"],"mappings":";;;;;;;;;;;AAoBO,SAAS,IAAO,MAAW,MAAgB;AAChD,SAAO,WAAW,MAAM,MAAM,IAAI,GAAG,aAAa,MAAM,IAAI,CAAC;AAC/D;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/math/clamp.ts"],"sourcesContent":["/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n"],"mappings":";AAmBO,SAAS,MAAM,OAAe,QAAgB,QAAyB;AAC5E,MAAI,UAAU,MAAM;AAClB,WAAO,KAAK,IAAI,OAAO,MAAM;AAAA,EAC/B;AAEA,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,MAAM,GAAG,MAAM;AACjD;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/object/omitBy.ts
|
|
2
|
+
function omitBy(obj, shouldOmit) {
|
|
3
|
+
const result = {};
|
|
4
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
5
|
+
if (shouldOmit(value, key)) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
result[key] = value;
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
omitBy
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-SF3V7XXM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/object/omitBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: string) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: string) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";AAkBO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,WAAW,OAAO,GAAG,GAAG;AAC1B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/array/unionBy.ts
|
|
2
|
+
function unionBy(arr1, arr2, mapper) {
|
|
3
|
+
const map = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const item of [...arr1, ...arr2]) {
|
|
5
|
+
const key = mapper(item);
|
|
6
|
+
if (!map.has(key)) {
|
|
7
|
+
map.set(key, item);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return [...map.values()];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
unionBy
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-SPLO5OZW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/unionBy.ts"],"sourcesContent":["/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {function(item: T): U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for numbers (modulo comparison)\n * const moduloMapper = (x) => x % 3;\n * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);\n * // Returns [1, 2, 3]\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = (obj) => obj.id;\n * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]\n */\nexport function unionBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of [...arr1, ...arr2]) {\n const key = mapper(item);\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return [...map.values()];\n}\n"],"mappings":";AAoBO,SAAS,QAAc,MAAW,MAAW,QAA6B;AAC/E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACrC,UAAM,MAAM,OAAO,IAAI;AACvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/array/uniqWith.ts
|
|
2
|
+
function uniqWith(arr, areItemsEqual) {
|
|
3
|
+
const result = [];
|
|
4
|
+
for (const item of arr) {
|
|
5
|
+
const isUniq = result.every((v) => !areItemsEqual(v, item));
|
|
6
|
+
if (isUniq) {
|
|
7
|
+
result.push(item);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
uniqWith
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-SQOYF647.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/uniqWith.ts"],"sourcesContent":["/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * 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.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";AAWO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|