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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/array/sampleSize.ts","../../src/math/random.ts","../../src/math/randomInt.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","/**\n * Generate a random number within the given range.\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result1 = random(0, 5); // Returns a random number between 0 and 5.\n * const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown\n * const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.\n */\nexport function random(maximum: number): number;\nexport function random(minimum: number, maximum: number): number;\nexport function random(minimum: number, maximum?: number): number {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n","import { random } from './random.ts';\n\n/**\n * Generates a random integer between minimum (inclusive) and maximum (exclusive).\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)\n * const result2 = randomInt(5, 0); // This will throw an error\n */\nexport function randomInt(maximum: number): number;\nexport function randomInt(minimum: number, maximum: number): number;\nexport function randomInt(minimum: number, maximum?: number): number {\n return Math.floor(random(minimum, maximum!));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,OAAO,SAAiB,SAA0B;AAChE,MAAI,WAAW,MAAM;AACnB,cAAU;AACV,cAAU;AAAA,EACZ;AAEA,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AAEA,SAAO,KAAK,OAAO,KAAK,UAAU,WAAW;AAC/C;;;ACVO,SAAS,UAAU,SAAiB,SAA0B;AACnE,SAAO,KAAK,MAAM,OAAO,SAAS,OAAQ,CAAC;AAC7C;;;AFAO,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":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ sampleSize
3
+ } from "../chunk-EHSKB6DF.mjs";
4
+ import "../chunk-GIWAOOFY.mjs";
5
+ import "../chunk-SYWMYQYJ.mjs";
6
+ import "../chunk-2MM5EJJX.mjs";
7
+ export {
8
+ sampleSize
9
+ };
10
+ //# sourceMappingURL=sampleSize.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * This function takes an array and returns a new array with its elements shuffled in a random order.
5
5
  *
6
+ * @template T - The type of elements in the array.
6
7
  * @param {T[]} arr - The array to shuffle.
7
8
  * @returns {T[]} A new array with its elements shuffled in random order.
8
9
  *
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * This function takes an array and returns a new array with its elements shuffled in a random order.
5
5
  *
6
+ * @template T - The type of elements in the array.
6
7
  * @param {T[]} arr - The array to shuffle.
7
8
  * @returns {T[]} A new array with its elements shuffled in random order.
8
9
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/shuffle.ts"],"sourcesContent":["/**\n * Randomizes the order of elements in an array using the Fisher-Yates algorithm.\n *\n * This function takes an array and returns a new array with its elements shuffled in a random order.\n *\n * @param {T[]} arr - The array to shuffle.\n * @returns {T[]} A new array with its elements shuffled in random order.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const shuffledArray = shuffle(array);\n * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]\n */\nexport function shuffle<T>(arr: 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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,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":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  shuffle
3
- } from "../chunk-DPLJQQFX.mjs";
3
+ } from "../chunk-G7UQ5PUR.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  shuffle
@@ -2,6 +2,7 @@
2
2
  * Returns a new array containing the last `count` elements from the input array `arr`.
3
3
  * If `count` is greater than the length of `arr`, the entire array is returned.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} arr - The array to take elements from.
6
7
  * @param {number} count - The number of elements to take.
7
8
  * @returns {T[]} A new array containing the last `count` elements from `arr`.
@@ -2,6 +2,7 @@
2
2
  * Returns a new array containing the last `count` elements from the input array `arr`.
3
3
  * If `count` is greater than the length of `arr`, the entire array is returned.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} arr - The array to take elements from.
6
7
  * @param {number} count - The number of elements to take.
7
8
  * @returns {T[]} A new array containing the last `count` elements from `arr`.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/takeRight.ts"],"sourcesContent":["/**\n * Returns a new array containing the last `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {number} count - The number of elements to take.\n * @returns {T[]} A new array containing the last `count` elements from `arr`.\n *\n * @example\n * // Returns [4, 5]\n * takeRight([1, 2, 3, 4, 5], 2);\n *\n * @example\n * // Returns ['b', 'c']\n * takeRight(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * takeRight([1, 2, 3], 5);\n */\nexport function takeRight<T>(arr: readonly T[], count: number): T[] {\n if (count === 0) {\n return [];\n }\n\n return arr.slice(-count);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,SAAS,UAAa,KAAmB,OAAoB;AAClE,MAAI,UAAU,GAAG;AACf,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,CAAC,KAAK;AACzB;","names":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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
  takeRight
3
- } from "../chunk-XDKEPIUV.mjs";
3
+ } from "../chunk-IQLKIDXF.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  takeRight
@@ -4,6 +4,7 @@
4
4
  * This function takes two arrays, merges them into a single array, and returns a new array
