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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns a random element from an array.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This function takes an array and returns a single element selected randomly from the array.
|
|
5
5
|
*
|
|
6
6
|
* @param {T[]} arr - The array to sample from.
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
* const randomElement = sample(array);
|
|
12
12
|
* // randomElement will be one of the elements from the array, selected randomly.
|
|
13
13
|
*/
|
|
14
|
-
function sample(arr)
|
|
15
|
-
var randomIndex = Math.floor(Math.random() * arr.length);
|
|
16
|
-
return arr[randomIndex];
|
|
17
|
-
}
|
|
14
|
+
declare function sample<T>(arr: T[]): T;
|
|
18
15
|
|
|
19
16
|
export { sample };
|
package/dist/array/sample.d.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/array/sample.ts
|
|
21
|
+
var sample_exports = {};
|
|
22
|
+
__export(sample_exports, {
|
|
23
|
+
sample: () => sample
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(sample_exports);
|
|
26
|
+
function sample(arr) {
|
|
27
|
+
const randomIndex = Math.floor(Math.random() * arr.length);
|
|
28
|
+
return arr[randomIndex];
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
sample
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=sample.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,OAAU,KAAa;AACrC,QAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,IAAI,MAAM;AACzD,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Randomizes the order of elements in an array using the Fisher-Yates algorithm.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This function takes an array and returns a new array with its elements shuffled in a random order.
|
|
5
5
|
*
|
|
6
6
|
* @param {T[]} arr - The array to shuffle.
|
|
@@ -11,17 +11,6 @@
|
|
|
11
11
|
* const shuffledArray = shuffle(array);
|
|
12
12
|
* // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]
|
|
13
13
|
*/
|
|
14
|
-
function shuffle(arr)
|
|
15
|
-
/**
|
|
16
|
-
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
|
|
17
|
-
*/
|
|
18
|
-
for (var i = arr.length - 1; i >= 1; i--) {
|
|
19
|
-
var j = Math.floor(Math.random() * (i + 1));
|
|
20
|
-
var _ref = [arr[j], arr[i]];
|
|
21
|
-
arr[i] = _ref[0];
|
|
22
|
-
arr[j] = _ref[1];
|
|
23
|
-
}
|
|
24
|
-
return arr;
|
|
25
|
-
}
|
|
14
|
+
declare function shuffle<T>(arr: T[]): T[];
|
|
26
15
|
|
|
27
16
|
export { shuffle };
|
package/dist/array/shuffle.d.ts
CHANGED
|
@@ -11,4 +11,6 @@
|
|
|
11
11
|
* const shuffledArray = shuffle(array);
|
|
12
12
|
* // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
declare function shuffle<T>(arr: T[]): T[];
|
|
15
|
+
|
|
16
|
+
export { shuffle };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/array/shuffle.ts
|
|
21
|
+
var shuffle_exports = {};
|
|
22
|
+
__export(shuffle_exports, {
|
|
23
|
+
shuffle: () => shuffle
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(shuffle_exports);
|
|
26
|
+
function shuffle(arr) {
|
|
27
|
+
for (let i = arr.length - 1; i >= 1; i--) {
|
|
28
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
29
|
+
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
30
|
+
}
|
|
31
|
+
return arr;
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
shuffle
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=shuffle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/array/shuffle.ts"],"sourcesContent":["/**\n * Randomizes the order of elements in an array using the Fisher-Yates algorithm.\n *\n * This function takes an array and returns a new array with its elements shuffled in a random order.\n *\n * @param {T[]} arr - The array to shuffle.\n * @returns {T[]} A new array with its elements shuffled in random order.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const shuffledArray = shuffle(array);\n * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]\n */\nexport function shuffle<T>(arr: T[]): T[] {\n /**\n * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n for (let i = arr.length - 1; i >= 1; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n\n [arr[i], arr[j]] = [arr[j], arr[i]];\n }\n\n return arr;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,QAAW,KAAe;AAIxC,WAAS,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK;AACxC,UAAM,IAAI,KAAK,MAAM,KAAK,OAAO,KAAK,IAAI,EAAE;AAE5C,KAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAAA,EACpC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -3,25 +3,23 @@
|
|
|
3
3
|
* If `count` is greater than the length of `arr`, the entire array is returned.
|
|
4
4
|
*
|
|
5
5
|
* @template T - Type of elements in the input array.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* @param {T[]} arr - The array to take elements from.
|
|
8
8
|
* @param {number} count - The number of elements to take.
|
|
9
9
|
* @returns {T[]} A new array containing the first `count` elements from `arr`.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* @example
|
|
12
12
|
* // Returns [1, 2, 3]
|
|
13
13
|
* take([1, 2, 3, 4, 5], 3);
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* @example
|
|
16
16
|
* // Returns ['a', 'b']
|
|
17
17
|
* take(['a', 'b', 'c'], 2);
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* @example
|
|
20
20
|
* // Returns [1, 2, 3]
|
|
21
21
|
* take([1, 2, 3], 5);
|
|
22
22
|
*/
|
|
23
|
-
function take(arr, count)
|
|
24
|
-
return arr.slice(0, count);
|
|
25
|
-
}
|
|
23
|
+
declare function take<T>(arr: T[], count: number): T[];
|
|
26
24
|
|
|
27
25
|
export { take };
|
package/dist/array/take.d.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/array/take.ts
|
|
21
|
+
var take_exports = {};
|
|
22
|
+
__export(take_exports, {
|
|
23
|
+
take: () => take
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(take_exports);
|
|
26
|
+
function take(arr, count) {
|
|
27
|
+
return arr.slice(0, count);
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
take
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=take.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,SAAS,KAAQ,KAAU,OAAe;AAC/C,SAAO,IAAI,MAAM,GAAG,KAAK;AAC3B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns a new array containing the last `count` elements from the input array `arr`.
|
|
3
3
|
* If `count` is greater than the length of `arr`, the entire array is returned.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* @param {T[]} arr - The array to take elements from.
|
|
6
6
|
* @param {number} count - The number of elements to take.
|
|
7
7
|
* @returns {T[]} A new array containing the last `count` elements from `arr`.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* @example
|
|
10
10
|
* // Returns [4, 5]
|
|
11
11
|
* takeRight([1, 2, 3, 4, 5], 2);
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @example
|
|
14
14
|
* // Returns ['b', 'c']
|
|
15
15
|
* takeRight(['a', 'b', 'c'], 2);
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
17
|
* @example
|
|
18
18
|
* // Returns [1, 2, 3]
|
|
19
19
|
* takeRight([1, 2, 3], 5);
|
|
20
20
|
*/
|
|
21
|
-
function takeRight(arr, count)
|
|
22
|
-
if (count === 0) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
return arr.slice(-count);
|
|
26
|
-
}
|
|
21
|
+
declare function takeRight<T>(arr: T[], count: number): T[];
|
|
27
22
|
|
|
28
23
|
export { takeRight };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/array/takeRight.ts
|
|
21
|
+
var takeRight_exports = {};
|
|
22
|
+
__export(takeRight_exports, {
|
|
23
|
+
takeRight: () => takeRight
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(takeRight_exports);
|
|
26
|
+
function takeRight(arr, count) {
|
|
27
|
+
if (count === 0) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
return arr.slice(-count);
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
takeRight
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=takeRight.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Takes elements from the end of the array while the predicate function returns `true`.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* @template T - Type of elements in the input array.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* @param {T[]} arr - The array to take elements from.
|
|
7
7
|
* @param {function(T): boolean} shouldContinueTaking - The function invoked per element.
|
|
8
8
|
* @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* @example
|
|
11
11
|
* // Returns [3, 2, 1]
|
|
12
12
|
* takeRightWhile([5, 4, 3, 2, 1], n => n < 4);
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* @example
|
|
15
15
|
* // Returns []
|
|
16
16
|
* takeRightWhile([1, 2, 3], n => n > 3);
|
|
17
17
|
*/
|
|
18
|
-
function takeRightWhile(arr, shouldContinueTaking)
|
|
19
|
-
for (var i = arr.length - 1; i >= 0; i--) {
|
|
20
|
-
if (!shouldContinueTaking(arr[i])) {
|
|
21
|
-
return arr.slice(i + 1);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return arr.slice();
|
|
25
|
-
}
|
|
18
|
+
declare function takeRightWhile<T>(arr: T[], shouldContinueTaking: (item: T) => boolean): T[];
|
|
26
19
|
|
|
27
20
|
export { takeRightWhile };
|
|
@@ -15,4 +15,6 @@
|
|
|
15
15
|
* // Returns []
|
|
16
16
|
* takeRightWhile([1, 2, 3], n => n > 3);
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
declare function takeRightWhile<T>(arr: T[], shouldContinueTaking: (item: T) => boolean): T[];
|
|
19
|
+
|
|
20
|
+
export { takeRightWhile };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/array/takeRightWhile.ts
|
|
21
|
+
var takeRightWhile_exports = {};
|
|
22
|
+
__export(takeRightWhile_exports, {
|
|
23
|
+
takeRightWhile: () => takeRightWhile
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(takeRightWhile_exports);
|
|
26
|
+
function takeRightWhile(arr, shouldContinueTaking) {
|
|
27
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
28
|
+
if (!shouldContinueTaking(arr[i])) {
|
|
29
|
+
return arr.slice(i + 1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return arr.slice();
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
takeRightWhile
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=takeRightWhile.js.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Returns a new array containing the leading elements of the provided array
|
|
5
3
|
* that satisfy the provided predicate function. It stops taking elements as soon
|
|
@@ -18,24 +16,6 @@ import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virt
|
|
|
18
16
|
* // Returns []
|
|
19
17
|
* takeWhile([1, 2, 3, 4], x => x > 3);
|
|
20
18
|
*/
|
|
21
|
-
function takeWhile(arr, shouldContinueTaking)
|
|
22
|
-
var result = [];
|
|
23
|
-
var _iterator = _createForOfIteratorHelper(arr),
|
|
24
|
-
_step;
|
|
25
|
-
try {
|
|
26
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
27
|
-
var item = _step.value;
|
|
28
|
-
if (!shouldContinueTaking(item)) {
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
result.push(item);
|
|
32
|
-
}
|
|
33
|
-
} catch (err) {
|
|
34
|
-
_iterator.e(err);
|
|
35
|
-
} finally {
|
|
36
|
-
_iterator.f();
|
|
37
|
-
}
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
19
|
+
declare function takeWhile<T>(arr: T[], shouldContinueTaking: (element: T) => boolean): T[];
|
|
40
20
|
|
|
41
21
|
export { takeWhile };
|
|
@@ -16,4 +16,6 @@
|
|
|
16
16
|
* // Returns []
|
|
17
17
|
* takeWhile([1, 2, 3, 4], x => x > 3);
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
declare function takeWhile<T>(arr: T[], shouldContinueTaking: (element: T) => boolean): T[];
|
|
20
|
+
|
|
21
|
+
export { takeWhile };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/array/takeWhile.ts
|
|
21
|
+
var takeWhile_exports = {};
|
|
22
|
+
__export(takeWhile_exports, {
|
|
23
|
+
takeWhile: () => takeWhile
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(takeWhile_exports);
|
|
26
|
+
function takeWhile(arr, shouldContinueTaking) {
|
|
27
|
+
const result = [];
|
|
28
|
+
for (const item of arr) {
|
|
29
|
+
if (!shouldContinueTaking(item)) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
result.push(item);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
takeWhile
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=takeWhile.js.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { uniq } from './uniq.mjs';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Creates an array of unique values from all given arrays.
|
|
5
|
-
*
|
|
6
|
-
* This function takes two arrays, merges them into a single array, and returns a new array
|
|
3
|
+
*
|
|
4
|
+
* This function takes two arrays, merges them into a single array, and returns a new array
|
|
7
5
|
* containing only the unique values from the merged array.
|
|
8
6
|
*
|
|
9
7
|
* @param {T[]} arr1 - The first array to merge and filter for unique values.
|
|
@@ -16,8 +14,6 @@ import { uniq } from './uniq.mjs';
|
|
|
16
14
|
* const result = union(array1, array2);
|
|
17
15
|
* // result will be [1, 2, 3, 4, 5]
|
|
18
16
|
*/
|
|
19
|
-
function union(arr1, arr2)
|
|
20
|
-
return uniq(arr1.concat(arr2));
|
|
21
|
-
}
|
|
17
|
+
declare function union<T>(arr1: T[], arr2: T[]): T[];
|
|
22
18
|
|
|
23
19
|
export { union };
|
package/dist/array/union.d.ts
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/array/union.ts
|
|
21
|
+
var union_exports = {};
|
|
22
|
+
__export(union_exports, {
|
|
23
|
+
union: () => union
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(union_exports);
|
|
26
|
+
|
|
27
|
+
// src/array/uniq.ts
|
|
28
|
+
function uniq(arr) {
|
|
29
|
+
const result = [];
|
|
30
|
+
for (const item of arr) {
|
|
31
|
+
if (result.includes(item)) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
result.push(item);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/array/union.ts
|
|
40
|
+
function union(arr1, arr2) {
|
|
41
|
+
return uniq(arr1.concat(arr2));
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
union
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=union.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/array/union.ts","../../src/array/uniq.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","/**\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,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;;;ADRO,SAAS,MAAS,MAAW,MAAgB;AAClD,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;","names":[]}
|