es-toolkit 1.6.1 → 1.7.0-dev.146

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 (339) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/array/compact.d.mts +1 -0
  3. package/dist/array/compact.d.ts +1 -0
  4. package/dist/array/compact.js.map +1 -1
  5. package/dist/array/compact.mjs +1 -1
  6. package/dist/array/countBy.d.mts +20 -0
  7. package/dist/array/countBy.d.ts +20 -0
  8. package/dist/array/countBy.js +39 -0
  9. package/dist/array/countBy.js.map +1 -0
  10. package/dist/array/countBy.mjs +8 -0
  11. package/dist/array/drop.d.mts +1 -0
  12. package/dist/array/drop.d.ts +1 -0
  13. package/dist/array/drop.js.map +1 -1
  14. package/dist/array/drop.mjs +1 -1
  15. package/dist/array/dropRight.d.mts +1 -0
  16. package/dist/array/dropRight.d.ts +1 -0
  17. package/dist/array/dropRight.js.map +1 -1
  18. package/dist/array/dropRight.mjs +1 -1
  19. package/dist/array/dropRightWhile.d.mts +1 -0
  20. package/dist/array/dropRightWhile.d.ts +1 -0
  21. package/dist/array/dropRightWhile.js.map +1 -1
  22. package/dist/array/dropRightWhile.mjs +2 -2
  23. package/dist/array/dropWhile.d.mts +1 -0
  24. package/dist/array/dropWhile.d.ts +1 -0
  25. package/dist/array/dropWhile.js.map +1 -1
  26. package/dist/array/dropWhile.mjs +1 -1
  27. package/dist/array/fill.d.mts +29 -0
  28. package/dist/array/fill.d.ts +29 -0
  29. package/dist/array/fill.js +38 -0
  30. package/dist/array/fill.js.map +1 -0
  31. package/dist/array/fill.mjs +8 -0
  32. package/dist/array/forEachRight.d.mts +25 -0
  33. package/dist/array/forEachRight.d.ts +25 -0
  34. package/dist/array/forEachRight.js +36 -0
  35. package/dist/array/forEachRight.js.map +1 -0
  36. package/dist/array/forEachRight.mjs +8 -0
  37. package/dist/array/forEachRight.mjs.map +1 -0
  38. package/dist/array/groupBy.d.mts +3 -1
  39. package/dist/array/groupBy.d.ts +3 -1
  40. package/dist/array/groupBy.js.map +1 -1
  41. package/dist/array/groupBy.mjs +1 -1
  42. package/dist/array/index.d.mts +7 -1
  43. package/dist/array/index.d.ts +7 -1
  44. package/dist/array/index.js +103 -7
  45. package/dist/array/index.js.map +1 -1
  46. package/dist/array/index.mjs +78 -52
  47. package/dist/array/intersection.d.mts +1 -0
  48. package/dist/array/intersection.d.ts +1 -0
  49. package/dist/array/intersection.js.map +1 -1
  50. package/dist/array/intersection.mjs +1 -1
  51. package/dist/array/intersectionBy.d.mts +2 -0
  52. package/dist/array/intersectionBy.d.ts +2 -0
  53. package/dist/array/intersectionBy.js.map +1 -1
  54. package/dist/array/intersectionBy.mjs +1 -1
  55. package/dist/array/intersectionWith.d.mts +1 -0
  56. package/dist/array/intersectionWith.d.ts +1 -0
  57. package/dist/array/intersectionWith.js.map +1 -1
  58. package/dist/array/intersectionWith.mjs +1 -1
  59. package/dist/array/keyBy.d.mts +3 -1
  60. package/dist/array/keyBy.d.ts +3 -1
  61. package/dist/array/keyBy.js.map +1 -1
  62. package/dist/array/keyBy.mjs +1 -1
  63. package/dist/array/maxBy.d.mts +1 -0
  64. package/dist/array/maxBy.d.ts +1 -0
  65. package/dist/array/maxBy.js.map +1 -1
  66. package/dist/array/maxBy.mjs +1 -1
  67. package/dist/array/minBy.d.mts +1 -0
  68. package/dist/array/minBy.d.ts +1 -0
  69. package/dist/array/minBy.js.map +1 -1
  70. package/dist/array/minBy.mjs +1 -1
  71. package/dist/array/partition.d.mts +1 -0
  72. package/dist/array/partition.d.ts +1 -0
  73. package/dist/array/partition.js.map +1 -1
  74. package/dist/array/partition.mjs +1 -1
  75. package/dist/array/sample.d.mts +1 -0
  76. package/dist/array/sample.d.ts +1 -0
  77. package/dist/array/sample.js.map +1 -1
  78. package/dist/array/sample.mjs +1 -1
  79. package/dist/array/sampleSize.d.mts +21 -0
  80. package/dist/array/sampleSize.d.ts +21 -0
  81. package/dist/array/sampleSize.js +65 -0
  82. package/dist/array/sampleSize.js.map +1 -0
  83. package/dist/array/sampleSize.mjs +10 -0
  84. package/dist/array/sampleSize.mjs.map +1 -0
  85. package/dist/array/shuffle.d.mts +1 -0
  86. package/dist/array/shuffle.d.ts +1 -0
  87. package/dist/array/shuffle.js.map +1 -1
  88. package/dist/array/shuffle.mjs +1 -1
  89. package/dist/array/takeRight.d.mts +1 -0
  90. package/dist/array/takeRight.d.ts +1 -0
  91. package/dist/array/takeRight.js.map +1 -1
  92. package/dist/array/takeRight.mjs +1 -1
  93. package/dist/array/union.d.mts +1 -0
  94. package/dist/array/union.d.ts +1 -0
  95. package/dist/array/union.js.map +1 -1
  96. package/dist/array/union.mjs +2 -2
  97. package/dist/array/unionBy.d.mts +2 -0
  98. package/dist/array/unionBy.d.ts +2 -0
  99. package/dist/array/unionBy.js.map +1 -1
  100. package/dist/array/unionBy.mjs +1 -1
  101. package/dist/array/unionWith.d.mts +1 -0
  102. package/dist/array/unionWith.d.ts +1 -0
  103. package/dist/array/unionWith.js.map +1 -1
  104. package/dist/array/unionWith.mjs +2 -2
  105. package/dist/array/uniq.d.mts +1 -0
  106. package/dist/array/uniq.d.ts +1 -0
  107. package/dist/array/uniq.js.map +1 -1
  108. package/dist/array/uniq.mjs +1 -1
  109. package/dist/array/uniqBy.d.mts +2 -0
  110. package/dist/array/uniqBy.d.ts +2 -0
  111. package/dist/array/uniqBy.js.map +1 -1
  112. package/dist/array/uniqBy.mjs +1 -1
  113. package/dist/array/uniqWith.d.mts +1 -0
  114. package/dist/array/uniqWith.d.ts +1 -0
  115. package/dist/array/uniqWith.js.map +1 -1
  116. package/dist/array/uniqWith.mjs +1 -1
  117. package/dist/array/unzipWith.d.mts +17 -0
  118. package/dist/array/unzipWith.d.ts +17 -0
  119. package/dist/array/unzipWith.js +42 -0
  120. package/dist/array/unzipWith.js.map +1 -0
  121. package/dist/array/unzipWith.mjs +8 -0
  122. package/dist/array/unzipWith.mjs.map +1 -0
  123. package/dist/array/without.d.mts +23 -0
  124. package/dist/array/without.d.ts +23 -0
  125. package/dist/array/without.js +34 -0
  126. package/dist/array/without.js.map +1 -0
  127. package/dist/array/without.mjs +8 -0
  128. package/dist/array/without.mjs.map +1 -0
  129. package/dist/array/xor.d.mts +1 -0
  130. package/dist/array/xor.d.ts +1 -0
  131. package/dist/array/xor.js.map +1 -1
  132. package/dist/array/xor.mjs +4 -4
  133. package/dist/array/xorBy.js.map +1 -1
  134. package/dist/array/xorBy.mjs +3 -3
  135. package/dist/array/xorWith.js.map +1 -1
  136. package/dist/array/xorWith.mjs +4 -4
  137. package/dist/array/zipObject.d.mts +2 -0
  138. package/dist/array/zipObject.d.ts +2 -0
  139. package/dist/array/zipObject.js.map +1 -1
  140. package/dist/array/zipObject.mjs +1 -1
  141. package/dist/{chunk-2PFDLYQC.mjs → chunk-237HGSZS.mjs} +1 -1
  142. package/dist/chunk-237HGSZS.mjs.map +1 -0
  143. package/dist/{chunk-DOOIIHT3.mjs → chunk-2KNLZB7V.mjs} +1 -1
  144. package/dist/chunk-2KNLZB7V.mjs.map +1 -0
  145. package/dist/{chunk-OUTSP4VR.mjs → chunk-2ZCITDMK.mjs} +2 -2
  146. package/dist/chunk-2ZCITDMK.mjs.map +1 -0
  147. package/dist/{chunk-G42NUGNE.mjs → chunk-3IP4JVLL.mjs} +1 -1
  148. package/dist/chunk-3IP4JVLL.mjs.map +1 -0
  149. package/dist/{chunk-MQWVBKUT.mjs → chunk-6CLH5YZ2.mjs} +1 -1
  150. package/dist/chunk-6CLH5YZ2.mjs.map +1 -0
  151. package/dist/{chunk-DA7GSKQ5.mjs → chunk-6GWEY5EL.mjs} +1 -1
  152. package/dist/chunk-6GWEY5EL.mjs.map +1 -0
  153. package/dist/{chunk-ZOTAORG3.mjs → chunk-AJKZMN2V.mjs} +1 -1
  154. package/dist/chunk-AJKZMN2V.mjs.map +1 -0
  155. package/dist/{chunk-A67NF2C7.mjs → chunk-BCTYOXT7.mjs} +1 -1
  156. package/dist/chunk-BCTYOXT7.mjs.map +1 -0
  157. package/dist/{chunk-ZQNAZPSK.mjs → chunk-BMRTZMRE.mjs} +1 -1
  158. package/dist/chunk-BMRTZMRE.mjs.map +1 -0
  159. package/dist/chunk-C4WE4GLC.mjs +14 -0
  160. package/dist/chunk-C4WE4GLC.mjs.map +1 -0
  161. package/dist/{chunk-UFAA5WKR.mjs → chunk-CMBC4MXG.mjs} +1 -1
  162. package/dist/chunk-CMBC4MXG.mjs.map +1 -0
  163. package/dist/chunk-CRSKT4WW.mjs +15 -0
  164. package/dist/chunk-CRSKT4WW.mjs.map +1 -0
  165. package/dist/{chunk-5L2V7WD3.mjs → chunk-DN3NOZ3H.mjs} +1 -1
  166. package/dist/chunk-DN3NOZ3H.mjs.map +1 -0
  167. package/dist/{chunk-NKTBEEIT.mjs → chunk-DTJJIMKJ.mjs} +1 -1
  168. package/dist/chunk-DTJJIMKJ.mjs.map +1 -0
  169. package/dist/{chunk-XFCW7XJ4.mjs → chunk-DVK2N4KC.mjs} +1 -1
  170. package/dist/chunk-DVK2N4KC.mjs.map +1 -0
  171. package/dist/{chunk-VP2LXY75.mjs → chunk-DXB7EZUQ.mjs} +1 -1
  172. package/dist/chunk-DXB7EZUQ.mjs.map +1 -0
  173. package/dist/{chunk-LWXZFXY5.mjs → chunk-E6E4RZLN.mjs} +1 -1
  174. package/dist/chunk-E6E4RZLN.mjs.map +1 -0
  175. package/dist/chunk-EHSKB6DF.mjs +26 -0
  176. package/dist/chunk-EHSKB6DF.mjs.map +1 -0
  177. package/dist/{chunk-PYLGHB3F.mjs → chunk-FVVSE2F2.mjs} +1 -1
  178. package/dist/chunk-FVVSE2F2.mjs.map +1 -0
  179. package/dist/{chunk-DPLJQQFX.mjs → chunk-G7UQ5PUR.mjs} +1 -1
  180. package/dist/chunk-G7UQ5PUR.mjs.map +1 -0
  181. package/dist/{chunk-OFWKFUFZ.mjs → chunk-HPFDYUGP.mjs} +1 -1
  182. package/dist/chunk-HPFDYUGP.mjs.map +1 -0
  183. package/dist/chunk-IEA53J7P.mjs +12 -0
  184. package/dist/chunk-IEA53J7P.mjs.map +1 -0
  185. package/dist/chunk-IFNXROZR.mjs +18 -0
  186. package/dist/chunk-IFNXROZR.mjs.map +1 -0
  187. package/dist/{chunk-OIHARMNM.mjs → chunk-IJD7FE2Z.mjs} +1 -1
  188. package/dist/chunk-IJD7FE2Z.mjs.map +1 -0
  189. package/dist/{chunk-XDKEPIUV.mjs → chunk-IQLKIDXF.mjs} +1 -1
  190. package/dist/chunk-IQLKIDXF.mjs.map +1 -0
  191. package/dist/{chunk-GTVOVGGZ.mjs → chunk-JE6JKZU3.mjs} +2 -2
  192. package/dist/chunk-JE6JKZU3.mjs.map +1 -0
  193. package/dist/{chunk-Q75KEFW5.mjs → chunk-JEKUA56R.mjs} +1 -1
  194. package/dist/chunk-JEKUA56R.mjs.map +1 -0
  195. package/dist/{chunk-VKM3R5T5.mjs → chunk-L7FQX5MN.mjs} +3 -3
  196. package/dist/chunk-L7FQX5MN.mjs.map +1 -0
  197. package/dist/{chunk-K2BAFL2T.mjs → chunk-LJ2C6MVP.mjs} +1 -1
  198. package/dist/chunk-LJ2C6MVP.mjs.map +1 -0
  199. package/dist/{chunk-KHK7LKE5.mjs → chunk-LT6E4Y4Z.mjs} +1 -1
  200. package/dist/chunk-LT6E4Y4Z.mjs.map +1 -0
  201. package/dist/{chunk-NRNKP6JF.mjs → chunk-NFS7RWWE.mjs} +1 -1
  202. package/dist/chunk-NFS7RWWE.mjs.map +1 -0
  203. package/dist/{chunk-CDA4NK7J.mjs → chunk-O64NE2P4.mjs} +2 -2
  204. package/dist/{chunk-GNSJP2AB.mjs → chunk-O6UXZR3U.mjs} +1 -1
  205. package/dist/chunk-O6UXZR3U.mjs.map +1 -0
  206. package/dist/{chunk-FXOABQRO.mjs → chunk-OOKNBU4V.mjs} +1 -1
  207. package/dist/chunk-OOKNBU4V.mjs.map +1 -0
  208. package/dist/{chunk-WPDDOUQT.mjs → chunk-OXAZEEGP.mjs} +1 -1
  209. package/dist/chunk-OXAZEEGP.mjs.map +1 -0
  210. package/dist/chunk-PYEYV7BY.mjs +10 -0
  211. package/dist/chunk-PYEYV7BY.mjs.map +1 -0
  212. package/dist/{chunk-E54CCWDL.mjs → chunk-Q47NGNXT.mjs} +3 -3
  213. package/dist/{chunk-OEOAJOLQ.mjs → chunk-QOJGMVVR.mjs} +1 -1
  214. package/dist/chunk-QOJGMVVR.mjs.map +1 -0
  215. package/dist/{chunk-JSS4FXUD.mjs → chunk-QRSJBBFY.mjs} +3 -3
  216. package/dist/{chunk-PLTO44KM.mjs → chunk-QZITBKWX.mjs} +1 -1
  217. package/dist/chunk-QZITBKWX.mjs.map +1 -0
  218. package/dist/{chunk-UPJXHWSJ.mjs → chunk-R6QA7PLZ.mjs} +2 -2
  219. package/dist/chunk-R6QA7PLZ.mjs.map +1 -0
  220. package/dist/{chunk-ACFP3XMB.mjs → chunk-S3CORED5.mjs} +1 -1
  221. package/dist/chunk-S3CORED5.mjs.map +1 -0
  222. package/dist/chunk-SDIMTYZW.mjs +14 -0
  223. package/dist/chunk-SDIMTYZW.mjs.map +1 -0
  224. package/dist/chunk-TZE6EDCX.mjs +1 -0
  225. package/dist/chunk-TZE6EDCX.mjs.map +1 -0
  226. package/dist/{chunk-2EFS3VA3.mjs → chunk-XI7KRD2C.mjs} +1 -1
  227. package/dist/chunk-XI7KRD2C.mjs.map +1 -0
  228. package/dist/chunk-XJR5WV2Z.mjs +1 -0
  229. package/dist/chunk-XJR5WV2Z.mjs.map +1 -0
  230. package/dist/error/AbortError.d.mts +4 -0
  231. package/dist/error/AbortError.d.ts +4 -0
  232. package/dist/error/AbortError.js.map +1 -1
  233. package/dist/error/AbortError.mjs +1 -1
  234. package/dist/error/index.js.map +1 -1
  235. package/dist/error/index.mjs +1 -1
  236. package/dist/function/debounce.d.mts +1 -0
  237. package/dist/function/debounce.d.ts +1 -0
  238. package/dist/function/debounce.js.map +1 -1
  239. package/dist/function/debounce.mjs +1 -1
  240. package/dist/function/index.js.map +1 -1
  241. package/dist/function/index.mjs +7 -7
  242. package/dist/function/once.d.mts +1 -0
  243. package/dist/function/once.d.ts +1 -0
  244. package/dist/function/once.js.map +1 -1
  245. package/dist/function/once.mjs +1 -1
  246. package/dist/function/throttle.d.mts +1 -0
  247. package/dist/function/throttle.d.ts +1 -0
  248. package/dist/function/throttle.js.map +1 -1
  249. package/dist/function/throttle.mjs +1 -1
  250. package/dist/index.d.mts +8 -1
  251. package/dist/index.d.ts +8 -1
  252. package/dist/index.js +109 -22
  253. package/dist/index.js.map +1 -1
  254. package/dist/index.mjs +119 -91
  255. package/dist/math/index.d.mts +1 -0
  256. package/dist/math/index.d.ts +1 -0
  257. package/dist/math/index.js +8 -0
  258. package/dist/math/index.js.map +1 -1
  259. package/dist/math/index.mjs +15 -11
  260. package/dist/math/mean.d.mts +1 -1
  261. package/dist/math/mean.d.ts +1 -1
  262. package/dist/math/mean.js.map +1 -1
  263. package/dist/math/mean.mjs +1 -1
  264. package/dist/math/meanBy.d.mts +18 -0
  265. package/dist/math/meanBy.d.ts +18 -0
  266. package/dist/math/meanBy.js +50 -0
  267. package/dist/math/meanBy.js.map +1 -0
  268. package/dist/math/meanBy.mjs +10 -0
  269. package/dist/math/meanBy.mjs.map +1 -0
  270. package/dist/object/index.js.map +1 -1
  271. package/dist/object/index.mjs +6 -6
  272. package/dist/object/omit.d.mts +2 -0
  273. package/dist/object/omit.d.ts +2 -0
  274. package/dist/object/omit.js.map +1 -1
  275. package/dist/object/omit.mjs +1 -1
  276. package/dist/object/omitBy.d.mts +1 -0
  277. package/dist/object/omitBy.d.ts +1 -0
  278. package/dist/object/omitBy.js.map +1 -1
  279. package/dist/object/omitBy.mjs +1 -1
  280. package/dist/object/pick.d.mts +2 -0
  281. package/dist/object/pick.d.ts +2 -0
  282. package/dist/object/pick.js.map +1 -1
  283. package/dist/object/pick.mjs +1 -1
  284. package/dist/object/pickBy.d.mts +1 -0
  285. package/dist/object/pickBy.d.ts +1 -0
  286. package/dist/object/pickBy.js.map +1 -1
  287. package/dist/object/pickBy.mjs +1 -1
  288. package/dist/predicate/index.js.map +1 -1
  289. package/dist/predicate/index.mjs +1 -1
  290. package/dist/predicate/isNotNil.d.mts +1 -0
  291. package/dist/predicate/isNotNil.d.ts +1 -0
  292. package/dist/predicate/isNotNil.js.map +1 -1
  293. package/dist/predicate/isNotNil.mjs +1 -1
  294. package/dist/promise/delay.js.map +1 -1
  295. package/dist/promise/delay.mjs +2 -2
  296. package/dist/promise/index.js.map +1 -1
  297. package/dist/promise/index.mjs +2 -2
  298. package/package.json +9 -1
  299. package/dist/chunk-2EFS3VA3.mjs.map +0 -1
  300. package/dist/chunk-2PFDLYQC.mjs.map +0 -1
  301. package/dist/chunk-5L2V7WD3.mjs.map +0 -1
  302. package/dist/chunk-A67NF2C7.mjs.map +0 -1
  303. package/dist/chunk-ACFP3XMB.mjs.map +0 -1
  304. package/dist/chunk-DA7GSKQ5.mjs.map +0 -1
  305. package/dist/chunk-DOOIIHT3.mjs.map +0 -1
  306. package/dist/chunk-DPLJQQFX.mjs.map +0 -1
  307. package/dist/chunk-FXOABQRO.mjs.map +0 -1
  308. package/dist/chunk-G42NUGNE.mjs.map +0 -1
  309. package/dist/chunk-GNSJP2AB.mjs.map +0 -1
  310. package/dist/chunk-GTVOVGGZ.mjs.map +0 -1
  311. package/dist/chunk-K2BAFL2T.mjs.map +0 -1
  312. package/dist/chunk-KHK7LKE5.mjs.map +0 -1
  313. package/dist/chunk-LWXZFXY5.mjs.map +0 -1
  314. package/dist/chunk-MQWVBKUT.mjs.map +0 -1
  315. package/dist/chunk-NKTBEEIT.mjs.map +0 -1
  316. package/dist/chunk-NRNKP6JF.mjs.map +0 -1
  317. package/dist/chunk-OEOAJOLQ.mjs.map +0 -1
  318. package/dist/chunk-OFWKFUFZ.mjs.map +0 -1
  319. package/dist/chunk-OIHARMNM.mjs.map +0 -1
  320. package/dist/chunk-OUTSP4VR.mjs.map +0 -1
  321. package/dist/chunk-PLTO44KM.mjs.map +0 -1
  322. package/dist/chunk-PYLGHB3F.mjs.map +0 -1
  323. package/dist/chunk-Q75KEFW5.mjs.map +0 -1
  324. package/dist/chunk-QVHWSUEH.mjs +0 -1
  325. package/dist/chunk-UFAA5WKR.mjs.map +0 -1
  326. package/dist/chunk-UPJXHWSJ.mjs.map +0 -1
  327. package/dist/chunk-V6MDTRGS.mjs +0 -1
  328. package/dist/chunk-VKM3R5T5.mjs.map +0 -1
  329. package/dist/chunk-VP2LXY75.mjs.map +0 -1
  330. package/dist/chunk-WPDDOUQT.mjs.map +0 -1
  331. package/dist/chunk-XDKEPIUV.mjs.map +0 -1
  332. package/dist/chunk-XFCW7XJ4.mjs.map +0 -1
  333. package/dist/chunk-ZOTAORG3.mjs.map +0 -1
  334. package/dist/chunk-ZQNAZPSK.mjs.map +0 -1
  335. /package/dist/{chunk-QVHWSUEH.mjs.map → array/countBy.mjs.map} +0 -0
  336. /package/dist/{chunk-V6MDTRGS.mjs.map → array/fill.mjs.map} +0 -0
  337. /package/dist/{chunk-CDA4NK7J.mjs.map → chunk-O64NE2P4.mjs.map} +0 -0
  338. /package/dist/{chunk-E54CCWDL.mjs.map → chunk-Q47NGNXT.mjs.map} +0 -0
  339. /package/dist/{chunk-JSS4FXUD.mjs.map → chunk-QRSJBBFY.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/xorBy.ts","../../src/array/differenceBy.ts","../../src/array/intersectionBy.ts","../../src/array/unionBy.ts"],"sourcesContent":["import { differenceBy } from './differenceBy.ts';\nimport { intersectionBy } from './intersectionBy.ts';\nimport { unionBy } from './unionBy.ts';\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 {(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: readonly T[], arr2: readonly 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","/**\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: readonly T[], secondArr: readonly T[], mapper: (value: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));\n\n return firstArr.filter(item => {\n return !mappedSecondSet.has(mapper(item));\n });\n}\n","/**\n * Returns the intersection of two arrays based on a mapping function.\n *\n * This function takes two arrays and a mapping function. It returns a new array containing\n * the elements from the first array that, when mapped using the provided function, have matching\n * mapped elements in the second array. It effectively filters out any elements from the first array\n * that do not have corresponding mapped values in the second array.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = intersectionBy(array1, array2, mapper);\n * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.\n */\nexport function intersectionBy<T, U>(firstArr: readonly T[], secondArr: readonly T[], mapper: (item: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(mapper));\n return firstArr.filter(item => mappedSecondSet.has(mapper(item)));\n}\n","/**\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 {(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: readonly T[], arr2: readonly 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\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyBO,SAAS,aAAmB,UAAwB,WAAyB,QAA8B;AAChH,QAAM,kBAAkB,IAAI,IAAI,UAAU,IAAI,UAAQ,OAAO,IAAI,CAAC,CAAC;AAEnE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,gBAAgB,IAAI,OAAO,IAAI,CAAC;AAAA,EAC1C,CAAC;AACH;;;ACXO,SAAS,eAAqB,UAAwB,WAAyB,QAA6B;AACjH,QAAM,kBAAkB,IAAI,IAAI,UAAU,IAAI,MAAM,CAAC;AACrD,SAAO,SAAS,OAAO,UAAQ,gBAAgB,IAAI,OAAO,IAAI,CAAC,CAAC;AAClE;;;ACHO,SAAS,QAAc,MAAoB,MAAoB,QAA6B;AACjG,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACrC,UAAM,MAAM,OAAO,IAAI;AAEvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI,OAAO,CAAC;AAChC;;;AHTO,SAAS,MAAY,MAAoB,MAAoB,QAA6B;AAC/F,QAAM,QAAQ,QAAQ,MAAM,MAAM,MAAM;AACxC,QAAM,eAAe,eAAe,MAAM,MAAM,MAAM;AAEtD,SAAO,aAAa,OAAO,cAAc,MAAM;AACjD;","names":[]}
1
+ {"version":3,"sources":["../../src/array/xorBy.ts","../../src/array/differenceBy.ts","../../src/array/intersectionBy.ts","../../src/array/unionBy.ts"],"sourcesContent":["import { differenceBy } from './differenceBy.ts';\nimport { intersectionBy } from './intersectionBy.ts';\nimport { unionBy } from './unionBy.ts';\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 {(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: readonly T[], arr2: readonly 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","/**\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: readonly T[], secondArr: readonly T[], mapper: (value: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));\n\n return firstArr.filter(item => {\n return !mappedSecondSet.has(mapper(item));\n });\n}\n","/**\n * Returns the intersection of two arrays based on a mapping function.\n *\n * This function takes two arrays and a mapping function. It returns a new array containing\n * the elements from the first array that, when mapped using the provided function, have matching\n * mapped elements in the second array. It effectively filters out any elements from the first array\n * that do not have corresponding mapped values in the second array.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = intersectionBy(array1, array2, mapper);\n * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.\n */\nexport function intersectionBy<T, U>(firstArr: readonly T[], secondArr: readonly T[], mapper: (item: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(mapper));\n return firstArr.filter(item => mappedSecondSet.has(mapper(item)));\n}\n","/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(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: readonly T[], arr2: readonly 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\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyBO,SAAS,aAAmB,UAAwB,WAAyB,QAA8B;AAChH,QAAM,kBAAkB,IAAI,IAAI,UAAU,IAAI,UAAQ,OAAO,IAAI,CAAC,CAAC;AAEnE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,gBAAgB,IAAI,OAAO,IAAI,CAAC;AAAA,EAC1C,CAAC;AACH;;;ACTO,SAAS,eAAqB,UAAwB,WAAyB,QAA6B;AACjH,QAAM,kBAAkB,IAAI,IAAI,UAAU,IAAI,MAAM,CAAC;AACrD,SAAO,SAAS,OAAO,UAAQ,gBAAgB,IAAI,OAAO,IAAI,CAAC,CAAC;AAClE;;;ACHO,SAAS,QAAc,MAAoB,MAAoB,QAA6B;AACjG,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACrC,UAAM,MAAM,OAAO,IAAI;AAEvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI,OAAO,CAAC;AAChC;;;AHXO,SAAS,MAAY,MAAoB,MAAoB,QAA6B;AAC/F,QAAM,QAAQ,QAAQ,MAAM,MAAM,MAAM;AACxC,QAAM,eAAe,eAAe,MAAM,MAAM,MAAM;AAEtD,SAAO,aAAa,OAAO,cAAc,MAAM;AACjD;","names":[]}
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  xorBy
3
- } from "../chunk-E54CCWDL.mjs";
4
- import "../chunk-NRNKP6JF.mjs";
5
- import "../chunk-GNSJP2AB.mjs";
3
+ } from "../chunk-Q47NGNXT.mjs";
4
+ import "../chunk-NFS7RWWE.mjs";
5
+ import "../chunk-O6UXZR3U.mjs";
6
6
  import "../chunk-LVWX5B43.mjs";
7
7
  import "../chunk-2MM5EJJX.mjs";
8
8
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/xorWith.ts","../../src/array/differenceWith.ts","../../src/array/intersectionWith.ts","../../src/array/uniqWith.ts","../../src/array/unionWith.ts"],"sourcesContent":["import { differenceWith } from './differenceWith.ts';\nimport { intersectionWith } from './intersectionWith.ts';\nimport { unionWith } from './unionWith.ts';\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>(\n arr1: readonly T[],\n arr2: readonly T[],\n areElementsEqual: (item1: T, item2: T) => boolean\n): T[] {\n const union = unionWith(arr1, arr2, areElementsEqual);\n const intersection = intersectionWith(arr1, arr2, areElementsEqual);\n\n return differenceWith(union, intersection, areElementsEqual);\n}\n","/**\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>(\n firstArr: readonly T[],\n secondArr: readonly T[],\n areItemsEqual: (x: T, y: T) => boolean\n): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\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>(\n firstArr: readonly T[],\n secondArr: readonly T[],\n areItemsEqual: (x: T, y: T) => boolean\n): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the comparator function.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\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.2, 5.7, 7.19]\n * ```\n */\nexport function uniqWith<T>(arr: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n","import { uniqWith } from './uniqWith.ts';\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>(\n arr1: readonly T[],\n arr2: readonly T[],\n areItemsEqual: (item1: T, item2: T) => boolean\n): T[] {\n return uniqWith(arr1.concat(arr2), areItemsEqual);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqBO,SAAS,eACd,UACA,WACA,eACK;AACL,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;;;ACVO,SAAS,iBACd,UACA,WACA,eACK;AACL,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;;;ACjBO,SAAS,SAAY,KAAmB,eAAqD;AAClG,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;;;ACLO,SAAS,UACd,MACA,MACA,eACK;AACL,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;;;AJLO,SAAS,QACd,MACA,MACA,kBACK;AACL,QAAM,QAAQ,UAAU,MAAM,MAAM,gBAAgB;AACpD,QAAM,eAAe,iBAAiB,MAAM,MAAM,gBAAgB;AAElE,SAAO,eAAe,OAAO,cAAc,gBAAgB;AAC7D;","names":[]}
1
+ {"version":3,"sources":["../../src/array/xorWith.ts","../../src/array/differenceWith.ts","../../src/array/intersectionWith.ts","../../src/array/uniqWith.ts","../../src/array/unionWith.ts"],"sourcesContent":["import { differenceWith } from './differenceWith.ts';\nimport { intersectionWith } from './intersectionWith.ts';\nimport { unionWith } from './unionWith.ts';\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>(\n arr1: readonly T[],\n arr2: readonly T[],\n areElementsEqual: (item1: T, item2: T) => boolean\n): T[] {\n const union = unionWith(arr1, arr2, areElementsEqual);\n const intersection = intersectionWith(arr1, arr2, areElementsEqual);\n\n return differenceWith(union, intersection, areElementsEqual);\n}\n","/**\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>(\n firstArr: readonly T[],\n secondArr: readonly T[],\n areItemsEqual: (x: T, y: T) => boolean\n): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\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 * @template T - The type of elements in the array.\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>(\n firstArr: readonly T[],\n secondArr: readonly T[],\n areItemsEqual: (x: T, y: T) => boolean\n): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the comparator function.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\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.2, 5.7, 7.19]\n * ```\n */\nexport function uniqWith<T>(arr: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n","import { uniqWith } from './uniqWith.ts';\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 * @template T - The type of elements in the array.\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>(\n arr1: readonly T[],\n arr2: readonly T[],\n areItemsEqual: (item1: T, item2: T) => boolean\n): T[] {\n return uniqWith(arr1.concat(arr2), areItemsEqual);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqBO,SAAS,eACd,UACA,WACA,eACK;AACL,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;;;ACTO,SAAS,iBACd,UACA,WACA,eACK;AACL,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;;;ACjBO,SAAS,SAAY,KAAmB,eAAqD;AAClG,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;;;ACLO,SAAS,UACd,MACA,MACA,eACK;AACL,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;;;AJNO,SAAS,QACd,MACA,MACA,kBACK;AACL,QAAM,QAAQ,UAAU,MAAM,MAAM,gBAAgB;AACpD,QAAM,eAAe,iBAAiB,MAAM,MAAM,gBAAgB;AAElE,SAAO,eAAe,OAAO,cAAc,gBAAgB;AAC7D;","names":[]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  xorWith
3
- } from "../chunk-JSS4FXUD.mjs";
4
- import "../chunk-OUTSP4VR.mjs";
5
- import "../chunk-2PFDLYQC.mjs";
6
- import "../chunk-2EFS3VA3.mjs";
3
+ } from "../chunk-QRSJBBFY.mjs";
4
+ import "../chunk-2ZCITDMK.mjs";
5
+ import "../chunk-237HGSZS.mjs";
6
+ import "../chunk-XI7KRD2C.mjs";
7
7
  import "../chunk-6NVQAHXP.mjs";
8
8
  import "../chunk-2MM5EJJX.mjs";
9
9
  export {
@@ -6,6 +6,8 @@
6
6
  * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will
7
7
  * have `undefined` as their values.
8
8
  *
9
+ * @template P - The type of elements in the array.
10
+ * @template V - The type of elements in the array.
9
11
  * @param {P[]} keys - An array of property names.
10
12
  * @param {V[]} values - An array of values corresponding to the property names.
11
13
  * @returns {{ [K in P]: V }} A new object composed of the given property names and values.
@@ -6,6 +6,8 @@
6
6
  * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will
7
7
  * have `undefined` as their values.
8
8
  *
9
+ * @template P - The type of elements in the array.
10
+ * @template V - The type of elements in the array.
9
11
  * @param {P[]} keys - An array of property names.
10
12
  * @param {V[]} values - An array of values corresponding to the property names.
11
13
  * @returns {{ [K in P]: V }} A new object composed of the given property names and values.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/zipObject.ts"],"sourcesContent":["/**\n * Combines two arrays, one of property names and one of corresponding values, into a single object.\n *\n * This function takes two arrays: one containing property names and another containing corresponding values.\n * It returns a new object where the property names from the first array are keys, and the corresponding elements\n * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will\n * have `undefined` as their values.\n *\n * @param {P[]} keys - An array of property names.\n * @param {V[]} values - An array of values corresponding to the property names.\n * @returns {{ [K in P]: V }} A new object composed of the given property names and values.\n *\n * @example\n * const keys = ['a', 'b', 'c'];\n * const values = [1, 2, 3];\n * const result = zipObject(keys, values);\n * // result will be { a: 1, b: 2, c: 3 }\n *\n * const keys2 = ['a', 'b', 'c'];\n * const values2 = [1, 2];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2, c: undefined }\n *\n * const keys2 = ['a', 'b'];\n * const values2 = [1, 2, 3];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2 }\n */\nexport function zipObject<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n\n for (let i = 0; i < keys.length; i++) {\n result[keys[i]] = values[i];\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BO,SAAS,UAAiD,MAAW,QAA8B;AACxG,QAAM,SAAS,CAAC;AAEhB,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAO,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC;AAAA,EAC5B;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/array/zipObject.ts"],"sourcesContent":["/**\n * Combines two arrays, one of property names and one of corresponding values, into a single object.\n *\n * This function takes two arrays: one containing property names and another containing corresponding values.\n * It returns a new object where the property names from the first array are keys, and the corresponding elements\n * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will\n * have `undefined` as their values.\n *\n * @template P - The type of elements in the array.\n * @template V - The type of elements in the array.\n * @param {P[]} keys - An array of property names.\n * @param {V[]} values - An array of values corresponding to the property names.\n * @returns {{ [K in P]: V }} A new object composed of the given property names and values.\n *\n * @example\n * const keys = ['a', 'b', 'c'];\n * const values = [1, 2, 3];\n * const result = zipObject(keys, values);\n * // result will be { a: 1, b: 2, c: 3 }\n *\n * const keys2 = ['a', 'b', 'c'];\n * const values2 = [1, 2];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2, c: undefined }\n *\n * const keys2 = ['a', 'b'];\n * const values2 = [1, 2, 3];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2 }\n */\nexport function zipObject<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n\n for (let i = 0; i < keys.length; i++) {\n result[keys[i]] = values[i];\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,SAAS,UAAiD,MAAW,QAA8B;AACxG,QAAM,SAAS,CAAC;AAEhB,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAO,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC;AAAA,EAC5B;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  zipObject
3
- } from "../chunk-DA7GSKQ5.mjs";
3
+ } from "../chunk-6GWEY5EL.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  zipObject
@@ -13,4 +13,4 @@ function uniqWith(arr, areItemsEqual) {
13
13
  export {
14
14
  uniqWith
15
15
  };
16
- //# sourceMappingURL=chunk-2PFDLYQC.mjs.map
16
+ //# sourceMappingURL=chunk-237HGSZS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/uniqWith.ts"],"sourcesContent":["/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the comparator function.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\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.2, 5.7, 7.19]\n * ```\n */\nexport function uniqWith<T>(arr: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";AAeO,SAAS,SAAY,KAAmB,eAAqD;AAClG,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -7,4 +7,4 @@ function sample(arr) {
7
7
  export {
8
8
  sample
9
9
  };
10
- //# sourceMappingURL=chunk-DOOIIHT3.mjs.map
10
+ //# sourceMappingURL=chunk-2KNLZB7V.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 * @template T - The type of elements in the array.\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: readonly T[]): T {\n const randomIndex = Math.floor(Math.random() * arr.length);\n return arr[randomIndex];\n}\n"],"mappings":";AAcO,SAAS,OAAU,KAAsB;AAC9C,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-2PFDLYQC.mjs";
3
+ } from "./chunk-237HGSZS.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-OUTSP4VR.mjs.map
13
+ //# sourceMappingURL=chunk-2ZCITDMK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/unionWith.ts"],"sourcesContent":["import { uniqWith } from './uniqWith.ts';\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 * @template T - The type of elements in the array.\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>(\n arr1: readonly T[],\n arr2: readonly T[],\n areItemsEqual: (item1: T, item2: T) => boolean\n): T[] {\n return uniqWith(arr1.concat(arr2), areItemsEqual);\n}\n"],"mappings":";;;;;AAsBO,SAAS,UACd,MACA,MACA,eACK;AACL,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;","names":[]}
@@ -29,4 +29,4 @@ function debounce(func, debounceMs, { signal } = {}) {
29
29
  export {
30
30
  debounce
31
31
  };
32
- //# sourceMappingURL=chunk-G42NUGNE.mjs.map
32
+ //# sourceMappingURL=chunk-3IP4JVLL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/function/debounce.ts"],"sourcesContent":["interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\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 * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { 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 *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: number | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) as any;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n"],"mappings":";AAuCO,SAAS,SACd,MACA,YACA,EAAE,OAAO,IAAqB,CAAC,GACH;AAC5B,MAAI,YAA2B;AAE/B,QAAM,YAAY,YAAa,MAAqB;AAClD,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AAAA,IACxB;AAEA,QAAI,iCAAQ,SAAS;AACnB;AAAA,IACF;AAEA,gBAAY,WAAW,MAAM;AAC3B,WAAK,GAAG,IAAI;AACZ,kBAAY;AAAA,IACd,GAAG,UAAU;AAAA,EACf;AAEA,QAAM,UAAU,WAAY;AAC1B,cAAU,OAAO;AAAA,EACnB;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,mCAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK;AAExD,SAAO;AACT;","names":[]}
@@ -13,4 +13,4 @@ function pickBy(obj, shouldPick) {
13
13
  export {
14
14
  pickBy
15
15
  };
16
- //# sourceMappingURL=chunk-MQWVBKUT.mjs.map
16
+ //# sourceMappingURL=chunk-6CLH5YZ2.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 * @template T - The type of object.\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => 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>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): 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":";AAmBO,SAAS,OACd,KACA,YACY;AACZ,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":[]}
@@ -10,4 +10,4 @@ function zipObject(keys, values) {
10
10
  export {
11
11
  zipObject
12
12
  };
13
- //# sourceMappingURL=chunk-DA7GSKQ5.mjs.map
13
+ //# sourceMappingURL=chunk-6GWEY5EL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/zipObject.ts"],"sourcesContent":["/**\n * Combines two arrays, one of property names and one of corresponding values, into a single object.\n *\n * This function takes two arrays: one containing property names and another containing corresponding values.\n * It returns a new object where the property names from the first array are keys, and the corresponding elements\n * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will\n * have `undefined` as their values.\n *\n * @template P - The type of elements in the array.\n * @template V - The type of elements in the array.\n * @param {P[]} keys - An array of property names.\n * @param {V[]} values - An array of values corresponding to the property names.\n * @returns {{ [K in P]: V }} A new object composed of the given property names and values.\n *\n * @example\n * const keys = ['a', 'b', 'c'];\n * const values = [1, 2, 3];\n * const result = zipObject(keys, values);\n * // result will be { a: 1, b: 2, c: 3 }\n *\n * const keys2 = ['a', 'b', 'c'];\n * const values2 = [1, 2];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2, c: undefined }\n *\n * const keys2 = ['a', 'b'];\n * const values2 = [1, 2, 3];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2 }\n */\nexport function zipObject<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n\n for (let i = 0; i < keys.length; i++) {\n result[keys[i]] = values[i];\n }\n\n return result;\n}\n"],"mappings":";AA8BO,SAAS,UAAiD,MAAW,QAA8B;AACxG,QAAM,SAAS,CAAC;AAEhB,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAO,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC;AAAA,EAC5B;AAEA,SAAO;AACT;","names":[]}
@@ -11,4 +11,4 @@ function keyBy(arr, getKeyFromItem) {
11
11
  export {
12
12
  keyBy
13
13
  };
14
- //# sourceMappingURL=chunk-ZOTAORG3.mjs.map
14
+ //# sourceMappingURL=chunk-AJKZMN2V.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/keyBy.ts"],"sourcesContent":["/**\n * Maps each element 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 the corresponding elements.\n * If there are multiple elements generating the same key, the last element among them is used\n * as the value.\n *\n * @template T - The type of elements in the array.\n * @template K - The type of keys.\n * @param {T[]} arr - The array of elements to be mapped.\n * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.\n * @returns {Record<K, T>} An object where keys are mapped to each element of an array.\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 = keyBy(array, item => item.category);\n * // result will be:\n * // {\n * // fruit: { category: 'fruit', name: 'banana' },\n * // vegetable: { category: 'vegetable', name: 'carrot' }\n * // }\n */\nexport function keyBy<T, K extends PropertyKey>(arr: readonly 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 result[key] = item;\n }\n\n return result;\n}\n"],"mappings":";AA2BO,SAAS,MAAgC,KAAmB,gBAA8C;AAC/G,QAAM,SAAS,CAAC;AAEhB,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,eAAe,IAAI;AAC/B,WAAO,GAAG,IAAI;AAAA,EAChB;AAEA,SAAO;AACT;","names":[]}
@@ -13,4 +13,4 @@ function omitBy(obj, shouldOmit) {
13
13
  export {
14
14
  omitBy
15
15
  };
16
- //# sourceMappingURL=chunk-A67NF2C7.mjs.map
16
+ //# sourceMappingURL=chunk-BCTYOXT7.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 * @template T - The type of object.\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";AAmBO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,WAAW,OAAO,GAAG,GAAG;AAC1B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
@@ -6,4 +6,4 @@ function isNotNil(x) {
6
6
  export {
7
7
  isNotNil
8
8
  };
9
- //# sourceMappingURL=chunk-ZQNAZPSK.mjs.map
9
+ //# sourceMappingURL=chunk-BMRTZMRE.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 * @template T - The type of value.\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":";AAgBO,SAAS,SAAY,GAAiC;AAC3D,SAAO,MAAM,QAAQ,MAAM;AAC7B;","names":[]}
@@ -0,0 +1,14 @@
1
+ // src/array/fill.ts
2
+ function fill(arr, value, start = 0, end = arr.length) {
3
+ start = Math.max(start, 0);
4
+ end = Math.min(end, arr.length);
5
+ for (let i = start; i < end; i++) {
6
+ arr[i] = value;
7
+ }
8
+ return arr;
9
+ }
10
+
11
+ export {
12
+ fill
13
+ };
14
+ //# sourceMappingURL=chunk-C4WE4GLC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/fill.ts"],"sourcesContent":["/**\n * Fills elements of an array with a specified value from the start position up to, but not including, the end position.\n *\n * This function mutates the original array and replaces its elements with the provided value, starting from the specified\n * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the\n * entire array. Negative indices can be used to specify positions from the end of the array.\n *\n * @param {Array<T | P>} arr - The array to fill.\n * @param {P} value - The value to fill the array with.\n * @param {number} [start=0] - The start position. Defaults to 0.\n * @param {number} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | P>} The array with the filled values.\n *\n * @example\n * const array = [1, 2, 3];\n * const result = fill(array, 'a');\n * // => ['a', 'a', 'a']\n *\n * const result = fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * const result = fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\n\nexport function fill<T>(arr: unknown[], value: T): T[];\nexport function fill<T, P>(arr: Array<T | P>, value: P, start: number): Array<T | P>;\nexport function fill<T, P>(arr: Array<T | P>, value: P, start: number, end: number): Array<T | P>;\nexport function fill<T, P>(arr: Array<T | P>, value: P, start = 0, end = arr.length): Array<T | P> {\n start = Math.max(start, 0);\n end = Math.min(end, arr.length);\n\n for (let i = start; i < end; i++) {\n arr[i] = value;\n }\n\n return arr;\n}\n"],"mappings":";AA4BO,SAAS,KAAW,KAAmB,OAAU,QAAQ,GAAG,MAAM,IAAI,QAAsB;AACjG,UAAQ,KAAK,IAAI,OAAO,CAAC;AACzB,QAAM,KAAK,IAAI,KAAK,IAAI,MAAM;AAE9B,WAAS,IAAI,OAAO,IAAI,KAAK,KAAK;AAChC,QAAI,CAAC,IAAI;AAAA,EACX;AAEA,SAAO;AACT;","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-CMBC4MXG.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 * @template F - The type of function.\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":";AAiBO,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":[]}
@@ -0,0 +1,15 @@
1
+ // src/array/countBy.ts
2
+ function countBy(arr, mapper) {
3
+ var _a;
4
+ const result = {};
5
+ for (const item of arr) {
6
+ const key = mapper(item);
7
+ result[key] = ((_a = result[key]) != null ? _a : 0) + 1;
8
+ }
9
+ return result;
10
+ }
11
+
12
+ export {
13
+ countBy
14
+ };
15
+ //# sourceMappingURL=chunk-CRSKT4WW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/countBy.ts"],"sourcesContent":["/**\n * Count the occurrences of each item in an array\n * based on a transformation function.\n *\n * This function takes an array and a transformation function\n * that converts each item in the array to a string. It then\n * counts the occurrences of each transformed item and returns\n * an object with the transformed items as keys and the counts\n * as values.\n *\n * @template T - The type of the items in the input array.\n *\n * @param {T[]} arr - The input array to count occurrences.\n * @param {(item: T) => string} mapper - The transformation function that maps each item to a string key.\n * @returns {Record<string, number>} An object containing the transformed items as keys and the\n * counts as values.\n */\nexport function countBy<T>(arr: T[], mapper: (item: T) => string): Record<string, number> {\n const result: Record<string, number> = {};\n \n for (const item of arr) {\n const key = mapper(item);\n \n result[key] = (result[key] ?? 0) + 1;\n }\n \n return result;\n}\n"],"mappings":";AAiBO,SAAS,QAAW,KAAU,QAAqD;AAjB1F;AAkBE,QAAM,SAAiC,CAAC;AAExC,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,OAAO,IAAI;AAEvB,WAAO,GAAG,MAAK,YAAO,GAAG,MAAV,YAAe,KAAK;AAAA,EACrC;AAEA,SAAO;AACT;","names":[]}
@@ -15,4 +15,4 @@ function partition(arr, isInTruthy) {
15
15
  export {
16
16
  partition
17
17
  };
18
- //# sourceMappingURL=chunk-5L2V7WD3.mjs.map
18
+ //# sourceMappingURL=chunk-DN3NOZ3H.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 * @template T - The type of elements in the array.\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: readonly 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":";AAsBO,SAAS,UAAa,KAAmB,YAA8D;AAC5G,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":[]}
@@ -12,4 +12,4 @@ function compact(arr) {
12
12
  export {
13
13
  compact
14
14
  };
15
- //# sourceMappingURL=chunk-NKTBEEIT.mjs.map
15
+ //# sourceMappingURL=chunk-DTJJIMKJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/compact.ts"],"sourcesContent":["type NotFalsey<T> = Exclude<T, false | null | 0 | '' | undefined>;\n\n/**\n * Removes falsey values (false, null, 0, '', undefined, NaN) from an array.\n *\n * @template T - The type of elements in the array.\n * @param {readonly T[]} arr - The input array to remove falsey values.\n * @returns {Array<Exclude<T, false | null | 0 | '' | undefined>>} - A new array with all falsey values removed.\n *\n * @example\n * compact([0, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);\n * Returns: [1, 2, 3, 4, 5]\n */\nexport function compact<T>(arr: readonly T[]): Array<NotFalsey<T>> {\n const result: Array<NotFalsey<T>> = [];\n\n for (const item of arr) {\n if (item) {\n result.push(item as NotFalsey<T>);\n }\n }\n\n return result;\n}\n"],"mappings":";AAaO,SAAS,QAAW,KAAwC;AACjE,QAAM,SAA8B,CAAC;AAErC,aAAW,QAAQ,KAAK;AACtB,QAAI,MAAM;AACR,aAAO,KAAK,IAAoB;AAAA,IAClC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -6,4 +6,4 @@ function uniq(arr) {
6
6
  export {
7
7
  uniq
8
8
  };
9
- //# sourceMappingURL=chunk-XFCW7XJ4.mjs.map
9
+ //# sourceMappingURL=chunk-DVK2N4KC.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 * @template T - The type of elements in the array.\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: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n"],"mappings":";AAeO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;","names":[]}
@@ -9,4 +9,4 @@ var AbortError = class extends Error {
9
9
  export {
10
10
  AbortError
11
11
  };
12
- //# sourceMappingURL=chunk-VP2LXY75.mjs.map
12
+ //# sourceMappingURL=chunk-DXB7EZUQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/error/AbortError.ts"],"sourcesContent":["/**\n * An error class representing an aborted operation.\n * @augments Error\n */\nexport class AbortError extends Error {\n constructor(message = 'The operation was aborted') {\n super(message);\n this.name = 'AbortError';\n }\n}\n"],"mappings":";AAIO,IAAM,aAAN,cAAyB,MAAM;AAAA,EACpC,YAAY,UAAU,6BAA6B;AACjD,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
@@ -14,4 +14,4 @@ function groupBy(arr, getKeyFromItem) {
14
14
  export {
15
15
  groupBy
16
16
  };
17
- //# sourceMappingURL=chunk-LWXZFXY5.mjs.map
17
+ //# sourceMappingURL=chunk-E6E4RZLN.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 * @template T - The type of elements in the array.\n * @template K - The type of keys.\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 PropertyKey>(arr: readonly 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":";AAgCO,SAAS,QAAkC,KAAmB,gBAAgD;AACnH,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":[]}
@@ -0,0 +1,26 @@
1
+ import {
2
+ randomInt
3
+ } from "./chunk-GIWAOOFY.mjs";
4
+
5
+ // src/array/sampleSize.ts
6
+ function sampleSize(array, size) {
7
+ if (size > array.length) {
8
+ throw new Error("Size must be less than or equal to the length of array.");
9
+ }
10
+ const result = new Array(size);
11
+ const selected = /* @__PURE__ */ new Set();
12
+ for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {
13
+ let index = randomInt(0, step + 1);
14
+ if (selected.has(index)) {
15
+ index = step;
16
+ }
17
+ selected.add(index);
18
+ result[resultIndex] = array[index];
19
+ }
20
+ return result;
21
+ }
22
+
23
+ export {
24
+ sampleSize
25
+ };
26
+ //# sourceMappingURL=chunk-EHSKB6DF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/sampleSize.ts"],"sourcesContent":["import { randomInt } from '../math/randomInt.ts';\n\n/**\n * Returns a sample element array of a specified `size`.\n *\n * This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm.\n *\n * {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algoritm}\n *\n * @template T - The type of elements in the array.\n * @param {T[]} array - The array to sample from.\n * @param {number} size - The size of sample.\n * @returns {T[]} A new array with sample size applied.\n * @throws {Error} Throws an error if `size` is greater than the length of `array`.\n *\n * @example\n * const result = sampleSize([1, 2, 3], 2)\n * // result will be an array containing two of the elements from the array.\n * // [1, 2] or [1, 3] or [2, 3]\n */\nexport function sampleSize<T>(array: readonly T[], size: number): T[] {\n if (size > array.length) {\n throw new Error('Size must be less than or equal to the length of array.');\n }\n\n const result = new Array(size);\n const selected = new Set();\n\n for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {\n let index = randomInt(0, step + 1);\n\n if (selected.has(index)) {\n index = step;\n }\n\n selected.add(index);\n\n result[resultIndex] = array[index];\n }\n\n return result;\n}\n"],"mappings":";;;;;AAoBO,SAAS,WAAc,OAAqB,MAAmB;AACpE,MAAI,OAAO,MAAM,QAAQ;AACvB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAEA,QAAM,SAAS,IAAI,MAAM,IAAI;AAC7B,QAAM,WAAW,oBAAI,IAAI;AAEzB,WAAS,OAAO,MAAM,SAAS,MAAM,cAAc,GAAG,OAAO,MAAM,QAAQ,QAAQ,eAAe;AAChG,QAAI,QAAQ,UAAU,GAAG,OAAO,CAAC;AAEjC,QAAI,SAAS,IAAI,KAAK,GAAG;AACvB,cAAQ;AAAA,IACV;AAEA,aAAS,IAAI,KAAK;AAElB,WAAO,WAAW,IAAI,MAAM,KAAK;AAAA,EACnC;AAEA,SAAO;AACT;","names":[]}
@@ -9,4 +9,4 @@ function intersection(firstArr, secondArr) {
9
9
  export {
10
10
  intersection
11
11
  };
12
- //# sourceMappingURL=chunk-PYLGHB3F.mjs.map
12
+ //# sourceMappingURL=chunk-FVVSE2F2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/intersection.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements that are\n * present in both arrays. It effectively filters out any elements from the first array that\n * are not found in the second array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @returns {T[]} A new array containing the elements that are present in both arrays.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [3, 4, 5, 6, 7];\n * const result = intersection(array1, array2);\n * // result will be [3, 4, 5] since these elements are in both arrays.\n */\nexport function intersection<T>(firstArr: readonly T[], secondArr: readonly T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => {\n return secondSet.has(item);\n });\n}\n"],"mappings":";AAkBO,SAAS,aAAgB,UAAwB,WAA8B;AACpF,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,UAAU,IAAI,IAAI;AAAA,EAC3B,CAAC;AACH;","names":[]}
@@ -11,4 +11,4 @@ function shuffle(arr) {
11
11
  export {
12
12
  shuffle
13
13
  };
14
- //# sourceMappingURL=chunk-DPLJQQFX.mjs.map
14
+ //# sourceMappingURL=chunk-G7UQ5PUR.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 * @template T - The type of elements in the array.\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: readonly T[]): T[] {\n const result = arr.slice();\n\n /**\n * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n for (let i = result.length - 1; i >= 1; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":";AAcO,SAAS,QAAW,KAAwB;AACjD,QAAM,SAAS,IAAI,MAAM;AAKzB,WAAS,IAAI,OAAO,SAAS,GAAG,KAAK,GAAG,KAAK;AAC3C,UAAM,IAAI,KAAK,MAAM,KAAK,OAAO,KAAK,IAAI,EAAE;AAC5C,KAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAAA,EAChD;AAEA,SAAO;AACT;","names":[]}
@@ -10,4 +10,4 @@ function pick(obj, keys) {
10
10
  export {
11
11
  pick
12
12
  };
13
- //# sourceMappingURL=chunk-OFWKFUFZ.mjs.map
13
+ //# sourceMappingURL=chunk-HPFDYUGP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/object/pick.ts"],"sourcesContent":["/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n"],"mappings":";AAiBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,CAAC;AAEhB,aAAW,OAAO,MAAM;AACtB,WAAO,GAAG,IAAI,IAAI,GAAG;AAAA,EACvB;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,12 @@
1
+ // src/array/forEachRight.ts
2
+ function forEachRight(arr, callback) {
3
+ for (let i = arr.length - 1; i >= 0; i--) {
4
+ const element = arr[i];
5
+ callback(element, i, arr);
6
+ }
7
+ }
8
+
9
+ export {
10
+ forEachRight
11
+ };
12
+ //# sourceMappingURL=chunk-IEA53J7P.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/forEachRight.ts"],"sourcesContent":["/**\n * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element.\n * \n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to iterate over.\n * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration.\n * The callback function receives three arguments:\n * - 'value': The current element being processed in the array.\n * - 'index': The index of the current element being processed in the array.\n * - 'arr': The array 'forEachRight' was called upon.\n * \n * @example\n * const array = [1, 2, 3];\n * const result: number[] = [];\n * \n * // Use the forEachRight function to iterate through the array and add each element to the result array.\n * forEachRight(array, (value) => {\n * result.push(value);\n * })\n * \n * console.log(result) // Output: [3, 2, 1]\n */\n\nexport function forEachRight<T>(arr: T[], callback: (value: T, index: number, arr: T[]) => void): void {\n for (let i = arr.length - 1; i >= 0; i--) {\n const element = arr[i];\n callback(element, i, arr);\n }\n}\n"],"mappings":";AAuBO,SAAS,aAAgB,KAAU,UAA6D;AACrG,WAAS,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK;AACxC,UAAM,UAAU,IAAI,CAAC;AACrB,aAAS,SAAS,GAAG,GAAG;AAAA,EAC1B;AACF;","names":[]}
@@ -0,0 +1,18 @@
1
+ // src/array/unzipWith.ts
2
+ function unzipWith(target, iteratee) {
3
+ const maxLength = Math.max(...target.map((innerArray) => innerArray.length));
4
+ const result = new Array(maxLength);
5
+ for (let i = 0; i < maxLength; i++) {
6
+ const group = new Array(target.length);
7
+ for (let j = 0; j < target.length; j++) {
8
+ group[j] = target[j][i];
9
+ }
10
+ result[i] = iteratee(...group);
11
+ }
12
+ return result;
13
+ }
14
+
15
+ export {
16
+ unzipWith
17
+ };
18
+ //# sourceMappingURL=chunk-IFNXROZR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/unzipWith.ts"],"sourcesContent":["/**\n * Unzips an array of arrays, applying an `iteratee` function to regrouped elements.\n *\n * @template T, R\n * @param {T[][]} target - The nested array to unzip. This is an array of arrays,\n * where each inner array contains elements to be unzipped.\n * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.\n * @returns {R[]} A new array of unzipped and transformed elements. \n *\n * @example\n * const nestedArray = [[1, 2], [3, 4], [5, 6]];\n * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);\n * // result will be [9, 12]\n */\nexport function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[] {\n const maxLength = Math.max(...target.map(innerArray => innerArray.length));\n const result: R[] = new Array(maxLength);\n\n for (let i = 0; i < maxLength; i++) {\n const group = new Array(target.length);\n\n for (let j = 0; j < target.length; j++) {\n group[j] = target[j][i];\n }\n\n result[i] = iteratee(...group);\n }\n\n return result;\n}\n"],"mappings":";AAcO,SAAS,UAAgB,QAAwB,UAAoC;AAC1F,QAAM,YAAY,KAAK,IAAI,GAAG,OAAO,IAAI,gBAAc,WAAW,MAAM,CAAC;AACzE,QAAM,SAAc,IAAI,MAAM,SAAS;AAEvC,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK;AAClC,UAAM,QAAQ,IAAI,MAAM,OAAO,MAAM;AAErC,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,YAAM,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC;AAAA,IACxB;AAEA,WAAO,CAAC,IAAI,SAAS,GAAG,KAAK;AAAA,EAC/B;AAEA,SAAO;AACT;","names":[]}
@@ -15,4 +15,4 @@ function minBy(items, getValue) {
15
15
  export {
16
16
  minBy
17
17
  };
18
- //# sourceMappingURL=chunk-OIHARMNM.mjs.map
18
+ //# sourceMappingURL=chunk-IJD7FE2Z.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/minBy.ts"],"sourcesContent":["/**\n * Finds the element in an array that has the minimum value when applying\n * the `getValue` function to each element.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {T} The element with the minimum value as determined by the `getValue` function.\n * @example\n * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 }\n * minBy([], x => x.a); // Returns: undefined\n */\nexport function minBy<T>(items: T[], getValue: (element: T) => number): T {\n let minElement = items[0];\n let min = Infinity;\n\n for (const element of items) {\n const value = getValue(element);\n if (value < min) {\n min = value;\n minElement = element;\n }\n }\n\n return minElement;\n}\n"],"mappings":";AAYO,SAAS,MAAS,OAAY,UAAqC;AACxE,MAAI,aAAa,MAAM,CAAC;AACxB,MAAI,MAAM;AAEV,aAAW,WAAW,OAAO;AAC3B,UAAM,QAAQ,SAAS,OAAO;AAC9B,QAAI,QAAQ,KAAK;AACf,YAAM;AACN,mBAAa;AAAA,IACf;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -9,4 +9,4 @@ function takeRight(arr, count) {
9
9
  export {
10
10
  takeRight
11
11
  };
12
- //# sourceMappingURL=chunk-XDKEPIUV.mjs.map
12
+ //# sourceMappingURL=chunk-IQLKIDXF.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 * @template T - The type of elements in the array.\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: readonly T[], count: number): T[] {\n if (count === 0) {\n return [];\n }\n\n return arr.slice(-count);\n}\n"],"mappings":";AAqBO,SAAS,UAAa,KAAmB,OAAoB;AAClE,MAAI,UAAU,GAAG;AACf,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,CAAC,KAAK;AACzB;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dropWhile
3
- } from "./chunk-K2BAFL2T.mjs";
3
+ } from "./chunk-LJ2C6MVP.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-GTVOVGGZ.mjs.map
15
+ //# sourceMappingURL=chunk-JE6JKZU3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/dropRightWhile.ts"],"sourcesContent":["import { dropWhile } from './dropWhile.ts';\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 * @template T - The type of elements in the array.\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 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: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const reversed = arr.slice().reverse();\n const dropped = dropWhile(reversed, canContinueDropping);\n return dropped.slice().reverse();\n}\n"],"mappings":";;;;;AAoBO,SAAS,eAAkB,KAAmB,qBAAgD;AACnG,QAAM,WAAW,IAAI,MAAM,EAAE,QAAQ;AACrC,QAAM,UAAU,UAAU,UAAU,mBAAmB;AACvD,SAAO,QAAQ,MAAM,EAAE,QAAQ;AACjC;","names":[]}
@@ -6,4 +6,4 @@ function dropRight(arr, itemsCount) {
6
6
  export {
7
7
  dropRight
8
8
  };
9
- //# sourceMappingURL=chunk-Q75KEFW5.mjs.map
9
+ //# sourceMappingURL=chunk-JEKUA56R.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 * @template T - The type of elements in the array.\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: readonly T[], itemsCount: number): T[] {\n return arr.slice(0, -itemsCount);\n}\n"],"mappings":";AAgBO,SAAS,UAAa,KAAmB,YAAyB;AACvE,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}