es-toolkit 1.0.4-dev.42 → 1.0.4

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.
Files changed (242) hide show
  1. package/README.md +1 -0
  2. package/dist/array/chunk.js.map +1 -1
  3. package/dist/array/chunk.mjs +1 -1
  4. package/dist/array/difference.js.map +1 -1
  5. package/dist/array/difference.mjs +1 -1
  6. package/dist/array/differenceBy.js.map +1 -1
  7. package/dist/array/differenceBy.mjs +1 -1
  8. package/dist/array/differenceWith.js.map +1 -1
  9. package/dist/array/differenceWith.mjs +1 -1
  10. package/dist/array/drop.js.map +1 -1
  11. package/dist/array/drop.mjs +1 -1
  12. package/dist/array/dropRight.js.map +1 -1
  13. package/dist/array/dropRight.mjs +1 -1
  14. package/dist/array/dropRightWhile.js.map +1 -1
  15. package/dist/array/dropRightWhile.mjs +2 -2
  16. package/dist/array/dropWhile.js.map +1 -1
  17. package/dist/array/dropWhile.mjs +1 -1
  18. package/dist/array/groupBy.js.map +1 -1
  19. package/dist/array/groupBy.mjs +1 -1
  20. package/dist/array/index.js.map +1 -1
  21. package/dist/array/index.mjs +51 -51
  22. package/dist/array/intersection.js.map +1 -1
  23. package/dist/array/intersection.mjs +1 -1
  24. package/dist/array/intersectionBy.js.map +1 -1
  25. package/dist/array/intersectionBy.mjs +1 -1
  26. package/dist/array/intersectionWith.js.map +1 -1
  27. package/dist/array/intersectionWith.mjs +1 -1
  28. package/dist/array/partition.js.map +1 -1
  29. package/dist/array/partition.mjs +1 -1
  30. package/dist/array/sample.js.map +1 -1
  31. package/dist/array/sample.mjs +1 -1
  32. package/dist/array/shuffle.js.map +1 -1
  33. package/dist/array/shuffle.mjs +1 -1
  34. package/dist/array/take.js.map +1 -1
  35. package/dist/array/take.mjs +1 -1
  36. package/dist/array/takeRight.js.map +1 -1
  37. package/dist/array/takeRight.mjs +1 -1
  38. package/dist/array/takeRightWhile.js.map +1 -1
  39. package/dist/array/takeRightWhile.mjs +1 -1
  40. package/dist/array/takeWhile.js.map +1 -1
  41. package/dist/array/takeWhile.mjs +1 -1
  42. package/dist/array/union.js.map +1 -1
  43. package/dist/array/union.mjs +2 -2
  44. package/dist/array/unionBy.js.map +1 -1
  45. package/dist/array/unionBy.mjs +1 -1
  46. package/dist/array/unionWith.js.map +1 -1
  47. package/dist/array/unionWith.mjs +2 -2
  48. package/dist/array/uniq.js.map +1 -1
  49. package/dist/array/uniq.mjs +1 -1
  50. package/dist/array/uniqBy.js.map +1 -1
  51. package/dist/array/uniqBy.mjs +2 -2
  52. package/dist/array/uniqWith.js.map +1 -1
  53. package/dist/array/uniqWith.mjs +1 -1
  54. package/dist/array/xor.js.map +1 -1
  55. package/dist/array/xor.mjs +5 -5
  56. package/dist/array/xorBy.js.map +1 -1
  57. package/dist/array/xorBy.mjs +4 -4
  58. package/dist/array/xorWith.js.map +1 -1
  59. package/dist/array/xorWith.mjs +5 -5
  60. package/dist/array/zip.js.map +1 -1
  61. package/dist/array/zip.mjs +1 -1
  62. package/dist/array/zipWith.js.map +1 -1
  63. package/dist/array/zipWith.mjs +1 -1
  64. package/dist/{chunk-LLOAPSQ6.mjs → chunk-2KXLTAVK.mjs} +1 -1
  65. package/dist/{chunk-LLOAPSQ6.mjs.map → chunk-2KXLTAVK.mjs.map} +1 -1
  66. package/dist/{chunk-ANJSX6WH.mjs → chunk-2VB6XU3I.mjs} +1 -1
  67. package/dist/chunk-2VB6XU3I.mjs.map +1 -0
  68. package/dist/{chunk-OS5PZ4B4.mjs → chunk-35TWSMYS.mjs} +1 -1
  69. package/dist/{chunk-OS5PZ4B4.mjs.map → chunk-35TWSMYS.mjs.map} +1 -1
  70. package/dist/{chunk-L25VRQ54.mjs → chunk-5JWSGT4R.mjs} +1 -1
  71. package/dist/chunk-5JWSGT4R.mjs.map +1 -0
  72. package/dist/{chunk-AFYV2UVZ.mjs → chunk-724PNXPR.mjs} +1 -1
  73. package/dist/chunk-724PNXPR.mjs.map +1 -0
  74. package/dist/{chunk-YNRYG5OB.mjs → chunk-7GWOR247.mjs} +1 -1
  75. package/dist/chunk-7GWOR247.mjs.map +1 -0
  76. package/dist/{chunk-QC3SFAQJ.mjs → chunk-7OZZODAE.mjs} +4 -4
  77. package/dist/chunk-7OZZODAE.mjs.map +1 -0
  78. package/dist/{chunk-SPLO5OZW.mjs → chunk-7PPND7QY.mjs} +1 -1
  79. package/dist/chunk-7PPND7QY.mjs.map +1 -0
  80. package/dist/{chunk-ZBG3EYM3.mjs → chunk-7SJHJHBN.mjs} +1 -1
  81. package/dist/chunk-7SJHJHBN.mjs.map +1 -0
  82. package/dist/{chunk-UFAA5WKR.mjs → chunk-ARWKEQMQ.mjs} +1 -1
  83. package/dist/chunk-ARWKEQMQ.mjs.map +1 -0
  84. package/dist/{chunk-L3C6TG2V.mjs → chunk-BAJC3BM7.mjs} +1 -1
  85. package/dist/chunk-BAJC3BM7.mjs.map +1 -0
  86. package/dist/{chunk-SQOYF647.mjs → chunk-EAI4DDCQ.mjs} +1 -1
  87. package/dist/chunk-EAI4DDCQ.mjs.map +1 -0
  88. package/dist/{chunk-PUQLVKMB.mjs → chunk-EAI6NLXI.mjs} +1 -1
  89. package/dist/chunk-EAI6NLXI.mjs.map +1 -0
  90. package/dist/{chunk-Y6ZRNII6.mjs → chunk-FUWEG5ZM.mjs} +1 -1
  91. package/dist/chunk-FUWEG5ZM.mjs.map +1 -0
  92. package/dist/{chunk-7LAOIS6P.mjs → chunk-GJM7F3TH.mjs} +1 -1
  93. package/dist/chunk-GJM7F3TH.mjs.map +1 -0
  94. package/dist/{chunk-OLBUAFBX.mjs → chunk-HQF6OFGM.mjs} +1 -1
  95. package/dist/chunk-HQF6OFGM.mjs.map +1 -0
  96. package/dist/{chunk-PHG5JCSW.mjs → chunk-J3NTLMAE.mjs} +1 -1
  97. package/dist/chunk-J3NTLMAE.mjs.map +1 -0
  98. package/dist/{chunk-TK2EDHSP.mjs → chunk-JMLFPGZ3.mjs} +2 -2
  99. package/dist/chunk-JMLFPGZ3.mjs.map +1 -0
  100. package/dist/{chunk-GELVVASW.mjs → chunk-L4Y3G6AJ.mjs} +3 -3
  101. package/dist/chunk-L4Y3G6AJ.mjs.map +1 -0
  102. package/dist/{chunk-YHY2XTJW.mjs → chunk-LAZNLIBJ.mjs} +1 -1
  103. package/dist/chunk-LAZNLIBJ.mjs.map +1 -0
  104. package/dist/{chunk-TF6N37OE.mjs → chunk-NEMQJ2GF.mjs} +1 -1
  105. package/dist/chunk-NEMQJ2GF.mjs.map +1 -0
  106. package/dist/{chunk-HOQRMBSB.mjs → chunk-NK2262VG.mjs} +1 -1
  107. package/dist/chunk-NK2262VG.mjs.map +1 -0
  108. package/dist/{chunk-M3SHJ3LL.mjs → chunk-NSYWEYWT.mjs} +1 -1
  109. package/dist/chunk-NSYWEYWT.mjs.map +1 -0
  110. package/dist/{chunk-6BCRFIEW.mjs → chunk-NYVT33DR.mjs} +1 -1
  111. package/dist/chunk-NYVT33DR.mjs.map +1 -0
  112. package/dist/{chunk-B5P232BA.mjs → chunk-OBMK7JO2.mjs} +1 -1
  113. package/dist/chunk-OBMK7JO2.mjs.map +1 -0
  114. package/dist/{chunk-2PB2OCC6.mjs → chunk-PTQLD7TG.mjs} +1 -1
  115. package/dist/chunk-PTQLD7TG.mjs.map +1 -0
  116. package/dist/{chunk-IFCX35BI.mjs → chunk-PWMHSN27.mjs} +1 -1
  117. package/dist/chunk-PWMHSN27.mjs.map +1 -0
  118. package/dist/{chunk-JDMFIUGM.mjs → chunk-QRQPLMV4.mjs} +1 -1
  119. package/dist/chunk-QRQPLMV4.mjs.map +1 -0
  120. package/dist/{chunk-TULUUJ3E.mjs → chunk-R5DNKXDI.mjs} +4 -4
  121. package/dist/chunk-R5DNKXDI.mjs.map +1 -0
  122. package/dist/{chunk-GLAZTR32.mjs → chunk-RLDY4N3Q.mjs} +2 -2
  123. package/dist/chunk-RLDY4N3Q.mjs.map +1 -0
  124. package/dist/{chunk-PRTIPC5X.mjs → chunk-RU3RXBUC.mjs} +1 -1
  125. package/dist/chunk-RU3RXBUC.mjs.map +1 -0
  126. package/dist/{chunk-3PFYAKOD.mjs → chunk-S767XFOS.mjs} +1 -1
  127. package/dist/chunk-S767XFOS.mjs.map +1 -0
  128. package/dist/{chunk-6LDIBBWQ.mjs → chunk-SGSQKXDO.mjs} +2 -2
  129. package/dist/chunk-SGSQKXDO.mjs.map +1 -0
  130. package/dist/{chunk-23DC774L.mjs → chunk-TOLR2FNF.mjs} +1 -1
  131. package/dist/chunk-TOLR2FNF.mjs.map +1 -0
  132. package/dist/{chunk-V6LXSPMF.mjs → chunk-UNX3KZO2.mjs} +1 -1
  133. package/dist/chunk-UNX3KZO2.mjs.map +1 -0
  134. package/dist/{chunk-J6SWM4X6.mjs → chunk-UZP4YX7I.mjs} +1 -1
  135. package/dist/chunk-UZP4YX7I.mjs.map +1 -0
  136. package/dist/{chunk-6GRNTXI3.mjs → chunk-VACGGQOL.mjs} +1 -1
  137. package/dist/chunk-VACGGQOL.mjs.map +1 -0
  138. package/dist/{chunk-XLO3QZVY.mjs → chunk-VAKCSKGR.mjs} +3 -3
  139. package/dist/chunk-VAKCSKGR.mjs.map +1 -0
  140. package/dist/{chunk-YEZIGQJG.mjs → chunk-VJGGYY4Y.mjs} +2 -2
  141. package/dist/chunk-VJGGYY4Y.mjs.map +1 -0
  142. package/dist/{chunk-KBJTBR5T.mjs → chunk-WFQ3LAHQ.mjs} +1 -1
  143. package/dist/chunk-WFQ3LAHQ.mjs.map +1 -0
  144. package/dist/{chunk-TCHT4HCP.mjs → chunk-XS4ZPJMT.mjs} +4 -4
  145. package/dist/chunk-XS4ZPJMT.mjs.map +1 -0
  146. package/dist/{chunk-T2C2WVFL.mjs → chunk-XW452I77.mjs} +1 -1
  147. package/dist/chunk-XW452I77.mjs.map +1 -0
  148. package/dist/{chunk-ZQNAZPSK.mjs → chunk-YMNXRH52.mjs} +1 -1
  149. package/dist/chunk-YMNXRH52.mjs.map +1 -0
  150. package/dist/{chunk-SF3V7XXM.mjs → chunk-Z4IO7EIH.mjs} +1 -1
  151. package/dist/chunk-Z4IO7EIH.mjs.map +1 -0
  152. package/dist/function/debounce.d.mts +4 -3
  153. package/dist/function/debounce.d.ts +4 -3
  154. package/dist/function/debounce.js +2 -2
  155. package/dist/function/debounce.js.map +1 -1
  156. package/dist/function/debounce.mjs +1 -1
  157. package/dist/function/index.js +4 -4
  158. package/dist/function/index.js.map +1 -1
  159. package/dist/function/index.mjs +3 -3
  160. package/dist/function/once.js.map +1 -1
  161. package/dist/function/once.mjs +1 -1
  162. package/dist/function/throttle.d.mts +3 -3
  163. package/dist/function/throttle.d.ts +3 -3
  164. package/dist/function/throttle.js +2 -2
  165. package/dist/function/throttle.js.map +1 -1
  166. package/dist/function/throttle.mjs +1 -1
  167. package/dist/index.js +4 -4
  168. package/dist/index.js.map +1 -1
  169. package/dist/index.mjs +72 -72
  170. package/dist/math/index.js.map +1 -1
  171. package/dist/math/index.mjs +2 -2
  172. package/dist/math/round.js.map +1 -1
  173. package/dist/math/round.mjs +1 -1
  174. package/dist/math/sum.js.map +1 -1
  175. package/dist/math/sum.mjs +1 -1
  176. package/dist/object/index.js.map +1 -1
  177. package/dist/object/index.mjs +4 -4
  178. package/dist/object/omit.js.map +1 -1
  179. package/dist/object/omit.mjs +1 -1
  180. package/dist/object/omitBy.js.map +1 -1
  181. package/dist/object/omitBy.mjs +1 -1
  182. package/dist/object/pick.js.map +1 -1
  183. package/dist/object/pick.mjs +1 -1
  184. package/dist/object/pickBy.js.map +1 -1
  185. package/dist/object/pickBy.mjs +1 -1
  186. package/dist/predicate/index.js.map +1 -1
  187. package/dist/predicate/index.mjs +4 -4
  188. package/dist/predicate/isNil.js.map +1 -1
  189. package/dist/predicate/isNil.mjs +1 -1
  190. package/dist/predicate/isNotNil.js.map +1 -1
  191. package/dist/predicate/isNotNil.mjs +1 -1
  192. package/dist/predicate/isNull.js.map +1 -1
  193. package/dist/predicate/isNull.mjs +1 -1
  194. package/dist/predicate/isUndefined.js.map +1 -1
  195. package/dist/predicate/isUndefined.mjs +1 -1
  196. package/dist/promise/delay.js.map +1 -1
  197. package/dist/promise/delay.mjs +1 -1
  198. package/dist/promise/index.js.map +1 -1
  199. package/dist/promise/index.mjs +1 -1
  200. package/package.json +2 -3
  201. package/dist/chunk-23DC774L.mjs.map +0 -1
  202. package/dist/chunk-2PB2OCC6.mjs.map +0 -1
  203. package/dist/chunk-3PFYAKOD.mjs.map +0 -1
  204. package/dist/chunk-6BCRFIEW.mjs.map +0 -1
  205. package/dist/chunk-6GRNTXI3.mjs.map +0 -1
  206. package/dist/chunk-6LDIBBWQ.mjs.map +0 -1
  207. package/dist/chunk-7LAOIS6P.mjs.map +0 -1
  208. package/dist/chunk-AFYV2UVZ.mjs.map +0 -1
  209. package/dist/chunk-ANJSX6WH.mjs.map +0 -1
  210. package/dist/chunk-B5P232BA.mjs.map +0 -1
  211. package/dist/chunk-GELVVASW.mjs.map +0 -1
  212. package/dist/chunk-GLAZTR32.mjs.map +0 -1
  213. package/dist/chunk-HOQRMBSB.mjs.map +0 -1
  214. package/dist/chunk-IFCX35BI.mjs.map +0 -1
  215. package/dist/chunk-J6SWM4X6.mjs.map +0 -1
  216. package/dist/chunk-JDMFIUGM.mjs.map +0 -1
  217. package/dist/chunk-KBJTBR5T.mjs.map +0 -1
  218. package/dist/chunk-L25VRQ54.mjs.map +0 -1
  219. package/dist/chunk-L3C6TG2V.mjs.map +0 -1
  220. package/dist/chunk-M3SHJ3LL.mjs.map +0 -1
  221. package/dist/chunk-OLBUAFBX.mjs.map +0 -1
  222. package/dist/chunk-PHG5JCSW.mjs.map +0 -1
  223. package/dist/chunk-PRTIPC5X.mjs.map +0 -1
  224. package/dist/chunk-PUQLVKMB.mjs.map +0 -1
  225. package/dist/chunk-QC3SFAQJ.mjs.map +0 -1
  226. package/dist/chunk-SF3V7XXM.mjs.map +0 -1
  227. package/dist/chunk-SPLO5OZW.mjs.map +0 -1
  228. package/dist/chunk-SQOYF647.mjs.map +0 -1
  229. package/dist/chunk-T2C2WVFL.mjs.map +0 -1
  230. package/dist/chunk-TCHT4HCP.mjs.map +0 -1
  231. package/dist/chunk-TF6N37OE.mjs.map +0 -1
  232. package/dist/chunk-TK2EDHSP.mjs.map +0 -1
  233. package/dist/chunk-TULUUJ3E.mjs.map +0 -1
  234. package/dist/chunk-UFAA5WKR.mjs.map +0 -1
  235. package/dist/chunk-V6LXSPMF.mjs.map +0 -1
  236. package/dist/chunk-XLO3QZVY.mjs.map +0 -1
  237. package/dist/chunk-Y6ZRNII6.mjs.map +0 -1
  238. package/dist/chunk-YEZIGQJG.mjs.map +0 -1
  239. package/dist/chunk-YHY2XTJW.mjs.map +0 -1
  240. package/dist/chunk-YNRYG5OB.mjs.map +0 -1
  241. package/dist/chunk-ZBG3EYM3.mjs.map +0 -1
  242. package/dist/chunk-ZQNAZPSK.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/xor.ts"],"sourcesContent":["import { difference } from \"./difference\";\nimport { intersection } from \"./intersection\";\nimport { union } from \"./union\";\n\n/**\n * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements\n * which are in either of the arrays, but not in their intersection.\n * \n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.\n * \n * @example\n * // Returns [1, 2, 5, 6]\n * xor([1, 2, 3, 4], [3, 4, 5, 6]);\n * \n * @example\n * // Returns ['a', 'c']\n * xor(['a', 'b'], ['b', 'c']);\n */\nexport function xor<T>(arr1: T[], arr2: T[]): T[] {\n return difference(union(arr1, arr2), intersection(arr1, arr2));\n}"],"mappings":";;;;;;;;;;;AAoBO,SAAS,IAAO,MAAW,MAAgB;AAChD,SAAO,WAAW,MAAM,MAAM,IAAI,GAAG,aAAa,MAAM,IAAI,CAAC;AAC/D;","names":[]}
