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,94 +1,115 @@
1
- import "../chunk-V6MDTRGS.mjs";
2
- import {
3
- xorBy
4
- } from "../chunk-E54CCWDL.mjs";
5
- import {
6
- xorWith
7
- } from "../chunk-JSS4FXUD.mjs";
1
+ import "../chunk-XJR5WV2Z.mjs";
8
2
  import {
9
3
  zip
10
4
  } from "../chunk-IDCUZVJL.mjs";
11
5
  import {
12
6
  zipObject
13
- } from "../chunk-DA7GSKQ5.mjs";
7
+ } from "../chunk-6GWEY5EL.mjs";
14
8
  import {
15
9
  zipWith
16
10
  } from "../chunk-4KYXHZ4R.mjs";
11
+ import {
12
+ uniqBy
13
+ } from "../chunk-OXAZEEGP.mjs";
14
+ import {
15
+ unzipWith
16
+ } from "../chunk-IFNXROZR.mjs";
17
+ import {
18
+ without
19
+ } from "../chunk-PYEYV7BY.mjs";
20
+ import {
21
+ xor
22
+ } from "../chunk-L7FQX5MN.mjs";
23
+ import {
24
+ xorBy
25
+ } from "../chunk-Q47NGNXT.mjs";
26
+ import {
27
+ xorWith
28
+ } from "../chunk-QRSJBBFY.mjs";
29
+ import {
30
+ shuffle
31
+ } from "../chunk-G7UQ5PUR.mjs";
32
+ import {
33
+ take
34
+ } from "../chunk-ME352XO7.mjs";
35
+ import {
36
+ takeRight
37
+ } from "../chunk-IQLKIDXF.mjs";
38
+ import {
39
+ takeRightWhile
40
+ } from "../chunk-NTLX2MPV.mjs";
17
41
  import {
18
42
  takeWhile
19
43
  } from "../chunk-2IXFGSUA.mjs";
44
+ import {
45
+ union
46
+ } from "../chunk-R6QA7PLZ.mjs";
47
+ import {
48
+ uniq
49
+ } from "../chunk-DVK2N4KC.mjs";
20
50
  import {
21
51
  unionBy
22
- } from "../chunk-NRNKP6JF.mjs";
52
+ } from "../chunk-NFS7RWWE.mjs";
23
53
  import {
24
54
  unionWith
25
- } from "../chunk-OUTSP4VR.mjs";
26
- import {
27
- uniqBy
28
- } from "../chunk-WPDDOUQT.mjs";
55
+ } from "../chunk-2ZCITDMK.mjs";
29
56
  import {
30
57
  uniqWith
31
- } from "../chunk-2PFDLYQC.mjs";
58
+ } from "../chunk-237HGSZS.mjs";
32
59
  import {
33
- xor
34
- } from "../chunk-VKM3R5T5.mjs";
60
+ intersectionBy
61
+ } from "../chunk-O6UXZR3U.mjs";
35
62
  import {
36
- union
37
- } from "../chunk-UPJXHWSJ.mjs";
63
+ intersectionWith
64
+ } from "../chunk-XI7KRD2C.mjs";
38
65
  import {
39
- uniq
40
- } from "../chunk-XFCW7XJ4.mjs";
66
+ keyBy
67
+ } from "../chunk-AJKZMN2V.mjs";
41
68
  import {
42
69
  maxBy
43
- } from "../chunk-FXOABQRO.mjs";
70
+ } from "../chunk-OOKNBU4V.mjs";
44
71
  import {
45
72
  minBy
46
- } from "../chunk-OIHARMNM.mjs";
73
+ } from "../chunk-IJD7FE2Z.mjs";
47
74
  import {
48
75
  partition
49
- } from "../chunk-5L2V7WD3.mjs";
76
+ } from "../chunk-DN3NOZ3H.mjs";
50
77
  import {
51
78
  sample
52
- } from "../chunk-DOOIIHT3.mjs";
53
- import {
54
- shuffle
55
- } from "../chunk-DPLJQQFX.mjs";
79
+ } from "../chunk-2KNLZB7V.mjs";
56
80
  import {
57
- take
58
- } from "../chunk-ME352XO7.mjs";
59
- import {
60
- takeRight
61
- } from "../chunk-XDKEPIUV.mjs";
81
+ sampleSize
82
+ } from "../chunk-EHSKB6DF.mjs";
62
83
  import {
63
- takeRightWhile
64
- } from "../chunk-NTLX2MPV.mjs";
84
+ dropRight
85
+ } from "../chunk-JEKUA56R.mjs";
65
86
  import {
66
87
  dropRightWhile
67
- } from "../chunk-GTVOVGGZ.mjs";
88
+ } from "../chunk-JE6JKZU3.mjs";
68
89
  import {
69
90
  dropWhile
70
- } from "../chunk-K2BAFL2T.mjs";
91
+ } from "../chunk-LJ2C6MVP.mjs";
71
92
  import {
72
- groupBy
73
- } from "../chunk-LWXZFXY5.mjs";
93
+ fill
94
+ } from "../chunk-C4WE4GLC.mjs";
74
95
  import {
75
- intersection
76
- } from "../chunk-PYLGHB3F.mjs";
77
- import {
78
- intersectionBy
79
- } from "../chunk-GNSJP2AB.mjs";
96
+ forEachRight
97
+ } from "../chunk-IEA53J7P.mjs";
80
98
  import {
81
- intersectionWith
82
- } from "../chunk-2EFS3VA3.mjs";
99
+ groupBy
100
+ } from "../chunk-E6E4RZLN.mjs";
83
101
  import {
84
- keyBy
85
- } from "../chunk-ZOTAORG3.mjs";
102
+ intersection
103
+ } from "../chunk-FVVSE2F2.mjs";
86
104
  import {
87
105
  chunk
88
106
  } from "../chunk-E6C5EZQA.mjs";