5
5
  * containing only the unique values from the merged array.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr1 - The first array to merge and filter for unique values.
8
9
  * @param {T[]} arr2 - The second array to merge and filter for unique values.
9
10
  * @returns {T[]} A new array of unique values.
@@ -4,6 +4,7 @@
4
4
  * This function takes two arrays, merges them into a single array, and returns a new array
5
5
  * containing only the unique values from the merged array.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr1 - The first array to merge and filter for unique values.
8
9
  * @param {T[]} arr2 - The second array to merge and filter for unique values.
9
10
  * @returns {T[]} A new array of unique values.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/union.ts","../../src/array/uniq.ts"],"sourcesContent":["import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;;;ADEO,SAAS,MAAS,MAAoB,MAAyB;AACpE,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/array/union.ts","../../src/array/uniq.ts"],"sourcesContent":["import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @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 * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;;;ADEO,SAAS,MAAS,MAAoB,MAAyB;AACpE,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  union
3
- } from "../chunk-UPJXHWSJ.mjs";
4
- import "../chunk-XFCW7XJ4.mjs";
3
+ } from "../chunk-R6QA7PLZ.mjs";
4
+ import "../chunk-DVK2N4KC.mjs";
5
5
  import "../chunk-2MM5EJJX.mjs";
6
6
  export {
7
7
  union
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.
3
3
  *
4
+ * @template T - The type of elements in the array.
5
+ * @template U - The type of mapped elements.
4
6
  * @param {T[]} arr1 - The first array.
5
7
  * @param {T[]} arr2 - The second array.
6
8
  * @param {(item: T) => U} mapper - The function to map array elements to comparison values.
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.
3
3
  *
4
+ * @template T - The type of elements in the array.
5
+ * @template U - The type of mapped elements.
4
6
  * @param {T[]} arr1 - The first array.
5
7
  * @param {T[]} arr2 - The second array.
6
8
  * @param {(item: T) => U} mapper - The function to map array elements to comparison values.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/unionBy.ts"],"sourcesContent":["/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(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;AAoBO,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;","names":[]}
1
+ {"version":3,"sources":["../../src/array/unionBy.ts"],"sourcesContent":["/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @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;AAsBO,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;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unionBy
3
- } from "../chunk-NRNKP6JF.mjs";
3
+ } from "../chunk-NFS7RWWE.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  unionBy
@@ -4,6 +4,7 @@
4
4
  * This function takes two arrays and a custom equality function, merges the arrays, and returns
5
5
  * a new array containing only the unique values as determined by the custom equality function.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr1 - The first array to merge and filter for unique values.
8
9
  * @param {T[]} arr2 - The second array to merge and filter for unique values.
9
10
  * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
@@ -4,6 +4,7 @@
4
4
  * This function takes two arrays and a custom equality function, merges the arrays, and returns
5
5
  * a new array containing only the unique values as determined by the custom equality function.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr1 - The first array to merge and filter for unique values.
8
9
  * @param {T[]} arr2 - The second array to merge and filter for unique values.
9
10
  * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/unionWith.ts","../../src/array/uniqWith.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 * @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","/**\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,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;;;ADLO,SAAS,UACd,MACA,MACA,eACK;AACL,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;","names":[]}
1
+ {"version":3,"sources":["../../src/array/unionWith.ts","../../src/array/uniqWith.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","/**\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,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;;;ADLO,SAAS,UACd,MACA,MACA,eACK;AACL,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unionWith
3
- } from "../chunk-OUTSP4VR.mjs";
4
- import "../chunk-2PFDLYQC.mjs";
3
+ } from "../chunk-2ZCITDMK.mjs";
4
+ import "../chunk-237HGSZS.mjs";
5
5
  import "../chunk-2MM5EJJX.mjs";
6
6
  export {
7
7
  unionWith
@@ -4,6 +4,7 @@
4
4
  * This function takes an array and returns a new array containing only the unique values
5
5
  * from the original array, preserving the order of first occurrence.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array to process.
8
9
  * @returns {T[]} A new array with only unique values from the original array.
9
10
  *
@@ -4,6 +4,7 @@
4
4
  * This function takes an array and returns a new array containing only the unique values
5
5
  * from the original array, preserving the order of first occurrence.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array to process.
8
9
  * @returns {T[]} A new array with only unique values from the original array.
9
10
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/uniq.ts"],"sourcesContent":["/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;","names":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniq
3
- } from "../chunk-XFCW7XJ4.mjs";
3
+ } from "../chunk-DVK2N4KC.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  uniq
@@ -2,6 +2,8 @@
2
2
  * Returns a new array containing only the unique elements from the original array,
3
3
  * based on the values returned by the mapper function.
4
4
  *
5
+ * @template T - The type of elements in the array.
6
+ * @template U - The type of mapped elements.
5
7
  * @param {T[]} arr - The array to process.
6
8
  * @param {(item: T) => U} mapper - The function used to convert the array elements.
7
9
  * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.
@@ -2,6 +2,8 @@
2
2
  * Returns a new array containing only the unique elements from the original array,
3
3
  * based on the values returned by the mapper function.
4
4
  *
5
+ * @template T - The type of elements in the array.
6
+ * @template U - The type of mapped elements.
5
7
  * @param {T[]} arr - The array to process.
6
8
  * @param {(item: T) => U} mapper - The function used to convert the array elements.
7
9
  * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/uniqBy.ts"],"sourcesContent":["/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert 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 mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of arr) {\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;AAcO,SAAS,OAAa,KAAmB,QAA6B;AAC3E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,KAAK;AACtB,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;","names":[]}
1
+ {"version":3,"sources":["../../src/array/uniqBy.ts"],"sourcesContent":["/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert 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 mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of arr) {\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;AAgBO,SAAS,OAAa,KAAmB,QAA6B;AAC3E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,KAAK;AACtB,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;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniqBy
3
- } from "../chunk-WPDDOUQT.mjs";
3
+ } from "../chunk-OXAZEEGP.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  uniqBy
@@ -2,6 +2,7 @@
2
2
  * Returns a new array containing only the unique elements from the original array,
3
3
  * based on the values returned by the comparator function.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} arr - The array to process.
6
7
  * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.
7
8
  * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.
@@ -2,6 +2,7 @@
2
2
  * Returns a new array containing only the unique elements from the original array,
3
3
  * based on the values returned by the comparator function.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} arr - The array to process.
6
7
  * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.
7
8
  * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.
@@ -1 +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 * @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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,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":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniqWith
3
- } from "../chunk-2PFDLYQC.mjs";
3
+ } from "../chunk-237HGSZS.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  uniqWith
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
3
+ *
4
+ * @template T, R
5
+ * @param {T[][]} target - The nested array to unzip. This is an array of arrays,
6
+ * where each inner array contains elements to be unzipped.
7
+ * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.
8
+ * @returns {R[]} A new array of unzipped and transformed elements.
9
+ *
10
+ * @example
11
+ * const nestedArray = [[1, 2], [3, 4], [5, 6]];
12
+ * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);
13
+ * // result will be [9, 12]
14
+ */
15
+ declare function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[];
16
+
17
+ export { unzipWith };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
3
+ *
4
+ * @template T, R
5
+ * @param {T[][]} target - The nested array to unzip. This is an array of arrays,
6
+ * where each inner array contains elements to be unzipped.
7
+ * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.
8
+ * @returns {R[]} A new array of unzipped and transformed elements.
9
+ *
10
+ * @example
11
+ * const nestedArray = [[1, 2], [3, 4], [5, 6]];
12
+ * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);
13
+ * // result will be [9, 12]
14
+ */
15
+ declare function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[];
16
+
17
+ export { unzipWith };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/array/unzipWith.ts
21
+ var unzipWith_exports = {};
22
+ __export(unzipWith_exports, {
23
+ unzipWith: () => unzipWith
24
+ });
25
+ module.exports = __toCommonJS(unzipWith_exports);
26
+ function unzipWith(target, iteratee) {
27
+ const maxLength = Math.max(...target.map((innerArray) => innerArray.length));
28
+ const result = new Array(maxLength);
29
+ for (let i = 0; i < maxLength; i++) {
30
+ const group = new Array(target.length);
31
+ for (let j = 0; j < target.length; j++) {
32
+ group[j] = target[j][i];
33
+ }
34
+ result[i] = iteratee(...group);
35
+ }
36
+ return result;
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ unzipWith
41
+ });
42
+ //# sourceMappingURL=unzipWith.js.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ unzipWith
3
+ } from "../chunk-IFNXROZR.mjs";
4
+ import "../chunk-2MM5EJJX.mjs";
5
+ export {
6
+ unzipWith
7
+ };
8
+ //# sourceMappingURL=unzipWith.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates an array that excludes all specified values.
3
+ *
4
+ * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
5
+ *
6
+ * @template T The type of elements in the array.
7
+ * @param {T[]} array - The array to filter.
8
+ * @param {...T[]} values - The values to exclude.
9
+ * @returns {T[]} A new array without the specified values.
10
+ *
11
+ * @example
12
+ * // Removes the specified values from the array
13
+ * without([1, 2, 3, 4, 5], 2, 4);
14
+ * // Returns: [1, 3, 5]
15
+ *
16
+ * @example
17
+ * // Removes specified string values from the array
18
+ * without(['a', 'b', 'c', 'a'], 'a');
19
+ * // Returns: ['b', 'c']
20
+ */
21
+ declare function without<T>(array: readonly T[], ...values: T[]): T[];
22
+
23
+ export { without };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates an array that excludes all specified values.
3
+ *
4
+ * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
5
+ *
6
+ * @template T The type of elements in the array.
7
+ * @param {T[]} array - The array to filter.
8
+ * @param {...T[]} values - The values to exclude.
9
+ * @returns {T[]} A new array without the specified values.
10
+ *
11
+ * @example
12
+ * // Removes the specified values from the array
13
+ * without([1, 2, 3, 4, 5], 2, 4);
14
+ * // Returns: [1, 3, 5]
15
+ *
16
+ * @example
17
+ * // Removes specified string values from the array
18
+ * without(['a', 'b', 'c', 'a'], 'a');
19
+ * // Returns: ['b', 'c']
20
+ */
21
+ declare function without<T>(array: readonly T[], ...values: T[]): T[];
22
+
23
+ export { without };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/array/without.ts
21
+ var without_exports = {};
22
+ __export(without_exports, {
23
+ without: () => without
24
+ });
25
+ module.exports = __toCommonJS(without_exports);
26
+ function without(array, ...values) {
27
+ const valuesSet = new Set(values);
28
+ return array.filter((item) => !valuesSet.has(item));
29
+ }
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ without
33
+ });
34
+ //# sourceMappingURL=without.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/array/without.ts"],"sourcesContent":["/**\n * Creates an array that excludes all specified values.\n *\n * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).\n *\n * @template T The type of elements in the array.\n * @param {T[]} array - The array to filter.\n * @param {...T[]} values - The values to exclude.\n * @returns {T[]} A new array without the specified values.\n *\n * @example\n * // Removes the specified values from the array\n * without([1, 2, 3, 4, 5], 2, 4);\n * // Returns: [1, 3, 5]\n *\n * @example\n * // Removes specified string values from the array\n * without(['a', 'b', 'c', 'a'], 'a');\n * // Returns: ['b', 'c']\n */\nexport function without<T>(array: readonly T[], ...values: T[]): T[] {\n const valuesSet = new Set(values);\n return array.filter(item => !valuesSet.has(item));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,SAAS,QAAW,UAAwB,QAAkB;AACnE,QAAM,YAAY,IAAI,IAAI,MAAM;AAChC,SAAO,MAAM,OAAO,UAAQ,CAAC,UAAU,IAAI,IAAI,CAAC;AAClD;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ without
3
+ } from "../chunk-PYEYV7BY.mjs";
4
+ import "../chunk-2MM5EJJX.mjs";
5
+ export {
6
+ without
7
+ };
8
+ //# sourceMappingURL=without.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -2,6 +2,7 @@
2
2
  * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
