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
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -12,7 +12,6 @@ es-toolkit is a state-of-the-art, high-performance JavaScript utility library wi
|
|
|
12
12
|
- es-toolkit includes built-in TypeScript support, with straightforward yet robust types. It also provides useful type guards such as [isNotNil](https://es-toolkit.slash.page/reference/predicate/isNotNil.html).
|
|
13
13
|
- es-toolkit is battle-tested with 100% test coverage, ensuring reliability and robustness.
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
## Contributing
|
|
17
16
|
|
|
18
17
|
We welcome contribution from everyone in the community. Read below for detailed contribution guide.
|
|
@@ -21,18 +21,6 @@
|
|
|
21
21
|
* chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);
|
|
22
22
|
* // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
|
|
23
23
|
*/
|
|
24
|
-
function chunk(arr, size)
|
|
25
|
-
if (!Number.isInteger(size) || size <= 0) {
|
|
26
|
-
throw new Error('Size must be an integer greater than zero.');
|
|
27
|
-
}
|
|
28
|
-
var chunkLength = Math.ceil(arr.length / size);
|
|
29
|
-
var result = Array(chunkLength);
|
|
30
|
-
for (var index = 0; index < chunkLength; index++) {
|
|
31
|
-
var start = index * size;
|
|
32
|
-
var end = start + size;
|
|
33
|
-
result[index] = arr.slice(start, end);
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
24
|
+
declare function chunk<T>(arr: T[], size: number): T[][];
|
|
37
25
|
|
|
38
26
|
export { chunk };
|
package/dist/array/chunk.d.ts
CHANGED
|
@@ -21,4 +21,6 @@
|
|
|
21
21
|
* chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);
|
|
22
22
|
* // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
declare function chunk<T>(arr: T[], size: number): T[][];
|
|
25
|
+
|
|
26
|
+
export { chunk };
|
|
@@ -0,0 +1,43 @@
|
|
|
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/chunk.ts
|
|
21
|
+
var chunk_exports = {};
|
|
22
|
+
__export(chunk_exports, {
|
|
23
|
+
chunk: () => chunk
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(chunk_exports);
|
|
26
|
+
function chunk(arr, size) {
|
|
27
|
+
if (!Number.isInteger(size) || size <= 0) {
|
|
28
|
+
throw new Error("Size must be an integer greater than zero.");
|
|
29
|
+
}
|
|
30
|
+
const chunkLength = Math.ceil(arr.length / size);
|
|
31
|
+
const result = Array(chunkLength);
|
|
32
|
+
for (let index = 0; index < chunkLength; index++) {
|
|
33
|
+
const start = index * size;
|
|
34
|
+
const end = start + size;
|
|
35
|
+
result[index] = arr.slice(start, end);
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
chunk
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=chunk.js.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Computes the difference between two arrays.
|
|
3
|
-
*
|
|
4
|
-
* This function takes two arrays and returns a new array containing the elements
|
|
5
|
-
* that are present in the first array but not in the second array. It effectively
|
|
3
|
+
*
|
|
4
|
+
* This function takes two arrays and returns a new array containing the elements
|
|
5
|
+
* that are present in the first array but not in the second array. It effectively
|
|
6
6
|
* filters out any elements from the first array that also appear in the second array.
|
|
7
7
|
*
|
|
8
8
|
* @template T
|
|
9
|
-
* @param {T[]} firstArr - The array from which to derive the difference. This is the primary array
|
|
9
|
+
* @param {T[]} firstArr - The array from which to derive the difference. This is the primary array
|
|
10
10
|
* from which elements will be compared and filtered.
|
|
11
|
-
* @param {T[]} secondArr - The array containing elements to be excluded from the first array.
|
|
12
|
-
* Each element in this array will be checked against the first array, and if a match is found,
|
|
11
|
+
* @param {T[]} secondArr - The array containing elements to be excluded from the first array.
|
|
12
|
+
* Each element in this array will be checked against the first array, and if a match is found,
|
|
13
13
|
* that element will be excluded from the result.
|
|
14
|
-
* @returns {T[]} A new array containing the elements that are present in the first array but not
|
|
14
|
+
* @returns {T[]} A new array containing the elements that are present in the first array but not
|
|
15
15
|
* in the second array.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
@@ -20,10 +20,6 @@
|
|
|
20
20
|
* const result = difference(array1, array2);
|
|
21
21
|
* // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.
|
|
22
22
|
*/
|
|
23
|
-
function difference(firstArr, secondArr)
|
|
24
|
-
return firstArr.filter(function (item) {
|
|
25
|
-
return !secondArr.includes(item);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
23
|
+
declare function difference<T>(firstArr: T[], secondArr: T[]): T[];
|
|
28
24
|
|
|
29
25
|
export { difference };
|
|
@@ -20,4 +20,6 @@
|
|
|
20
20
|
* const result = difference(array1, array2);
|
|
21
21
|
* // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
declare function difference<T>(firstArr: T[], secondArr: T[]): T[];
|
|
24
|
+
|
|
25
|
+
export { difference };
|
|
@@ -0,0 +1,35 @@
|
|
|
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/difference.ts
|
|
21
|
+
var difference_exports = {};
|
|
22
|
+
__export(difference_exports, {
|
|
23
|
+
difference: () => difference
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(difference_exports);
|
|
26
|
+
function difference(firstArr, secondArr) {
|
|
27
|
+
return firstArr.filter((item) => {
|
|
28
|
+
return !secondArr.includes(item);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
difference
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=difference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/array/difference.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements\n * that are present in the first array but not in the second array. It effectively\n * filters out any elements from the first array that also appear in the second array.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array\n * from which elements will be compared and filtered.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * Each element in this array will be checked against the first array, and if a match is found,\n * that element will be excluded from the result.\n * @returns {T[]} A new array containing the elements that are present in the first array but not\n * in the second array.\n *\n * @example\n * * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [2, 4];\n * const result = difference(array1, array2);\n * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.\n */\nexport function difference<T>(firstArr: T[], secondArr: T[]): T[] {\n return firstArr.filter(item => {\n return !secondArr.includes(item);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,SAAS,WAAc,UAAe,WAAqB;AAChE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,UAAU,SAAS,IAAI;AAAA,EACjC,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Computes the difference between two arrays after mapping their elements through a provided function.
|
|
3
|
-
*
|
|
4
|
-
* This function takes two arrays and a mapper function. It returns a new array containing the elements
|
|
5
|
-
* that are present in the first array but not in the second array, based on the identity calculated
|
|
6
|
-
* by the mapper function.
|
|
7
|
-
*
|
|
8
|
-
* Essentially, it filters out any elements from the first array that, when
|
|
3
|
+
*
|
|
4
|
+
* This function takes two arrays and a mapper function. It returns a new array containing the elements
|
|
5
|
+
* that are present in the first array but not in the second array, based on the identity calculated
|
|
6
|
+
* by the mapper function.
|
|
7
|
+
*
|
|
8
|
+
* Essentially, it filters out any elements from the first array that, when
|
|
9
9
|
* mapped, match an element in the mapped version of the second array.
|
|
10
10
|
*
|
|
11
11
|
* @template T, U
|
|
12
|
-
* @param {T[]} firstArr - The primary array from which to derive the difference.
|
|
12
|
+
* @param {T[]} firstArr - The primary array from which to derive the difference.
|
|
13
13
|
* @param {T[]} secondArr - The array containing elements to be excluded from the first array.
|
|
14
|
-
* @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function
|
|
14
|
+
* @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function
|
|
15
15
|
* is applied to each element in both arrays, and the comparison is made based on the mapped values.
|
|
16
|
-
* @returns {T[]} A new array containing the elements from the first array that do not have a corresponding
|
|
16
|
+
* @returns {T[]} A new array containing the elements from the first array that do not have a corresponding
|
|
17
17
|
* mapped identity in the second array.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
@@ -23,13 +23,6 @@
|
|
|
23
23
|
* const result = differenceBy(array1, array2, mapper);
|
|
24
24
|
* // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.
|
|
25
25
|
*/
|
|
26
|
-
function differenceBy(firstArr, secondArr, mapper)
|
|
27
|
-
var mappedSecondArr = secondArr.map(function (item) {
|
|
28
|
-
return mapper(item);
|
|
29
|
-
});
|
|
30
|
-
return firstArr.filter(function (item) {
|
|
31
|
-
return !mappedSecondArr.includes(mapper(item));
|
|
32
|
-
});
|
|
33
|
-
}
|
|
26
|
+
declare function differenceBy<T, U>(firstArr: T[], secondArr: T[], mapper: (value: T) => U): T[];
|
|
34
27
|
|
|
35
28
|
export { differenceBy };
|
|
@@ -23,4 +23,6 @@
|
|
|
23
23
|
* const result = differenceBy(array1, array2, mapper);
|
|
24
24
|
* // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
declare function differenceBy<T, U>(firstArr: T[], secondArr: T[], mapper: (value: T) => U): T[];
|
|
27
|
+
|
|
28
|
+
export { differenceBy };
|
|
@@ -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/differenceBy.ts
|
|
21
|
+
var differenceBy_exports = {};
|
|
22
|
+
__export(differenceBy_exports, {
|
|
23
|
+
differenceBy: () => differenceBy
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(differenceBy_exports);
|
|
26
|
+
function differenceBy(firstArr, secondArr, mapper) {
|
|
27
|
+
const mappedSecondArr = secondArr.map((item) => mapper(item));
|
|
28
|
+
return firstArr.filter((item) => {
|
|
29
|
+
return !mappedSecondArr.includes(mapper(item));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
differenceBy
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=differenceBy.js.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Computes the difference between two arrays based on a custom equality function.
|
|
3
|
-
*
|
|
4
|
-
* This function takes two arrays and a custom comparison function. It returns a new array containing
|
|
5
|
-
* the elements that are present in the first array but not in the second array. The comparison to determine
|
|
3
|
+
*
|
|
4
|
+
* This function takes two arrays and a custom comparison function. It returns a new array containing
|
|
5
|
+
* the elements that are present in the first array but not in the second array. The comparison to determine
|
|
6
6
|
* if elements are equal is made using the provided custom function.
|
|
7
7
|
*
|
|
8
8
|
* @template T
|
|
9
9
|
* @param {T[]} firstArr - The array from which to get the difference.
|
|
10
|
-
* @param {T[]} secondArr - The array containing elements to exclude from the first array.
|
|
10
|
+
* @param {T[]} secondArr - The array containing elements to exclude from the first array.
|
|
11
11
|
* @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.
|
|
12
|
-
* @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array
|
|
12
|
+
* @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array
|
|
13
13
|
* according to the custom equality function.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
@@ -19,12 +19,6 @@
|
|
|
19
19
|
* const result = differenceWith(array1, array2, areItemsEqual);
|
|
20
20
|
* // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.
|
|
21
21
|
*/
|
|
22
|
-
function differenceWith(firstArr, secondArr, areItemsEqual)
|
|
23
|
-
return firstArr.filter(function (firstItem) {
|
|
24
|
-
return secondArr.every(function (secondItem) {
|
|
25
|
-
return !areItemsEqual(firstItem, secondItem);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}
|
|
22
|
+
declare function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[];
|
|
29
23
|
|
|
30
24
|
export { differenceWith };
|
|
@@ -19,4 +19,6 @@
|
|
|
19
19
|
* const result = differenceWith(array1, array2, areItemsEqual);
|
|
20
20
|
* // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
declare function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[];
|
|
23
|
+
|
|
24
|
+
export { differenceWith };
|
|
@@ -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/differenceWith.ts
|
|
21
|
+
var differenceWith_exports = {};
|
|
22
|
+
__export(differenceWith_exports, {
|
|
23
|
+
differenceWith: () => differenceWith
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(differenceWith_exports);
|
|
26
|
+
function differenceWith(firstArr, secondArr, areItemsEqual) {
|
|
27
|
+
return firstArr.filter((firstItem) => {
|
|
28
|
+
return secondArr.every((secondItem) => {
|
|
29
|
+
return !areItemsEqual(firstItem, secondItem);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
differenceWith
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=differenceWith.js.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Removes a specified number of elements from the beginning of an array and returns the rest.
|
|
3
|
-
*
|
|
4
|
-
* This function takes an array and a number, and returns a new array with the specified number
|
|
3
|
+
*
|
|
4
|
+
* This function takes an array and a number, and returns a new array with the specified number
|
|
5
5
|
* of elements removed from the start.
|
|
6
6
|
*
|
|
7
7
|
* @param {T[]} arr - The array from which to drop elements.
|
|
8
8
|
* @param {number} itemsCount - The number of elements to drop from the beginning of the array.
|
|
9
9
|
* @returns {T[]} A new array with the specified number of elements removed from the start.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* @example
|
|
12
12
|
* * const array = [1, 2, 3, 4, 5];
|
|
13
13
|
* const result = drop(array, 2);
|
|
14
14
|
* // result will be [3, 4, 5] since the first two elements are dropped.
|
|
15
15
|
*/
|
|
16
|
-
function drop(arr, itemsCount)
|
|
17
|
-
return arr.slice(itemsCount);
|
|
18
|
-
}
|
|
16
|
+
declare function drop<T>(arr: T[], itemsCount: number): T[];
|
|
19
17
|
|
|
20
18
|
export { drop };
|
package/dist/array/drop.d.ts
CHANGED
|
@@ -13,4 +13,6 @@
|
|
|
13
13
|
* const result = drop(array, 2);
|
|
14
14
|
* // result will be [3, 4, 5] since the first two elements are dropped.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
declare function drop<T>(arr: T[], itemsCount: number): T[];
|
|
17
|
+
|
|
18
|
+
export { drop };
|
|
@@ -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/drop.ts
|
|
21
|
+
var drop_exports = {};
|
|
22
|
+
__export(drop_exports, {
|
|
23
|
+
drop: () => drop
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(drop_exports);
|
|
26
|
+
function drop(arr, itemsCount) {
|
|
27
|
+
return arr.slice(itemsCount);
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
drop
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=drop.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,KAAQ,KAAU,YAAyB;AACzD,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Removes a specified number of elements from the end of an array and returns the rest.
|
|
3
|
-
*
|
|
4
|
-
* This function takes an array and a number, and returns a new array with the specified number
|
|
3
|
+
*
|
|
4
|
+
* This function takes an array and a number, and returns a new array with the specified number
|
|
5
5
|
* of elements removed from the end.
|
|
6
6
|
*
|
|
7
7
|
* @param {T[]} arr - The array from which to drop elements.
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
* const result = dropRight(array, 2);
|
|
14
14
|
* // result will be [1, 2, 3] since the last two elements are dropped.
|
|
15
15
|
*/
|
|
16
|
-
function dropRight(arr, itemsCount)
|
|
17
|
-
return arr.slice(0, -itemsCount);
|
|
18
|
-
}
|
|
16
|
+
declare function dropRight<T>(arr: T[], itemsCount: number): T[];
|
|
19
17
|
|
|
20
18
|
export { dropRight };
|
|
@@ -13,4 +13,6 @@
|
|
|
13
13
|
* const result = dropRight(array, 2);
|
|
14
14
|
* // result will be [1, 2, 3] since the last two elements are dropped.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
declare function dropRight<T>(arr: T[], itemsCount: number): T[];
|
|
17
|
+
|
|
18
|
+
export { dropRight };
|
|
@@ -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/dropRight.ts
|
|
21
|
+
var dropRight_exports = {};
|
|
22
|
+
__export(dropRight_exports, {
|
|
23
|
+
dropRight: () => dropRight
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(dropRight_exports);
|
|
26
|
+
function dropRight(arr, itemsCount) {
|
|
27
|
+
return arr.slice(0, -itemsCount);
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
dropRight
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=dropRight.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,UAAa,KAAU,YAAyB;AAC9D,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { dropWhile } from './dropWhile.mjs';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Removes elements from the end of an array until the predicate returns false.
|
|
5
|
-
*
|
|
6
|
-
* This function iterates over an array from the end and drops elements until the provided
|
|
3
|
+
*
|
|
4
|
+
* This function iterates over an array from the end and drops elements until the provided
|
|
7
5
|
* predicate function returns false. It then returns a new array with the remaining elements.
|
|
8
6
|
*
|
|
9
7
|
* @param {T[]} arr - The array from which to drop elements.
|
|
10
|
-
* @param {function(item: T): boolean} canContinueDropping - A predicate function that determines
|
|
11
|
-
* whether to continue dropping elements. The function is called with each element from the end,
|
|
8
|
+
* @param {function(item: T): boolean} canContinueDropping - A predicate function that determines
|
|
9
|
+
* whether to continue dropping elements. The function is called with each element from the end,
|
|
12
10
|
* and dropping continues as long as it returns true.
|
|
13
11
|
* @returns {T[]} A new array with the elements remaining after the predicate returns false.
|
|
14
12
|
*
|
|
@@ -17,10 +15,6 @@ import { dropWhile } from './dropWhile.mjs';
|
|
|
17
15
|
* const result = dropRightWhile(array, x => x > 3);
|
|
18
16
|
* // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.
|
|
19
17
|
*/
|
|
20
|
-
function dropRightWhile(arr, canContinueDropping)
|
|
21
|
-
var reversed = arr.slice().reverse();
|
|
22
|
-
var dropped = dropWhile(reversed, canContinueDropping);
|
|
23
|
-
return dropped.slice().reverse();
|
|
24
|
-
}
|
|
18
|
+
declare function dropRightWhile<T>(arr: T[], canContinueDropping: (item: T) => boolean): T[];
|
|
25
19
|
|
|
26
20
|
export { dropRightWhile };
|