89
107
  import {
90
108
  compact
91
- } from "../chunk-NKTBEEIT.mjs";
109
+ } from "../chunk-DTJJIMKJ.mjs";
110
+ import {
111
+ countBy
112
+ } from "../chunk-CRSKT4WW.mjs";
92
113
  import {
93
114
  difference
94
115
  } from "../chunk-JPUKH67K.mjs";
@@ -100,14 +121,14 @@ import {
100
121
  } from "../chunk-6NVQAHXP.mjs";
101
122
  import {
102
123
  drop
103
- } from "../chunk-ACFP3XMB.mjs";
104
- import {
105
- dropRight
106
- } from "../chunk-Q75KEFW5.mjs";
124
+ } from "../chunk-S3CORED5.mjs";
125
+ import "../chunk-GIWAOOFY.mjs";
126
+ import "../chunk-SYWMYQYJ.mjs";
107
127
  import "../chunk-2MM5EJJX.mjs";
108
128
  export {
109
129
  chunk,
110
130
  compact,
131
+ countBy,
111
132
  difference,
112
133
  differenceBy,
113
134
  differenceWith,
@@ -115,6 +136,8 @@ export {
115
136
  dropRight,
116
137
  dropRightWhile,
117
138
  dropWhile,
139
+ fill,
140
+ forEachRight,
118
141
  groupBy,
119
142
  intersection,
120
143
  intersectionBy,
@@ -124,6 +147,7 @@ export {
124
147
  minBy,
125
148
  partition,
126
149
  sample,
150
+ sampleSize,
127
151
  shuffle,
128
152
  take,
129
153
  takeRight,
@@ -135,6 +159,8 @@ export {
135
159
  uniq,
136
160
  uniqBy,
137
161
  uniqWith,
162
+ unzipWith,
163
+ without,
138
164
  xor,
139
165
  xorBy,
140
166
  xorWith,
@@ -5,6 +5,7 @@
5
5
  * present in both arrays. It effectively filters out any elements from the first array that
6
6
  * are not found in the second array.
7
7
  *
8
+ * @template T - The type of elements in the array.
8
9
  * @param {T[]} firstArr - The first array to compare.
9
10
  * @param {T[]} secondArr - The second array to compare.
10
11
  * @returns {T[]} A new array containing the elements that are present in both arrays.
@@ -5,6 +5,7 @@
5
5
  * present in both arrays. It effectively filters out any elements from the first array that
6
6
  * are not found in the second array.
7
7
  *
8
+ * @template T - The type of elements in the array.
8
9
  * @param {T[]} firstArr - The first array to compare.
9
10
  * @param {T[]} secondArr - The second array to compare.
10
11
  * @returns {T[]} A new array containing the elements that are present in both arrays.
@@ -1 +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 * @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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,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":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  intersection
3
- } from "../chunk-PYLGHB3F.mjs";
3
+ } from "../chunk-FVVSE2F2.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  intersection
@@ -6,6 +6,8 @@
6
6
  * mapped elements in the second array. It effectively filters out any elements from the first array
7
7
  * that do not have corresponding mapped values in the second array.
8
8
  *
9
+ * @template T - The type of elements in the array.
10
+ * @template U - The type of mapped elements.
9
11
  * @param {T[]} firstArr - The first array to compare.
10
12
  * @param {T[]} secondArr - The second array to compare.
11
13
  * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.
@@ -6,6 +6,8 @@
6
6
  * mapped elements in the second array. It effectively filters out any elements from the first array
7
7
  * that do not have corresponding mapped values in the second array.
8
8
  *
9
+ * @template T - The type of elements in the array.
10
+ * @template U - The type of mapped elements.
9
11
  * @param {T[]} firstArr - The first array to compare.
10
12
  * @param {T[]} secondArr - The second array to compare.
11
13
  * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/intersectionBy.ts"],"sourcesContent":["/**\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,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;","names":[]}
1
+ {"version":3,"sources":["../../src/array/intersectionBy.ts"],"sourcesContent":["/**\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,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;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  intersectionBy
3
- } from "../chunk-GNSJP2AB.mjs";
3
+ } from "../chunk-O6UXZR3U.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  intersectionBy
@@ -6,6 +6,7 @@
6
6
  * by the custom equality function. It effectively filters out any elements from the first array that
7
7
  * do not have corresponding matches in the second array according to the equality function.
8
8
  *
9
+ * @template T - The type of elements in the array.
9
10
  * @param {T[]} firstArr - The first array to compare.
10
11
  * @param {T[]} secondArr - The second array to compare.
11
12
  * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
@@ -6,6 +6,7 @@
6
6
  * by the custom equality function. It effectively filters out any elements from the first array that
7
7
  * do not have corresponding matches in the second array according to the equality function.
8
8
  *
9
+ * @template T - The type of elements in the array.
9
10
  * @param {T[]} firstArr - The first array to compare.
10
11
  * @param {T[]} secondArr - The second array to compare.
11
12
  * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/intersectionWith.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBO,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;","names":[]}
1
+ {"version":3,"sources":["../../src/array/intersectionWith.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,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;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  intersectionWith
3
- } from "../chunk-2EFS3VA3.mjs";
3
+ } from "../chunk-XI7KRD2C.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  intersectionWith
@@ -6,6 +6,8 @@
6
6
  * If there are multiple elements generating the same key, the last element among them is used
7
7
  * as the value.
8
8
  *
9
+ * @template T - The type of elements in the array.
10
+ * @template K - The type of keys.
9
11
  * @param {T[]} arr - The array of elements to be mapped.
10
12
  * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.
11
13
  * @returns {Record<K, T>} An object where keys are mapped to each element of an array.
@@ -23,6 +25,6 @@
23
25
  * // vegetable: { category: 'vegetable', name: 'carrot' }
24
26
  * // }
25
27
  */
26
- declare function keyBy<T, K extends string>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T>;
28
+ declare function keyBy<T, K extends PropertyKey>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T>;
27
29
 
28
30
  export { keyBy };
@@ -6,6 +6,8 @@
6
6
  * If there are multiple elements generating the same key, the last element among them is used
7
7
  * as the value.
8
8
  *
9
+ * @template T - The type of elements in the array.
10
+ * @template K - The type of keys.
9
11
  * @param {T[]} arr - The array of elements to be mapped.
10
12
  * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.
11
13
  * @returns {Record<K, T>} An object where keys are mapped to each element of an array.
@@ -23,6 +25,6 @@
23
25
  * // vegetable: { category: 'vegetable', name: 'carrot' }
24
26
  * // }
25
27
  */
26
- declare function keyBy<T, K extends string>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T>;
28
+ declare function keyBy<T, K extends PropertyKey>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T>;
27
29
 
28
30
  export { keyBy };
@@ -1 +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 * @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 string>(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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBO,SAAS,MAA2B,KAAmB,gBAA8C;AAC1G,QAAM,SAAS,CAAC;AAEhB,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,eAAe,IAAI;AAC/B,WAAO,GAAG,IAAI;AAAA,EAChB;AAEA,SAAO;AACT;","names":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  keyBy
3
- } from "../chunk-ZOTAORG3.mjs";
3
+ } from "../chunk-AJKZMN2V.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  keyBy
@@ -2,6 +2,7 @@
2
2
  * Finds the element in an array that has the maximum value when applying
3
3
  * the `getValue` function to each element.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} items The array of elements to search.