3
3
  * which are in either of the arrays, but not in their intersection.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} arr1 - The first array.
6
7
  * @param {T[]} arr2 - The second array.
7
8
  * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.
@@ -2,6 +2,7 @@
2
2
  * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
3
3
  * which are in either of the arrays, but not in their intersection.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} arr1 - The first array.
6
7
  * @param {T[]} arr2 - The second array.
7
8
  * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/xor.ts","../../src/array/difference.ts","../../src/array/intersection.ts","../../src/array/uniq.ts","../../src/array/union.ts"],"sourcesContent":["import { difference } from './difference.ts';\nimport { intersection } from './intersection.ts';\nimport { union } from './union.ts';\n\n/**\n * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements\n * which are in either of the arrays, but not in their intersection.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.\n *\n * @example\n * // Returns [1, 2, 5, 6]\n * xor([1, 2, 3, 4], [3, 4, 5, 6]);\n *\n * @example\n * // Returns ['a', 'c']\n * xor(['a', 'b'], ['b', 'c']);\n */\nexport function xor<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return difference(union(arr1, arr2), intersection(arr1, arr2));\n}\n","/**\n * Computes the difference between two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements\n * that are present in the first array but not in the second array. It effectively\n * filters out any elements from the first array that also appear in the second array.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array\n * from which elements will be compared and filtered.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * Each element in this array will be checked against the first array, and if a match is found,\n * that element will be excluded from the result.\n * @returns {T[]} A new array containing the elements that are present in the first array but not\n * in the second array.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [2, 4];\n * const result = difference(array1, array2);\n * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.\n */\nexport function difference<T>(firstArr: readonly T[], secondArr: readonly T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => !secondSet.has(item));\n}\n","/**\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 * @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","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n","import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,SAAS,WAAc,UAAwB,WAA8B;AAClF,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ,CAAC,UAAU,IAAI,IAAI,CAAC;AACrD;;;ACTO,SAAS,aAAgB,UAAwB,WAA8B;AACpF,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,UAAU,IAAI,IAAI;AAAA,EAC3B,CAAC;AACH;;;ACTO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;;;ACEO,SAAS,MAAS,MAAoB,MAAyB;AACpE,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;;;AJAO,SAAS,IAAO,MAAoB,MAAyB;AAClE,SAAO,WAAW,MAAM,MAAM,IAAI,GAAG,aAAa,MAAM,IAAI,CAAC;AAC/D;","names":[]}
1
+ {"version":3,"sources":["../../src/array/xor.ts","../../src/array/difference.ts","../../src/array/intersection.ts","../../src/array/uniq.ts","../../src/array/union.ts"],"sourcesContent":["import { difference } from './difference.ts';\nimport { intersection } from './intersection.ts';\nimport { union } from './union.ts';\n\n/**\n * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements\n * which are in either of the arrays, but not in their intersection.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.\n *\n * @example\n * // Returns [1, 2, 5, 6]\n * xor([1, 2, 3, 4], [3, 4, 5, 6]);\n *\n * @example\n * // Returns ['a', 'c']\n * xor(['a', 'b'], ['b', 'c']);\n */\nexport function xor<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return difference(union(arr1, arr2), intersection(arr1, arr2));\n}\n","/**\n * Computes the difference between two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements\n * that are present in the first array but not in the second array. It effectively\n * filters out any elements from the first array that also appear in the second array.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array\n * from which elements will be compared and filtered.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * Each element in this array will be checked against the first array, and if a match is found,\n * that element will be excluded from the result.\n * @returns {T[]} A new array containing the elements that are present in the first array but not\n * in the second array.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [2, 4];\n * const result = difference(array1, array2);\n * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.\n */\nexport function difference<T>(firstArr: readonly T[], secondArr: readonly T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => !secondSet.has(item));\n}\n","/**\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","/**\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","import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @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 * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,SAAS,WAAc,UAAwB,WAA8B;AAClF,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ,CAAC,UAAU,IAAI,IAAI,CAAC;AACrD;;;ACRO,SAAS,aAAgB,UAAwB,WAA8B;AACpF,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,UAAU,IAAI,IAAI;AAAA,EAC3B,CAAC;AACH;;;ACTO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;;;ACEO,SAAS,MAAS,MAAoB,MAAyB;AACpE,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;;;AJAO,SAAS,IAAO,MAAoB,MAAyB;AAClE,SAAO,WAAW,MAAM,MAAM,IAAI,GAAG,aAAa,MAAM,IAAI,CAAC;AAC/D;","names":[]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  xor
3
- } from "../chunk-VKM3R5T5.mjs";
4
- import "../chunk-UPJXHWSJ.mjs";
5
- import "../chunk-XFCW7XJ4.mjs";
6
- import "../chunk-PYLGHB3F.mjs";
3
+ } from "../chunk-L7FQX5MN.mjs";
4
+ import "../chunk-R6QA7PLZ.mjs";
5
+ import "../chunk-DVK2N4KC.mjs";
6
+ import "../chunk-FVVSE2F2.mjs";
7
7
  import "../chunk-JPUKH67K.mjs";
8
8
  import "../chunk-2MM5EJJX.mjs";
9
9
  export {