@@ -13,4 +13,4 @@ function unionBy(arr1, arr2, mapper) {
13
13
  export {
14
14
  unionBy
15
15
  };
16
- //# sourceMappingURL=chunk-SPLO5OZW.mjs.map
16
+ //# sourceMappingURL=chunk-7PPND7QY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/unionBy.ts"],"sourcesContent":["/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n * \n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {function(item: T): U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.\n * \n * @example\n * // Custom mapping function for numbers (modulo comparison)\n * const moduloMapper = (x) => x % 3;\n * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);\n * // Returns [1, 2, 3]\n * \n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = (obj) => obj.id;\n * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]\n */\nexport function unionBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of [...arr1, ...arr2]) {\n const key = mapper(item);\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return [...map.values()];\n}\n"],"mappings":";AAoBO,SAAS,QAAc,MAAW,MAAW,QAA6B;AAC/E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACrC,UAAM,MAAM,OAAO,IAAI;AACvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;","names":[]}
@@ -8,4 +8,4 @@ function delay(ms) {
8
8
  export {
9
9
  delay
10
10
  };
11
- //# sourceMappingURL=chunk-ZBG3EYM3.mjs.map
11
+ //# sourceMappingURL=chunk-7SJHJHBN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/promise/delay.ts"],"sourcesContent":["/**\n * Delays the execution of code for a specified number of milliseconds.\n * \n * This function returns a Promise that resolves after the specified delay, allowing you to use it \n * with async/await to pause execution.\n *\n * @param {number} ms - The number of milliseconds to delay.\n * @returns {Promise<void>} A Promise that resolves after the specified delay.\n *\n * @example\n * async function foo() {\n * console.log('Start');\n * await delay(1000); // Delays execution for 1 second\n * console.log('End');\n * }\n * \n * foo();\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise(resolve => {\n setTimeout(resolve, ms);\n });\n}\n"],"mappings":";AAkBO,SAAS,MAAM,IAA2B;AAC/C,SAAO,IAAI,QAAQ,aAAW;AAC5B,eAAW,SAAS,EAAE;AAAA,EACxB,CAAC;AACH;","names":[]}
@@ -16,4 +16,4 @@ function once(func) {
16
16
  export {
17
17
  once
18
18
  };
19
- //# sourceMappingURL=chunk-UFAA5WKR.mjs.map
19
+ //# sourceMappingURL=chunk-ARWKEQMQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/function/once.ts"],"sourcesContent":["/**\n * Creates a function that is restricted to invoking the provided function `func` once.\n * Repeated calls to the function will return the value from the first invocation.\n *\n * @param {F} func - The function to restrict.\n * @returns {F} A new function that invokes `func` once and caches the result.\n *\n * @example\n * const initialize = once(() => {\n * console.log('Initialized!');\n * return true;\n * });\n * \n * initialize(); // Logs: 'Initialized!' and returns true\n * initialize(); // Returns true without logging\n */\nexport function once<F extends () => any>(func: F): F {\n let called = false;\n let cache: ReturnType<F> | undefined;\n\n return function () {\n if (called) {\n return cache;\n }\n\n const result = func();\n\n called = true;\n cache = result;\n\n return result;\n } as F;\n}\n"],"mappings":";AAgBO,SAAS,KAA0B,MAAY;AACpD,MAAI,SAAS;AACb,MAAI;AAEJ,SAAO,WAAY;AACjB,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,KAAK;AAEpB,aAAS;AACT,YAAQ;AAER,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -9,4 +9,4 @@ function takeRight(arr, count) {
9
9
  export {
10
10
  takeRight
11
11
  };
12
- //# sourceMappingURL=chunk-L3C6TG2V.mjs.map
12
+ //# sourceMappingURL=chunk-BAJC3BM7.mjs.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}"],"mappings":";AAoBO,SAAS,UAAa,KAAU,OAAoB;AACzD,MAAI,UAAU,GAAG;AACf,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,CAAC,KAAK;AACzB;","names":[]}
@@ -13,4 +13,4 @@ function uniqWith(arr, areItemsEqual) {
13
13
  export {
14
14
  uniqWith
15
15
  };
16
- //# sourceMappingURL=chunk-SQOYF647.mjs.map
16
+ //# sourceMappingURL=chunk-EAI4DDCQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/uniqWith.ts"],"sourcesContent":["/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(\n arr: T[],\n areItemsEqual: (item1: T, item2: T) => boolean\n): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every((v) => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";AAWO,SAAS,SACd,KACA,eACK;AACL,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;AAE1D,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -9,4 +9,4 @@ function differenceBy(firstArr, secondArr, mapper) {
9
9
  export {
10
10
  differenceBy
11
11
  };
12
- //# sourceMappingURL=chunk-PUQLVKMB.mjs.map
12
+ //# sourceMappingURL=chunk-EAI6NLXI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/differenceBy.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays after mapping their elements through a provided function.\n * \n * This function takes two arrays and a mapper function. It returns a new array containing the elements \n * that are present in the first array but not in the second array, based on the identity calculated \n * by the mapper function. \n * \n * Essentially, it filters out any elements from the first array that, when \n * mapped, match an element in the mapped version of the second array.\n *\n * @template T, U\n * @param {T[]} firstArr - The primary array from which to derive the difference. \n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function \n * is applied to each element in both arrays, and the comparison is made based on the mapped values.\n * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding \n * mapped identity in the second array.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = differenceBy(array1, array2, mapper);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.\n */\nexport function differenceBy<T, U>(firstArr: T[], secondArr: T[], mapper: (value: T) => U): T[] {\n const mappedSecondArr = secondArr.map(item => mapper(item));\n \n return firstArr.filter(item => {\n return !mappedSecondArr.includes(mapper(item));\n });\n}"],"mappings":";AAyBO,SAAS,aAAmB,UAAe,WAAgB,QAA8B;AAC9F,QAAM,kBAAkB,UAAU,IAAI,UAAQ,OAAO,IAAI,CAAC;AAE1D,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAAA,EAC/C,CAAC;AACH;","names":[]}
@@ -6,4 +6,4 @@ function isNull(x) {
6
6
  export {
7
7
  isNull
8
8
  };
9
- //# sourceMappingURL=chunk-Y6ZRNII6.mjs.map
9
+ //# sourceMappingURL=chunk-FUWEG5ZM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/predicate/isNull.ts"],"sourcesContent":["/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`. \n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n * \n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * \n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n"],"mappings":";AAoBO,SAAS,OAAO,GAAuB;AAC5C,SAAO,MAAM;AACf;","names":[]}
@@ -10,4 +10,4 @@ function intersectionWith(firstArr, secondArr, areItemsEqual) {
10
10
  export {
11
11
  intersectionWith
12
12
  };
13
- //# sourceMappingURL=chunk-7LAOIS6P.mjs.map
13
+ //# sourceMappingURL=chunk-GJM7F3TH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/intersectionWith.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays based on a custom equality function.\n * \n * This function takes two arrays and a custom equality function. It returns a new array containing \n * the elements from the first array that have matching elements in the second array, as determined \n * by the custom equality function. It effectively filters out any elements from the first array that \n * do not have corresponding matches in the second array according to the equality function.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal. \n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,iBAAoB,UAAe,WAAgB,eAA6C;AAC9G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -6,4 +6,4 @@ function take(arr, count) {
6
6
  export {
7
7
  take
8
8
  };
9
- //# sourceMappingURL=chunk-OLBUAFBX.mjs.map
9
+ //# sourceMappingURL=chunk-HQF6OFGM.mjs.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}"],"mappings":";AAsBO,SAAS,KAAQ,KAAU,OAAe;AAC/C,SAAO,IAAI,MAAM,GAAG,KAAK;AAC3B;","names":[]}
@@ -7,4 +7,4 @@ function sample(arr) {
7
7
  export {
8
8
  sample
9
9
  };
10
- //# sourceMappingURL=chunk-PHG5JCSW.mjs.map
10
+ //# sourceMappingURL=chunk-J3NTLMAE.mjs.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":";AAaO,SAAS,OAAU,KAAa;AACrC,QAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,IAAI,MAAM;AACzD,SAAO,IAAI,WAAW;AACxB;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniqWith
3
- } from "./chunk-SQOYF647.mjs";
3
+ } from "./chunk-EAI4DDCQ.mjs";
4
4
 
5
5
  // src/array/uniqBy.ts
6
6
  function uniqBy(arr, converter) {
@@ -10,4 +10,4 @@ function uniqBy(arr, converter) {
10
10
  export {
11
11
  uniqBy
12
12
  };
13
- //# sourceMappingURL=chunk-TK2EDHSP.mjs.map
13
+ //# sourceMappingURL=chunk-JMLFPGZ3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/uniqBy.ts"],"sourcesContent":["import { uniqWith } from \"./uniqWith\";\n\n/**\n * The `uniqBy` function takes an array as its first argument and a 'converter' function as the second. It maps the array elements using the converter function, then removes any duplicates.\n *\n * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: T[], converter: (item: T) => U): T[] {\n return uniqWith(arr, (item1, item2) => converter(item1) === converter(item2));\n}\n"],"mappings":";;;;;AAaO,SAAS,OAAa,KAAU,WAAgC;AACrE,SAAO,SAAS,KAAK,CAAC,OAAO,UAAU,UAAU,KAAK,MAAM,UAAU,KAAK,CAAC;AAC9E;","names":[]}
@@ -1,12 +1,12 @@
1
1
  // src/function/debounce.ts
2
2
  function debounce(func, debounceMs) {
3
3
  let timeoutId = null;
4
- const debounced = function(...args) {
4
+ const debounced = function() {
5
5
  if (timeoutId != null) {
6
6
  clearTimeout(timeoutId);
7
7
  }
8
8
  timeoutId = setTimeout(() => {
9
- func(...args);
9
+ func();
10
10
  }, debounceMs);
11
11
  };
12
12
  debounced.cancel = function() {
@@ -20,4 +20,4 @@ function debounce(func, debounceMs) {
20
20
  export {
21
21
  debounce
22
22
  };
23
- //# sourceMappingURL=chunk-GELVVASW.mjs.map
23
+ //# sourceMappingURL=chunk-L4Y3G6AJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/function/debounce.ts"],"sourcesContent":["/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @param {() => void} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @returns {{ (): void; cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n * \n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n */\nexport function debounce(func: () => void, debounceMs: number): { (): void; cancel: () => void } {\n let timeoutId: number | NodeJS.Timeout | null = null;\n\n const debounced = function () {\n if (timeoutId != null) {\n clearTimeout(timeoutId);\n }\n \n \n timeoutId = setTimeout(() => {\n func();\n }, debounceMs);\n };\n\n debounced.cancel = function () {\n if (timeoutId != null) {\n clearTimeout(timeoutId);\n }\n } \n\n return debounced;\n}"],"mappings":";AAoBO,SAAS,SAAS,MAAkB,YAAsD;AAC/F,MAAI,YAA4C;AAEhD,QAAM,YAAY,WAAY;AAC5B,QAAI,aAAa,MAAM;AACrB,mBAAa,SAAS;AAAA,IACxB;AAGA,gBAAY,WAAW,MAAM;AAC3B,WAAK;AAAA,IACP,GAAG,UAAU;AAAA,EACf;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,aAAa,MAAM;AACrB,mBAAa,SAAS;AAAA,IACxB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -7,4 +7,4 @@ function round(value, precision = 0) {
7
7
  export {
8
8
  round
9
9
  };
10
- //# sourceMappingURL=chunk-YHY2XTJW.mjs.map
10
+ //# sourceMappingURL=chunk-LAZNLIBJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/math/round.ts"],"sourcesContent":["/**\n * Rounds a number to a specified precision.\n * \n * This function takes a number and an optional precision value, and returns the number rounded \n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n *\n * @example\n * * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n */\nexport function round(value: number, precision: number = 0): number {\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n"],"mappings":";AAeO,SAAS,MAAM,OAAe,YAAoB,GAAW;AAClE,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;","names":[]}
@@ -15,4 +15,4 @@ function partition(arr, isInTruthy) {
15
15
  export {
16
16
  partition
17
17
  };
18
- //# sourceMappingURL=chunk-TF6N37OE.mjs.map
18
+ //# sourceMappingURL=chunk-NEMQJ2GF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into two groups based on a predicate function.\n * \n * This function takes an array and a predicate function. It returns a tuple of two arrays: \n * the first array contains elements for which the predicate function returns true, and \n * the second array contains elements for which the predicate function returns false.\n *\n * @param {T[]} arr - The array to partition.\n * @param {(value: T) => boolean} isInTruthy - A predicate function that determines \n * whether an element should be placed in the truthy array. The function is called with each \n * element of the array.\n * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for \n * which the predicate returned true, and the second array contains elements for which the \n * predicate returned false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const isEven = x => x % 2 === 0;\n * const [even, odd] = partition(array, isEven);\n * // even will be [2, 4], and odd will be [1, 3, 5]\n */\nexport function partition<T>(arr: T[], isInTruthy: (value: T) => boolean): [truthy: T[], falsy: T[]] {\n const truthy: T[] = [];\n const falsy: T[] = [];\n\n for (const item of arr) {\n if (isInTruthy(item)) {\n truthy.push(item);\n } else {\n falsy.push(item);\n }\n }\n\n return [truthy, falsy];\n}\n"],"mappings":";AAqBO,SAAS,UAAa,KAAU,YAA8D;AACnG,QAAM,SAAc,CAAC;AACrB,QAAM,QAAa,CAAC;AAEpB,aAAW,QAAQ,KAAK;AACtB,QAAI,WAAW,IAAI,GAAG;AACpB,aAAO,KAAK,IAAI;AAAA,IAClB,OAAO;AACL,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AAEA,SAAO,CAAC,QAAQ,KAAK;AACvB;","names":[]}
@@ -6,4 +6,4 @@ function isUndefined(x) {
6
6
  export {
7
7
  isUndefined
8
8
  };
9
- //# sourceMappingURL=chunk-HOQRMBSB.mjs.map
9
+ //# sourceMappingURL=chunk-NK2262VG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/predicate/isUndefined.ts"],"sourcesContent":["/**\n * Checks if the given value is undefined.\n *\n * This function tests whether the provided value is strictly equal to `undefined`. \n * It returns `true` if the value is `undefined`, and `false` otherwise.\n * \n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.\n *\n * @param {unknown} x - The value to test if it is undefined.\n * @returns {x is undefined} true if the value is undefined, false otherwise.\n *\n * @example\n * * const value1 = undefined;\n * const value2 = null;\n * const value3 = 42;\n * \n * console.log(isUndefined(value1)); // true\n * console.log(isUndefined(value2)); // false\n * console.log(isUndefined(value3)); // false\n */\nexport function isUndefined(x: unknown): x is undefined {\n return x === undefined;\n}\n"],"mappings":";AAoBO,SAAS,YAAY,GAA4B;AACtD,SAAO,MAAM;AACf;","names":[]}
@@ -10,4 +10,4 @@ function differenceWith(firstArr, secondArr, areItemsEqual) {
10
10
  export {
11
11
  differenceWith
12
12
  };
13
- //# sourceMappingURL=chunk-M3SHJ3LL.mjs.map
13
+ //# sourceMappingURL=chunk-NSYWEYWT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/differenceWith.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays based on a custom equality function.\n * \n * This function takes two arrays and a custom comparison function. It returns a new array containing \n * the elements that are present in the first array but not in the second array. The comparison to determine \n * if elements are equal is made using the provided custom function.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to get the difference.\n * @param {T[]} secondArr - The array containing elements to exclude from the first array. \n * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.\n * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array \n * according to the custom equality function.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = differenceWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.\n */\nexport function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,eAAkB,UAAe,WAAgB,eAA6C;AAC5G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -6,4 +6,4 @@ function drop(arr, itemsCount) {
6
6
  export {
7
7
  drop
8
8
  };
9
- //# sourceMappingURL=chunk-6BCRFIEW.mjs.map
9
+ //# sourceMappingURL=chunk-NYVT33DR.mjs.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}"],"mappings":";AAeO,SAAS,KAAQ,KAAU,YAAyB;AACzD,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
@@ -10,4 +10,4 @@ function sum(nums) {
10
10
  export {
11
11
  sum
12
12
  };
13
- //# sourceMappingURL=chunk-B5P232BA.mjs.map
13
+ //# sourceMappingURL=chunk-OBMK7JO2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n * \n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n"],"mappings":";AAaO,SAAS,IAAI,MAAwB;AAC1C,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;","names":[]}
@@ -8,4 +8,4 @@ function difference(firstArr, secondArr) {
8
8
  export {
9
9
  difference
10
10
  };
11
- //# sourceMappingURL=chunk-2PB2OCC6.mjs.map
11
+ //# sourceMappingURL=chunk-PTQLD7TG.mjs.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}"],"mappings":";AAsBO,SAAS,WAAc,UAAe,WAAqB;AAChE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,UAAU,SAAS,IAAI;AAAA,EACjC,CAAC;AACH;","names":[]}
@@ -11,4 +11,4 @@ function takeRightWhile(arr, shouldContinueTaking) {
11
11
  export {
12
12
  takeRightWhile
13
13
  };
14
- //# sourceMappingURL=chunk-IFCX35BI.mjs.map
14
+ //# sourceMappingURL=chunk-PWMHSN27.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/takeRightWhile.ts"],"sourcesContent":["/**\n * Takes elements from the end of the array while the predicate function returns `true`.\n * \n * @template T - Type of elements in the input array.\n * \n * @param {T[]} arr - The array to take elements from.\n * @param {function(T): boolean} shouldContinueTaking - The function invoked per element.\n * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.\n * \n * @example\n * // Returns [3, 2, 1]\n * takeRightWhile([5, 4, 3, 2, 1], n => n < 4);\n * \n * @example\n * // Returns []\n * takeRightWhile([1, 2, 3], n => n > 3);\n */\nexport function takeRightWhile<T>(arr: T[], shouldContinueTaking: (item: T) => boolean): T[] {\n for (let i = arr.length - 1; i >= 0; i--) {\n if (!shouldContinueTaking(arr[i])) {\n return arr.slice(i + 1);\n }\n }\n\n return arr.slice();\n}\n"],"mappings":";AAiBO,SAAS,eAAkB,KAAU,sBAAiD;AAC3F,WAAS,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK;AACxC,QAAI,CAAC,qBAAqB,IAAI,CAAC,CAAC,GAAG;AACjC,aAAO,IAAI,MAAM,IAAI,CAAC;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,IAAI,MAAM;AACnB;","names":[]}
@@ -13,4 +13,4 @@ function uniq(arr) {
13
13
  export {
14
14
  uniq
15
15
  };
16
- //# sourceMappingURL=chunk-JDMFIUGM.mjs.map
16
+ //# sourceMappingURL=chunk-QRQPLMV4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/uniq.ts"],"sourcesContent":["/**\n * Creates a duplicate-free version of an array.\n * \n * This function takes an array and returns a new array containing only the unique values \n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: T[]): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (result.includes(item)) {\n continue;\n }\n\n result.push(item);\n }\n\n return result;\n}\n"],"mappings":";AAcO,SAAS,KAAQ,KAAe;AACrC,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,QAAI,OAAO,SAAS,IAAI,GAAG;AACzB;AAAA,IACF;AAEA,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  unionBy
3
- } from "./chunk-SPLO5OZW.mjs";
3
+ } from "./chunk-7PPND7QY.mjs";
4
4
  import {
5
5
  intersectionBy
6
- } from "./chunk-ANJSX6WH.mjs";
6
+ } from "./chunk-2VB6XU3I.mjs";
7
7
  import {
8
8
  differenceBy
9
- } from "./chunk-PUQLVKMB.mjs";
9
+ } from "./chunk-EAI6NLXI.mjs";
10
10
 
11
11
  // src/array/xorBy.ts
12
12
  function xorBy(arr1, arr2, mapper) {
@@ -18,4 +18,4 @@ function xorBy(arr1, arr2, mapper) {
18
18
  export {
19
19
  xorBy
20
20
  };
21
- //# sourceMappingURL=chunk-TULUUJ3E.mjs.map
21
+ //# sourceMappingURL=chunk-R5DNKXDI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/xorBy.ts"],"sourcesContent":["import { differenceBy } from \"./differenceBy\";\nimport { intersectionBy } from \"./intersectionBy\";\nimport { unionBy } from \"./unionBy\";\n\n/**\n * Computes the symmetric difference between two arrays using a custom mapping function. \n * The symmetric difference is the set of elements which are in either of the arrays, \n * but not in their intersection, determined by the result of the mapping function.\n *\n * @template T - Type of elements in the input arrays.\n * @template U - Type of the values returned by the mapping function.\n * \n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {function(item: T): U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.\n * \n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = obj => obj.id;\n * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const union = unionBy(arr1, arr2, mapper);\n const intersection = intersectionBy(arr1, arr2, mapper);\n \n return differenceBy(union, intersection, mapper);\n}\n"],"mappings":";;;;;;;;;;;AAuBO,SAAS,MAAY,MAAW,MAAW,QAA6B;AAC7E,QAAM,QAAQ,QAAQ,MAAM,MAAM,MAAM;AACxC,QAAM,eAAe,eAAe,MAAM,MAAM,MAAM;AAEtD,SAAO,aAAa,OAAO,cAAc,MAAM;AACjD;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniq
3
- } from "./chunk-JDMFIUGM.mjs";
3
+ } from "./chunk-QRQPLMV4.mjs";
4
4
 
5
5
  // src/array/union.ts
6
6
  function union(arr1, arr2) {
@@ -10,4 +10,4 @@ function union(arr1, arr2) {
10
10
  export {
11
11
  union
12
12
  };
13
- //# sourceMappingURL=chunk-GLAZTR32.mjs.map
13
+ //# sourceMappingURL=chunk-RLDY4N3Q.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/union.ts"],"sourcesContent":["import { uniq } from \"./uniq\";\n\n/**\n * Creates an array of unique values from all given arrays.\n * \n * This function takes two arrays, merges them into a single array, and returns a new array \n * containing only the unique values from the merged array.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: T[], arr2: T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n"],"mappings":";;;;;AAkBO,SAAS,MAAS,MAAW,MAAgB;AAClD,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;","names":[]}
@@ -14,4 +14,4 @@ function zipWith(arr1, ...rest) {
14
14
  export {
15
15
  zipWith
16
16
  };
17
- //# sourceMappingURL=chunk-PRTIPC5X.mjs.map
17
+ //# sourceMappingURL=chunk-RU3RXBUC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/zipWith.ts"],"sourcesContent":["/**\n * Combines multiple arrays into a single array using a custom combiner function.\n * \n * This function takes multiple arrays and a combiner function, and returns a new array where each element \n * is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @param {T[]} arr1 - The first array to zip.\n * @param {U[]} [arr2] - The second array to zip (optional).\n * @param {V[]} [arr3] - The third array to zip (optional).\n * @param {W[]} [arr4] - The fourth array to zip (optional).\n * @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.\n * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @example\n * // Example usage with two arrays:\n * const arr1 = [1, 2, 3];\n * const arr2 = [4, 5, 6];\n * const result = zipWith(arr1, arr2, (a, b) => a + b);\n * // result will be [5, 7, 9]\n *\n * @example\n * // Example usage with three arrays:\n * const arr1 = [1, 2];\n * const arr2 = [3, 4];\n * const arr3 = [5, 6];\n * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);\n * // result will be [`135`, `246`]\n */\nexport function zipWith<T, R>(arr1: T[], combine: (item: T) => R): R[];\nexport function zipWith<T, U, R>(arr1: T[], arr2: U[], combine: (item1: T, item2: U) => R): R[];\nexport function zipWith<T, U, V, R>(arr1: T[], arr2: U[], arr3: V[], combine: (item1: T, item2: U, item3: V) => R): R[];\nexport function zipWith<T, U, V, W, R>(arr1: T[], arr2: U[], arr3: V[], arr4: W[], combine: (item1: T, item2: U, item3: V, item4: W) => R): R[];\nexport function zipWith<T, R>(arr1: T[], ...rest: any[]): R[] {\n const arrs = [arr1, ...rest.slice(0, -1)];\n const combine = rest[rest.length - 1] as (...items: T[]) => R;\n\n const result: R[] = [];\n const maxIndex = Math.max(...arrs.map(arr => arr.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const elements: T[] = arrs.map(arr => arr[i]);\n result.push(combine(...elements));\n }\n\n return result;\n}"],"mappings":";AAgCO,SAAS,QAAc,SAAc,MAAkB;AAC5D,QAAM,OAAO,CAAC,MAAM,GAAG,KAAK,MAAM,GAAG,EAAE,CAAC;AACxC,QAAM,UAAU,KAAK,KAAK,SAAS,CAAC;AAEpC,QAAM,SAAc,CAAC;AACrB,QAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,SAAO,IAAI,MAAM,CAAC;AAExD,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,WAAgB,KAAK,IAAI,SAAO,IAAI,CAAC,CAAC;AAC5C,WAAO,KAAK,QAAQ,GAAG,QAAQ,CAAC;AAAA,EAClC;AAEA,SAAO;AACT;","names":[]}
@@ -7,4 +7,4 @@ function dropWhile(arr, canContinueDropping) {
7
7
  export {
8
8
  dropWhile
9
9
  };
10
- //# sourceMappingURL=chunk-3PFYAKOD.mjs.map
10
+ //# sourceMappingURL=chunk-S767XFOS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/dropWhile.ts"],"sourcesContent":["/**\n * Removes elements from the beginning of an array until the predicate returns false.\n * \n * This function iterates over an array and drops elements from the start until the provided \n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines \n * whether to continue dropping elements. The function is called with each element, and dropping \n * continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropWhile(array, x => x < 3);\n * // result will be [3, 4, 5] since elements less than 3 are dropped.\n */\nexport function dropWhile<T>(arr: T[], canContinueDropping: (item: T) => boolean): T[] {\n const dropEndIndex = arr.findIndex(item => !canContinueDropping(item));\n return arr.slice(dropEndIndex);\n}\n"],"mappings":";AAiBO,SAAS,UAAa,KAAU,qBAAgD;AACrF,QAAM,eAAe,IAAI,UAAU,UAAQ,CAAC,oBAAoB,IAAI,CAAC;AACrE,SAAO,IAAI,MAAM,YAAY;AAC/B;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dropWhile
3
- } from "./chunk-3PFYAKOD.mjs";
3
+ } from "./chunk-S767XFOS.mjs";
4
4
 
5
5
  // src/array/dropRightWhile.ts
6
6
  function dropRightWhile(arr, canContinueDropping) {
@@ -12,4 +12,4 @@ function dropRightWhile(arr, canContinueDropping) {
12
12
  export {
13
13
  dropRightWhile
14
14
  };
15
- //# sourceMappingURL=chunk-6LDIBBWQ.mjs.map
15
+ //# sourceMappingURL=chunk-SGSQKXDO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/dropRightWhile.ts"],"sourcesContent":["import { dropWhile } from \"./dropWhile\";\n\n/**\n * Removes elements from the end of an array until the predicate returns false.\n * \n * This function iterates over an array from the end and drops elements until the provided \n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {function(item: T): boolean} canContinueDropping - A predicate function that determines \n * whether to continue dropping elements. The function is called with each element from the end, \n * and dropping continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRightWhile(array, x => x > 3);\n * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.\n */\nexport function dropRightWhile<T>(arr: T[], canContinueDropping: (item: T) => boolean) {\n const reversed = arr.slice().reverse();\n const dropped = dropWhile(reversed, canContinueDropping);\n return dropped.slice().reverse();\n}"],"mappings":";;;;;AAmBO,SAAS,eAAkB,KAAU,qBAA2C;AACrF,QAAM,WAAW,IAAI,MAAM,EAAE,QAAQ;AACrC,QAAM,UAAU,UAAU,UAAU,mBAAmB;AACvD,SAAO,QAAQ,MAAM,EAAE,QAAQ;AACjC;","names":[]}
@@ -10,4 +10,4 @@ function shuffle(arr) {
10
10
  export {
11
11
  shuffle
12
12
  };
13
- //# sourceMappingURL=chunk-23DC774L.mjs.map
13
+ //# sourceMappingURL=chunk-TOLR2FNF.mjs.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":";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":[]}
@@ -14,4 +14,4 @@ function groupBy(arr, getKeyFromItem) {
14
14
  export {
15
15
  groupBy
16
16
  };
17
- //# sourceMappingURL=chunk-V6LXSPMF.mjs.map
17
+ //# sourceMappingURL=chunk-UNX3KZO2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/groupBy.ts"],"sourcesContent":["/**\n * Groups the elements of an array based on a provided key-generating function.\n * \n * This function takes an array and a function that generates a key from each element. It returns \n * an object where the keys are the generated keys and the values are arrays of elements that share \n * the same key.\n *\n * @param {T[]} arr - The array to group.\n * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.\n * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that \n * share that key.\n *\n * @example\n * const array = [\n * { category: 'fruit', name: 'apple' },\n * { category: 'fruit', name: 'banana' },\n * { category: 'vegetable', name: 'carrot' }\n * ];\n * const result = groupBy(array, item => item.category);\n * // result will be:\n * // {\n * // fruit: [\n * // { category: 'fruit', name: 'apple' },\n * // { category: 'fruit', name: 'banana' }\n * // ],\n * // vegetable: [\n * // { category: 'vegetable', name: 'carrot' }\n * // ]\n * // }\n */\nexport function groupBy<T, K extends string>(arr: T[], getKeyFromItem: (item: T) => K): Record<K, T[]> {\n const result = {} as Record<K, T[]>;\n\n for (const item of arr) {\n const key = getKeyFromItem(item);\n\n if (result[key] == null) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":";AA8BO,SAAS,QAA6B,KAAU,gBAAgD;AACrG,QAAM,SAAS,CAAC;AAEhB,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,eAAe,IAAI;AAE/B,QAAI,OAAO,GAAG,KAAK,MAAM;AACvB,aAAO,GAAG,IAAI,CAAC;AAAA,IACjB;AAEA,WAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EACvB;AAEA,SAAO;AACT;","names":[]}
@@ -14,4 +14,4 @@ function omit(obj, keys) {
14
14
  export {
15
15
  omit
16
16
  };
17
- //# sourceMappingURL=chunk-J6SWM4X6.mjs.map
17
+ //# sourceMappingURL=chunk-UZP4YX7I.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/object/omit.ts"],"sourcesContent":["/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that \n * excludes the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n"],"mappings":";;;;;AAeO,SAAS,KAA2B,KAAQ,MAAuB;AACxE,QAAM,SAAS,mBAAK;AAEpB,aAAW,OAAO,MAAM;AACtB,WAAO,OAAO,GAAG;AAAA,EACnB;AAEA,SAAO;AACT;","names":[]}
@@ -6,4 +6,4 @@ function dropRight(arr, itemsCount) {
6
6
  export {
7
7
  dropRight
8
8
  };
9
- //# sourceMappingURL=chunk-6GRNTXI3.mjs.map
9
+ //# sourceMappingURL=chunk-VACGGQOL.mjs.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":";AAeO,SAAS,UAAa,KAAU,YAAyB;AAC9D,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
@@ -1,11 +1,11 @@
1
1
  // src/function/throttle.ts
2
2
  function throttle(func, throttleMs) {
3
3
  let lastCallTime;
4
- const throttledFunction = function(...args) {
4
+ const throttledFunction = function() {
5
5
  const now = Date.now();
6
6
  if (lastCallTime == null || now - lastCallTime >= throttleMs) {
7
7
  lastCallTime = now;
8
- func(...args);
8
+ func();
9
9
  }
10
10
  };
11
11
  return throttledFunction;
@@ -14,4 +14,4 @@ function throttle(func, throttleMs) {
14
14
  export {
15
15
  throttle
16
16
  };
17
- //# sourceMappingURL=chunk-XLO3QZVY.mjs.map
17
+ //# sourceMappingURL=chunk-VAKCSKGR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/function/throttle.ts"],"sourcesContent":["/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @param {() => void} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {() => void} A new throttled function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n * \n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n * \n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle(func: () => void, throttleMs: number) {\n let lastCallTime: number | null;\n\n const throttledFunction = function () {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func();\n }\n }\n\n return throttledFunction;\n}"],"mappings":";AAyBO,SAAS,SAAS,MAAkB,YAAoB;AAC7D,MAAI;AAEJ,QAAM,oBAAoB,WAAY;AACpC,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,gBAAgB,QAAQ,MAAM,gBAAgB,YAAY;AAC5D,qBAAe;AACf,WAAK;AAAA,IACP;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniqWith
3
- } from "./chunk-SQOYF647.mjs";
3
+ } from "./chunk-EAI4DDCQ.mjs";
4
4
 
5
5
  // src/array/unionWith.ts
6
6
  function unionWith(arr1, arr2, areItemsEqual) {
@@ -10,4 +10,4 @@ function unionWith(arr1, arr2, areItemsEqual) {
10
10
  export {
11
11
  unionWith
12
12
  };
13
- //# sourceMappingURL=chunk-YEZIGQJG.mjs.map
13
+ //# sourceMappingURL=chunk-VJGGYY4Y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/unionWith.ts"],"sourcesContent":["import { uniqWith } from \"./uniqWith\";\n\n/**\n * Creates an array of unique values from two given arrays based on a custom equality function.\n * \n * This function takes two arrays and a custom equality function, merges the arrays, and returns \n * a new array containing only the unique values as determined by the custom equality function.\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 * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal. \n * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array of unique values based on the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }];\n * const array2 = [{ id: 2 }, { id: 3 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = unionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays\n */\nexport function unionWith<T>(arr1: T[], arr2: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n return uniqWith(arr1.concat(arr2), areItemsEqual);\n}\n"],"mappings":";;;;;AAqBO,SAAS,UAAa,MAAW,MAAW,eAAqD;AACtG,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;","names":[]}
@@ -6,4 +6,4 @@ function isNil(x) {
6
6
  export {
7
7
  isNil
8
8
  };
9
- //# sourceMappingURL=chunk-KBJTBR5T.mjs.map
9
+ //# sourceMappingURL=chunk-WFQ3LAHQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/predicate/isNil.ts"],"sourcesContent":["/**\n * Checks if a given value is null or undefined.\n * \n * This function tests whether the provided value is either `null` or `undefined`. \n * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.\n * \n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.\n *\n * @param {unknown} x - The value to test for null or undefined.\n * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.\n *\n * @example\n * * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * const result1 = isNil(value1); // true\n * const result2 = isNil(value2); // true\n * const result3 = isNil(value3); // false\n */\nexport function isNil(x: unknown): x is null | undefined {\n return x === null || x === undefined;\n}"],"mappings":";AAmBO,SAAS,MAAM,GAAmC;AACvD,SAAO,MAAM,QAAQ,MAAM;AAC7B;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  unionWith
3
- } from "./chunk-YEZIGQJG.mjs";
3
+ } from "./chunk-VJGGYY4Y.mjs";
4
4
  import {
5
5
  intersectionWith
6
- } from "./chunk-7LAOIS6P.mjs";
6
+ } from "./chunk-GJM7F3TH.mjs";
7
7
  import {
8
8
  differenceWith
9
- } from "./chunk-M3SHJ3LL.mjs";
9
+ } from "./chunk-NSYWEYWT.mjs";
10
10
 
11
11
  // src/array/xorWith.ts
12
12
  function xorWith(arr1, arr2, areElementsEqual) {
@@ -18,4 +18,4 @@ function xorWith(arr1, arr2, areElementsEqual) {
18
18
  export {
19
19
  xorWith
20
20
  };
21
- //# sourceMappingURL=chunk-TCHT4HCP.mjs.map
21
+ //# sourceMappingURL=chunk-XS4ZPJMT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/xorWith.ts"],"sourcesContent":["import { differenceWith } from \"./differenceWith\";\nimport { intersectionWith } from \"./intersectionWith\";\nimport { unionWith } from \"./unionWith\";\n\n/**\n * Computes the symmetric difference between two arrays using a custom equality function. \n * The symmetric difference is the set of elements which are in either of the arrays, \n * but not in their intersection.\n *\n * @template T - Type of elements in the input arrays.\n * \n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function.\n * \n * @example\n * // Custom equality function for objects with an 'id' property\n * const areObjectsEqual = (a, b) => a.id === b.id;\n * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorWith<T>(arr1: T[], arr2: T[], areElementsEqual: (item1: T, item2: T) => boolean): T[] {\n const union = unionWith(arr1, arr2, areElementsEqual);\n const intersection = intersectionWith(arr1, arr2, areElementsEqual);\n \n return differenceWith(union, intersection, areElementsEqual);\n}\n"],"mappings":";;;;;;;;;;;AAsBO,SAAS,QAAW,MAAW,MAAW,kBAAwD;AACvG,QAAM,QAAQ,UAAU,MAAM,MAAM,gBAAgB;AACpD,QAAM,eAAe,iBAAiB,MAAM,MAAM,gBAAgB;AAElE,SAAO,eAAe,OAAO,cAAc,gBAAgB;AAC7D;","names":[]}
@@ -13,4 +13,4 @@ function pickBy(obj, shouldPick) {
13
13
  export {
14
14
  pickBy
15
15
  };
16
- //# sourceMappingURL=chunk-T2C2WVFL.mjs.map
16
+ //# sourceMappingURL=chunk-XW452I77.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/object/pickBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that \n * includes only the properties for which the predicate function returns true.\n *\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: string) => boolean} shouldPick - A predicate function that determines \n * whether a property should be picked. It takes the property's key and value as arguments and returns `true` \n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(obj: T, shouldPick: (value: T[keyof T], key: string) => boolean): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";AAkBO,SAAS,OAAsC,KAAQ,YAAqE;AACjI,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,CAAC,WAAW,OAAO,GAAG,GAAG;AAC3B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
@@ -6,4 +6,4 @@ function isNotNil(x) {
6
6
  export {
7
7
  isNotNil
8
8
  };
9
- //# sourceMappingURL=chunk-ZQNAZPSK.mjs.map
9
+ //# sourceMappingURL=chunk-YMNXRH52.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/predicate/isNotNil.ts"],"sourcesContent":["/**\n * Checks if the given value is not null nor undefined.\n * \n * The main use of this function is to be used with TypeScript as a type predicate.\n *\n * @param {T | null | undefined} x - The value to test if it is not null nor undefined.\n * @returns {x is T} True if the value is not null nor undefined, false otherwise.\n *\n * @example\n * // Here the type of `arr` is (number | undefined)[]\n * const arr = [1, undefined, 3];\n * // Here the type of `result` is number[]\n * const result = arr.filter(isNotNil);\n * // result will be [1, 3]\n */\nexport function isNotNil<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n"],"mappings":";AAeO,SAAS,SAAY,GAAiC;AAC3D,SAAO,MAAM,QAAQ,MAAM;AAC7B;","names":[]}
@@ -13,4 +13,4 @@ function omitBy(obj, shouldOmit) {
13
13
  export {
14
14
  omitBy
15
15
  };
16
- //# sourceMappingURL=chunk-SF3V7XXM.mjs.map
16
+ //# sourceMappingURL=chunk-Z4IO7EIH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/object/omitBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that \n * includes only the properties for which the predicate function returns false.\n *\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: string) => boolean} shouldOmit - A predicate function that determines \n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true` \n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(obj: T, shouldOmit: (value: T[keyof T], key: string) => boolean): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}"],"mappings":";AAkBO,SAAS,OAAsC,KAAQ,YAAqE;AACjI,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,WAAW,OAAO,GAAG,GAAG;AAC1B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}