6
7
  * @param {(element: T) => number} getValue A function that selects a numeric value from each element.
7
8
  * @returns {T} The element with the maximum value as determined by the `getValue` function.
@@ -2,6 +2,7 @@
2
2
  * Finds the element in an array that has the maximum value when applying
3
3
  * the `getValue` function to each element.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} items The array of elements to search.
6
7
  * @param {(element: T) => number} getValue A function that selects a numeric value from each element.
7
8
  * @returns {T} The element with the maximum value as determined by the `getValue` function.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/maxBy.ts"],"sourcesContent":["/**\n * Finds the element in an array that has the maximum value when applying\n * the `getValue` function to each element.\n *\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 maximum value as determined by the `getValue` function.\n * @example\n * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 }\n * maxBy([], x => x.a); // Returns: undefined\n */\nexport function maxBy<T>(items: T[], getValue: (element: T) => number): T {\n let maxElement = items[0];\n let max = -Infinity;\n\n for (const element of items) {\n const value = getValue(element);\n if (value > max) {\n max = value;\n maxElement = element;\n }\n }\n\n return maxElement;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,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":[]}
1
+ {"version":3,"sources":["../../src/array/maxBy.ts"],"sourcesContent":["/**\n * Finds the element in an array that has the maximum 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 maximum value as determined by the `getValue` function.\n * @example\n * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 }\n * maxBy([], x => x.a); // Returns: undefined\n */\nexport function maxBy<T>(items: T[], getValue: (element: T) => number): T {\n let maxElement = items[0];\n let max = -Infinity;\n\n for (const element of items) {\n const value = getValue(element);\n if (value > max) {\n max = value;\n maxElement = element;\n }\n }\n\n return maxElement;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  maxBy
3
- } from "../chunk-FXOABQRO.mjs";
3
+ } from "../chunk-OOKNBU4V.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  maxBy
@@ -2,6 +2,7 @@
2
2
  * Finds the element in an array that has the minimum value when applying
3
3
  * the `getValue` function to each element.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} items The array of elements to search.
6
7
  * @param {(element: T) => number} getValue A function that selects a numeric value from each element.
7
8
  * @returns {T} The element with the minimum value as determined by the `getValue` function.
@@ -2,6 +2,7 @@
2
2
  * Finds the element in an array that has the minimum value when applying
3
3
  * the `getValue` function to each element.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {T[]} items The array of elements to search.
6
7
  * @param {(element: T) => number} getValue A function that selects a numeric value from each element.
7
8
  * @returns {T} The element with the minimum value as determined by the `getValue` function.
@@ -1 +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 * @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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,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":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  minBy
3
- } from "../chunk-OIHARMNM.mjs";
3
+ } from "../chunk-IJD7FE2Z.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  minBy
@@ -5,6 +5,7 @@
5
5
  * the first array contains elements for which the predicate function returns true, and
6
6
  * the second array contains elements for which the predicate function returns false.
7
7
  *
8
+ * @template T - The type of elements in the array.
8
9
  * @param {T[]} arr - The array to partition.
9
10
  * @param {(value: T) => boolean} isInTruthy - A predicate function that determines
10
11
  * whether an element should be placed in the truthy array. The function is called with each
@@ -5,6 +5,7 @@
5
5
  * the first array contains elements for which the predicate function returns true, and
6
6
  * the second array contains elements for which the predicate function returns false.
7
7
  *
8
+ * @template T - The type of elements in the array.
8
9
  * @param {T[]} arr - The array to partition.
9
10
  * @param {(value: T) => boolean} isInTruthy - A predicate function that determines
10
11
  * whether an element should be placed in the truthy array. The function is called with each
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into two groups based on a predicate function.\n *\n * This function takes an array and a predicate function. It returns a tuple of two arrays:\n * the first array contains elements for which the predicate function returns true, and\n * the second array contains elements for which the predicate function returns false.\n *\n * @param {T[]} arr - The array to partition.\n * @param {(value: T) => boolean} isInTruthy - A predicate function that determines\n * whether an element should be placed in the truthy array. The function is called with each\n * element of the array.\n * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for\n * which the predicate returned true, and the second array contains elements for which the\n * predicate returned false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const isEven = x => x % 2 === 0;\n * const [even, odd] = partition(array, isEven);\n * // even will be [2, 4], and odd will be [1, 3, 5]\n */\nexport function partition<T>(arr: 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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBO,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":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  partition
3
- } from "../chunk-5L2V7WD3.mjs";
3
+ } from "../chunk-DN3NOZ3H.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  partition
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * This function takes an array and returns a single element selected randomly from the array.
5
5
  *
6
+ * @template T - The type of elements in the array.
6
7
  * @param {T[]} arr - The array to sample from.
7
8
  * @returns {T} A random element from the array.
8
9
  *
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * This function takes an array and returns a single element selected randomly from the array.
5
5
  *
6
+ * @template T - The type of elements in the array.
6
7
  * @param {T[]} arr - The array to sample from.
7
8
  * @returns {T} A random element from the array.
8
9
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/sample.ts"],"sourcesContent":["/**\n * Returns a random element from an array.\n *\n * This function takes an array and returns a single element selected randomly from the array.\n *\n * @param {T[]} arr - The array to sample from.\n * @returns {T} A random element from the array.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const randomElement = sample(array);\n * // randomElement will be one of the elements from the array, selected randomly.\n */\nexport function sample<T>(arr: readonly T[]): T {\n const randomIndex = Math.floor(Math.random() * arr.length);\n return arr[randomIndex];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,OAAU,KAAsB;AAC9C,QAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,IAAI,MAAM;AACzD,SAAO,IAAI,WAAW;AACxB;","names":[]}
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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
  sample
3
- } from "../chunk-DOOIIHT3.mjs";
3
+ } from "../chunk-2KNLZB7V.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  sample
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Returns a sample element array of a specified `size`.
3
+ *
4
+ * This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm.
5
+ *
6
+ * {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algoritm}
7
+ *
8
+ * @template T - The type of elements in the array.
9
+ * @param {T[]} array - The array to sample from.
10
+ * @param {number} size - The size of sample.
11
+ * @returns {T[]} A new array with sample size applied.
12
+ * @throws {Error} Throws an error if `size` is greater than the length of `array`.
13
+ *
14
+ * @example
15
+ * const result = sampleSize([1, 2, 3], 2)
16
+ * // result will be an array containing two of the elements from the array.
17
+ * // [1, 2] or [1, 3] or [2, 3]
18
+ */
19
+ declare function sampleSize<T>(array: readonly T[], size: number): T[];
20
+
21
+ export { sampleSize };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Returns a sample element array of a specified `size`.
3
+ *
4
+ * This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm.
5
+ *
6
+ * {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algoritm}
7
+ *
8
+ * @template T - The type of elements in the array.
9
+ * @param {T[]} array - The array to sample from.
10
+ * @param {number} size - The size of sample.
11
+ * @returns {T[]} A new array with sample size applied.
12
+ * @throws {Error} Throws an error if `size` is greater than the length of `array`.
13
+ *
14
+ * @example
15
+ * const result = sampleSize([1, 2, 3], 2)
16
+ * // result will be an array containing two of the elements from the array.
17
+ * // [1, 2] or [1, 3] or [2, 3]
18
+ */
19
+ declare function sampleSize<T>(array: readonly T[], size: number): T[];
20
+
21
+ export { sampleSize };
@@ -0,0 +1,65 @@
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/sampleSize.ts
21
+ var sampleSize_exports = {};
22
+ __export(sampleSize_exports, {
23
+ sampleSize: () => sampleSize
24
+ });
25
+ module.exports = __toCommonJS(sampleSize_exports);
26
+
27
+ // src/math/random.ts
28
+ function random(minimum, maximum) {
29
+ if (maximum == null) {
30
+ maximum = minimum;
31
+ minimum = 0;
32
+ }
33
+ if (minimum >= maximum) {
34
+ throw new Error("Invalid input: The maximum value must be greater than the minimum value.");
35
+ }
36
+ return Math.random() * (maximum - minimum) + minimum;
37
+ }
38
+
39
+ // src/math/randomInt.ts
40
+ function randomInt(minimum, maximum) {
41
+ return Math.floor(random(minimum, maximum));
42
+ }
43
+
44
+ // src/array/sampleSize.ts
45
+ function sampleSize(array, size) {
46
+ if (size > array.length) {
47
+ throw new Error("Size must be less than or equal to the length of array.");
48
+ }
49
+ const result = new Array(size);
50
+ const selected = /* @__PURE__ */ new Set();
51
+ for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {
52
+ let index = randomInt(0, step + 1);
53
+ if (selected.has(index)) {
54
+ index = step;
55
+ }
56
+ selected.add(index);
57
+ result[resultIndex] = array[index];
58
+ }
59
+ return result;
60
+ }
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ sampleSize
64
+ });
65
+ //# sourceMappingURL=sampleSize.js.map