es-toolkit 1.6.1 → 1.7.0-dev.148

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 +72 -46
  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 +6 -6
  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 +112 -84
  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 +6 -2
  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
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-OHQAR5AU.mjs";
5
5
  import {
6
6
  isNotNil
7
- } from "./chunk-ZQNAZPSK.mjs";
7
+ } from "./chunk-BMRTZMRE.mjs";
8
8
  import {
9
9
  isNull
10
10
  } from "./chunk-AIRSKN47.mjs";
@@ -14,153 +14,121 @@ import {
14
14
  import "./chunk-ARZ5BDR6.mjs";
15
15
  import {
16
16
  delay
17
- } from "./chunk-CDA4NK7J.mjs";
17
+ } from "./chunk-O64NE2P4.mjs";
18
18
  import "./chunk-T5JCRGXA.mjs";
19
- import {
20
- pickBy
21
- } from "./chunk-MQWVBKUT.mjs";
22
19
  import {
23
20
  omit
24
- } from "./chunk-PLTO44KM.mjs";
21
+ } from "./chunk-QZITBKWX.mjs";
25
22
  import {
26
23
  omitBy
27
- } from "./chunk-A67NF2C7.mjs";
24
+ } from "./chunk-BCTYOXT7.mjs";
28
25
  import {
29
26
  pick
30
- } from "./chunk-OFWKFUFZ.mjs";
31
- import "./chunk-FZEZH22H.mjs";
27
+ } from "./chunk-HPFDYUGP.mjs";
32
28
  import {
33
- AbortError
34
- } from "./chunk-VP2LXY75.mjs";
35
- import "./chunk-QVHWSUEH.mjs";
36
- import {
37
- randomInt
38
- } from "./chunk-GIWAOOFY.mjs";
39
- import {
40
- range
41
- } from "./chunk-UNLX2F2Y.mjs";
42
- import {
43
- round
44
- } from "./chunk-5PMKOZ2F.mjs";
45
- import {
46
- clamp
47
- } from "./chunk-MLCL773E.mjs";
48
- import {
49
- mean
50
- } from "./chunk-KHK7LKE5.mjs";
51
- import {
52
- sum
53
- } from "./chunk-NOFHNJ5C.mjs";
54
- import {
55
- random
56
- } from "./chunk-SYWMYQYJ.mjs";
29
+ pickBy
30
+ } from "./chunk-6CLH5YZ2.mjs";
57
31
  import "./chunk-N6EM6ETS.mjs";
32
+ import {
33
+ noop
34
+ } from "./chunk-LKXCOLNY.mjs";
58
35
  import {
59
36
  once
60
- } from "./chunk-UFAA5WKR.mjs";
37
+ } from "./chunk-CMBC4MXG.mjs";
61
38
  import {
62
39
  throttle
63
- } from "./chunk-OEOAJOLQ.mjs";
40
+ } from "./chunk-QOJGMVVR.mjs";
64
41
  import {
65
42
  debounce
66
- } from "./chunk-G42NUGNE.mjs";
43
+ } from "./chunk-3IP4JVLL.mjs";
44
+ import "./chunk-XJR5WV2Z.mjs";
67
45
  import {
68
- noop
69
- } from "./chunk-LKXCOLNY.mjs";
70
- import "./chunk-V6MDTRGS.mjs";
46
+ xor
47
+ } from "./chunk-L7FQX5MN.mjs";
71
48
  import {
72
49
  xorBy
73
- } from "./chunk-E54CCWDL.mjs";
50
+ } from "./chunk-Q47NGNXT.mjs";
74
51
  import {
75
52
  xorWith
76
- } from "./chunk-JSS4FXUD.mjs";
53
+ } from "./chunk-QRSJBBFY.mjs";
77
54
  import {
78
55
  zip
79
56
  } from "./chunk-IDCUZVJL.mjs";
80
57
  import {
81
58
  zipObject
82
- } from "./chunk-DA7GSKQ5.mjs";
59
+ } from "./chunk-6GWEY5EL.mjs";
83
60
  import {
84
61
  zipWith
85
62
  } from "./chunk-4KYXHZ4R.mjs";
86
63
  import {
87
- takeWhile
88
- } from "./chunk-2IXFGSUA.mjs";
64
+ union
65
+ } from "./chunk-R6QA7PLZ.mjs";
89
66
  import {
90
67
  unionBy
91
- } from "./chunk-NRNKP6JF.mjs";
68
+ } from "./chunk-NFS7RWWE.mjs";
92
69
  import {
93
70
  unionWith
94
- } from "./chunk-OUTSP4VR.mjs";
71
+ } from "./chunk-2ZCITDMK.mjs";
72
+ import {
73
+ uniq
74
+ } from "./chunk-DVK2N4KC.mjs";
95
75
  import {
96
76
  uniqBy
97
- } from "./chunk-WPDDOUQT.mjs";
77
+ } from "./chunk-OXAZEEGP.mjs";
98
78
  import {
99
79
  uniqWith
100
- } from "./chunk-2PFDLYQC.mjs";
101
- import {
102
- xor
103
- } from "./chunk-VKM3R5T5.mjs";
104
- import {
105
- union
106
- } from "./chunk-UPJXHWSJ.mjs";
80
+ } from "./chunk-237HGSZS.mjs";
107
81
  import {
108
- uniq
109
- } from "./chunk-XFCW7XJ4.mjs";
110
- import {
111
- maxBy
112
- } from "./chunk-FXOABQRO.mjs";
82
+ unzipWith
83
+ } from "./chunk-IFNXROZR.mjs";
113
84
  import {
114
- minBy
115
- } from "./chunk-OIHARMNM.mjs";
85
+ without
86
+ } from "./chunk-PYEYV7BY.mjs";
116
87
  import {
117
88
  partition
118
- } from "./chunk-5L2V7WD3.mjs";
89
+ } from "./chunk-DN3NOZ3H.mjs";
119
90
  import {
120
91
  sample
121
- } from "./chunk-DOOIIHT3.mjs";
92
+ } from "./chunk-2KNLZB7V.mjs";
93
+ import {
94
+ sampleSize
95
+ } from "./chunk-EHSKB6DF.mjs";
122
96
  import {
123
97
  shuffle
124
- } from "./chunk-DPLJQQFX.mjs";
98
+ } from "./chunk-G7UQ5PUR.mjs";
125
99
  import {
126
100
  take
127
101
  } from "./chunk-ME352XO7.mjs";
128
102
  import {
129
103
  takeRight
130
- } from "./chunk-XDKEPIUV.mjs";
104
+ } from "./chunk-IQLKIDXF.mjs";
131
105
  import {
132
106
  takeRightWhile
133
107
  } from "./chunk-NTLX2MPV.mjs";
134
108
  import {
135
- dropRightWhile
136
- } from "./chunk-GTVOVGGZ.mjs";
137
- import {
138
- dropWhile
139
- } from "./chunk-K2BAFL2T.mjs";
109
+ takeWhile
110
+ } from "./chunk-2IXFGSUA.mjs";
140
111
  import {
141
112
  groupBy
142
- } from "./chunk-LWXZFXY5.mjs";
113
+ } from "./chunk-E6E4RZLN.mjs";
143
114
  import {
144
115
  intersection
145
- } from "./chunk-PYLGHB3F.mjs";
116
+ } from "./chunk-FVVSE2F2.mjs";
146
117
  import {
147
118
  intersectionBy
148
- } from "./chunk-GNSJP2AB.mjs";
119
+ } from "./chunk-O6UXZR3U.mjs";
149
120
  import {
150
121
  intersectionWith
151
- } from "./chunk-2EFS3VA3.mjs";
122
+ } from "./chunk-XI7KRD2C.mjs";
152
123
  import {
153
124
  keyBy
154
- } from "./chunk-ZOTAORG3.mjs";
155
- import {
156
- chunk
157
- } from "./chunk-E6C5EZQA.mjs";
125
+ } from "./chunk-AJKZMN2V.mjs";
158
126
  import {
159
- compact
160
- } from "./chunk-NKTBEEIT.mjs";
127
+ maxBy
128
+ } from "./chunk-OOKNBU4V.mjs";
161
129
  import {
162
- difference
163
- } from "./chunk-JPUKH67K.mjs";
130
+ minBy
131
+ } from "./chunk-IJD7FE2Z.mjs";
164
132
  import {
165
133
  differenceBy
166
134
  } from "./chunk-LVWX5B43.mjs";
@@ -169,16 +137,70 @@ import {
169
137
  } from "./chunk-6NVQAHXP.mjs";
170
138
  import {
171
139
  drop
172
- } from "./chunk-ACFP3XMB.mjs";
140
+ } from "./chunk-S3CORED5.mjs";
173
141
  import {
174
142
  dropRight
175
- } from "./chunk-Q75KEFW5.mjs";
143
+ } from "./chunk-JEKUA56R.mjs";
144
+ import {
145
+ dropRightWhile
146
+ } from "./chunk-JE6JKZU3.mjs";
147
+ import {
148
+ dropWhile
149
+ } from "./chunk-LJ2C6MVP.mjs";
150
+ import {
151
+ fill
152
+ } from "./chunk-C4WE4GLC.mjs";
153
+ import {
154
+ forEachRight
155
+ } from "./chunk-IEA53J7P.mjs";
156
+ import {
157
+ chunk
158
+ } from "./chunk-E6C5EZQA.mjs";
159
+ import {
160
+ compact
161
+ } from "./chunk-DTJJIMKJ.mjs";
162
+ import {
163
+ countBy
164
+ } from "./chunk-CRSKT4WW.mjs";
165
+ import {
166
+ difference
167
+ } from "./chunk-JPUKH67K.mjs";
168
+ import "./chunk-FZEZH22H.mjs";
169
+ import {
170
+ AbortError
171
+ } from "./chunk-DXB7EZUQ.mjs";
172
+ import "./chunk-TZE6EDCX.mjs";
173
+ import {
174
+ randomInt
175
+ } from "./chunk-GIWAOOFY.mjs";
176
+ import {
177
+ range
178
+ } from "./chunk-UNLX2F2Y.mjs";
179
+ import {
180
+ round
181
+ } from "./chunk-5PMKOZ2F.mjs";
182
+ import {
183
+ clamp
184
+ } from "./chunk-MLCL773E.mjs";
185
+ import {
186
+ meanBy
187
+ } from "./chunk-SDIMTYZW.mjs";
188
+ import {
189
+ mean
190
+ } from "./chunk-LT6E4Y4Z.mjs";
191
+ import {
192
+ sum
193
+ } from "./chunk-NOFHNJ5C.mjs";
194
+ import {
195
+ random
196
+ } from "./chunk-SYWMYQYJ.mjs";
176
197
  import "./chunk-2MM5EJJX.mjs";
177
198
  export {
178
199
  AbortError,
179
200
  chunk,
180
201
  clamp,
181
202
  compact,
203
+ countBy,
182
204
  debounce,
183
205
  delay,
184
206
  difference,
@@ -188,6 +210,8 @@ export {
188
210
  dropRight,
189
211
  dropRightWhile,
190
212
  dropWhile,
213
+ fill,
214
+ forEachRight,
191
215
  groupBy,
192
216
  intersection,
193
217
  intersectionBy,
@@ -199,6 +223,7 @@ export {
199
223
  keyBy,
200
224
  maxBy,
201
225
  mean,
226
+ meanBy,
202
227
  minBy,
203
228
  noop,
204
229
  omit,
@@ -212,6 +237,7 @@ export {
212
237
  range,
213
238
  round,
214
239
  sample,
240
+ sampleSize,
215
241
  shuffle,
216
242
  sum,
217
243
  take,
@@ -225,6 +251,8 @@ export {
225
251
  uniq,
226
252
  uniqBy,
227
253
  uniqWith,
254
+ unzipWith,
255
+ without,
228
256
  xor,
229
257
  xorBy,
230
258
  xorWith,
@@ -1,5 +1,6 @@
1
1
  export { clamp } from './clamp.mjs';
2
2
  export { mean } from './mean.mjs';
3
+ export { meanBy } from './meanBy.mjs';
3
4
  export { random } from './random.mjs';
4
5
  export { randomInt } from './randomInt.mjs';
5
6
  export { round } from './round.mjs';
@@ -1,5 +1,6 @@
1
1
  export { clamp } from './clamp.js';
2
2
  export { mean } from './mean.js';
3
+ export { meanBy } from './meanBy.js';
3
4
  export { random } from './random.js';
4
5
  export { randomInt } from './randomInt.js';
5
6
  export { round } from './round.js';
@@ -22,6 +22,7 @@ var math_exports = {};
22
22
  __export(math_exports, {
23
23
  clamp: () => clamp,
24
24
  mean: () => mean,
25
+ meanBy: () => meanBy,
25
26
  random: () => random,
26
27
  randomInt: () => randomInt,
27
28
  range: () => range,
@@ -52,6 +53,12 @@ function mean(nums) {
52
53
  return sum(nums) / nums.length;
53
54
  }
54
55
 
56
+ // src/math/meanBy.ts
57
+ function meanBy(items, getValue) {
58
+ const nums = items.map((x) => getValue(x));
59
+ return mean(nums);
60
+ }
61
+
55
62
  // src/math/random.ts
56
63
  function random(minimum, maximum) {
57
64
  if (maximum == null) {
@@ -101,6 +108,7 @@ function range(start, end, step) {
101
108
  0 && (module.exports = {
102
109
  clamp,
103
110
  mean,
111
+ meanBy,
104
112
  random,
105
113
  randomInt,
106
114
  range,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/math/index.ts","../../src/math/clamp.ts","../../src/math/sum.ts","../../src/math/mean.ts","../../src/math/random.ts","../../src/math/randomInt.ts","../../src/math/round.ts","../../src/math/range.ts"],"sourcesContent":["export { clamp } from './clamp.ts';\nexport { mean } from './mean.ts';\nexport { random } from './random.ts';\nexport { randomInt } from './randomInt.ts';\nexport { round } from './round.ts';\nexport { sum } from './sum.ts';\nexport { range } from './range.ts';\n","/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the avverage.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\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","/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n","/**\n * Returns an array of numbers from `start` to `end`, incrementing by `step`.\n *\n * If `step` is not provided, it defaults to `1` for an\n * ascending range and `-1` for a descending range.\n *\n * @param {number} start - The starting number of the range.\n * @param {number} [end] - The end number of the range.\n * @param {number} [step] - The step value for the range.\n * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.\n *\n * @example\n * // Returns [0, 1, 2, 3]\n * range(4);\n *\n * @example\n * // Returns [0, 5, 10, 15]\n * range(0, 20, 5);\n *\n * @example\n * // Returns []\n * range(0, -4, -1);\n *\n * @example\n * // Throws an error: The step value must be a non-zero integer.\n * range(1, 4, 0);\n */\nexport function range(end: number): number[];\nexport function range(start: number, end: number): number[];\nexport function range(start: number, end: number, step: number): number[];\nexport function range(start: number, end?: number, step?: number): number[] {\n if (end == null) {\n end = start;\n start = 0;\n }\n\n if (step == null) {\n step = 1;\n }\n\n if (!Number.isInteger(step) || step === 0) {\n throw new Error(`The step value must be a non-zero integer.`);\n }\n\n const length = Math.max(Math.ceil((end - start) / step), 0);\n const result = new Array(length);\n\n for (let i = 0; i < length; i++) {\n result[i] = start + i * step;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,SAAS,MAAM,OAAe,QAAgB,QAAyB;AAC5E,MAAI,UAAU,MAAM;AAClB,WAAO,KAAK,IAAI,OAAO,MAAM;AAAA,EAC/B;AAEA,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,MAAM,GAAG,MAAM;AACjD;;;ACZO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;ACAO,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;;;ACHO,SAAS,MAAM,OAAe,YAAY,GAAW;AAC1D,MAAI,CAAC,OAAO,UAAU,SAAS,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;;;ACOO,SAAS,MAAM,OAAe,KAAc,MAAyB;AAC1E,MAAI,OAAO,MAAM;AACf,UAAM;AACN,YAAQ;AAAA,EACV;AAEA,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,SAAS,GAAG;AACzC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,SAAS,KAAK,IAAI,KAAK,MAAM,MAAM,SAAS,IAAI,GAAG,CAAC;AAC1D,QAAM,SAAS,IAAI,MAAM,MAAM;AAE/B,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,WAAO,CAAC,IAAI,QAAQ,IAAI;AAAA,EAC1B;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/math/index.ts","../../src/math/clamp.ts","../../src/math/sum.ts","../../src/math/mean.ts","../../src/math/meanBy.ts","../../src/math/random.ts","../../src/math/randomInt.ts","../../src/math/round.ts","../../src/math/range.ts"],"sourcesContent":["export { clamp } from './clamp.ts';\nexport { mean } from './mean.ts';\nexport { meanBy } from './meanBy.ts';\nexport { random } from './random.ts';\nexport { randomInt } from './randomInt.ts';\nexport { round } from './round.ts';\nexport { sum } from './sum.ts';\nexport { range } from './range.ts';\n","/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\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","/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n","/**\n * Returns an array of numbers from `start` to `end`, incrementing by `step`.\n *\n * If `step` is not provided, it defaults to `1` for an\n * ascending range and `-1` for a descending range.\n *\n * @param {number} start - The starting number of the range.\n * @param {number} [end] - The end number of the range.\n * @param {number} [step] - The step value for the range.\n * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.\n *\n * @example\n * // Returns [0, 1, 2, 3]\n * range(4);\n *\n * @example\n * // Returns [0, 5, 10, 15]\n * range(0, 20, 5);\n *\n * @example\n * // Returns []\n * range(0, -4, -1);\n *\n * @example\n * // Throws an error: The step value must be a non-zero integer.\n * range(1, 4, 0);\n */\nexport function range(end: number): number[];\nexport function range(start: number, end: number): number[];\nexport function range(start: number, end: number, step: number): number[];\nexport function range(start: number, end?: number, step?: number): number[] {\n if (end == null) {\n end = start;\n start = 0;\n }\n\n if (step == null) {\n step = 1;\n }\n\n if (!Number.isInteger(step) || step === 0) {\n throw new Error(`The step value must be a non-zero integer.`);\n }\n\n const length = Math.max(Math.ceil((end - start) / step), 0);\n const result = new Array(length);\n\n for (let i = 0; i < length; i++) {\n result[i] = start + i * step;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,SAAS,MAAM,OAAe,QAAgB,QAAyB;AAC5E,MAAI,UAAU,MAAM;AAClB,WAAO,KAAK,IAAI,OAAO,MAAM;AAAA,EAC/B;AAEA,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,MAAM,GAAG,MAAM;AACjD;;;ACZO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;ACAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;;;ACJO,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;;;ACHO,SAAS,MAAM,OAAe,YAAY,GAAW;AAC1D,MAAI,CAAC,OAAO,UAAU,SAAS,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;;;ACOO,SAAS,MAAM,OAAe,KAAc,MAAyB;AAC1E,MAAI,OAAO,MAAM;AACf,UAAM;AACN,YAAQ;AAAA,EACV;AAEA,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,SAAS,GAAG;AACzC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,SAAS,KAAK,IAAI,KAAK,MAAM,MAAM,SAAS,IAAI,GAAG,CAAC;AAC1D,QAAM,SAAS,IAAI,MAAM,MAAM;AAE/B,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,WAAO,CAAC,IAAI,QAAQ,IAAI;AAAA,EAC1B;AAEA,SAAO;AACT;","names":[]}
@@ -1,4 +1,4 @@
1
- import "../chunk-QVHWSUEH.mjs";
1
+ import "../chunk-TZE6EDCX.mjs";
2
2
  import {
3
3
  randomInt
4
4
  } from "../chunk-GIWAOOFY.mjs";
@@ -11,9 +11,12 @@ import {
11
11
  import {
12
12
  clamp
13
13
  } from "../chunk-MLCL773E.mjs";
14
+ import {
15
+ meanBy
16
+ } from "../chunk-SDIMTYZW.mjs";
14
17
  import {
15
18
  mean
16
- } from "../chunk-KHK7LKE5.mjs";
19
+ } from "../chunk-LT6E4Y4Z.mjs";
17
20
  import {
18
21
  sum
19
22
  } from "../chunk-NOFHNJ5C.mjs";
@@ -24,6 +27,7 @@ import "../chunk-2MM5EJJX.mjs";
24
27
  export {
25
28
  clamp,
26
29
  mean,
30
+ meanBy,
27
31
  random,
28
32
  randomInt,
29
33
  range,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * If the array is empty, this function returns `NaN`.
5
5
  *
6
- * @param {number[]} nums - An array of numbers to calculate the avverage.
6
+ * @param {number[]} nums - An array of numbers to calculate the average.
7
7
  * @returns {number} The average of all the numbers in the array.
8
8
  *
9
9
  * @example
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * If the array is empty, this function returns `NaN`.
5
5
  *
6
- * @param {number[]} nums - An array of numbers to calculate the avverage.
6
+ * @param {number[]} nums - An array of numbers to calculate the average.
7
7
  * @returns {number} The average of all the numbers in the array.
8
8
  *
9
9
  * @example
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/math/mean.ts","../../src/math/sum.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the avverage.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ADNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;","names":[]}
1
+ {"version":3,"sources":["../../src/math/mean.ts","../../src/math/sum.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ADNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mean
3
- } from "../chunk-KHK7LKE5.mjs";
3
+ } from "../chunk-LT6E4Y4Z.mjs";
4
4
  import "../chunk-NOFHNJ5C.mjs";
5
5
  import "../chunk-2MM5EJJX.mjs";
6
6
  export {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Calculates the average of an array of numbers when applying
3
+ * the `getValue` function to each element.
4
+ *
5
+ * If the array is empty, this function returns `NaN`.
6
+ *
7
+ * @template T - The type of elements in the array.
8
+ * @param {T[]} items An array to calculate the average.
9
+ * @param {(element: T) => number} getValue A function that selects a numeric value from each element.
10
+ * @returns {number} The average of all the numbers as determined by the `getValue` function.
11
+ *
12
+ * @example
13
+ * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
14
+ * meanBy([], x => x.a); // Returns: NaN
15
+ */
16
+ declare function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number;
17
+
18
+ export { meanBy };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Calculates the average of an array of numbers when applying
3
+ * the `getValue` function to each element.
4
+ *
5
+ * If the array is empty, this function returns `NaN`.
6
+ *
7
+ * @template T - The type of elements in the array.
8
+ * @param {T[]} items An array to calculate the average.
9
+ * @param {(element: T) => number} getValue A function that selects a numeric value from each element.
10
+ * @returns {number} The average of all the numbers as determined by the `getValue` function.
11
+ *
12
+ * @example
13
+ * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
14
+ * meanBy([], x => x.a); // Returns: NaN
15
+ */
16
+ declare function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number;
17
+
18
+ export { meanBy };
@@ -0,0 +1,50 @@
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/math/meanBy.ts
21
+ var meanBy_exports = {};
22
+ __export(meanBy_exports, {
23
+ meanBy: () => meanBy
24
+ });
25
+ module.exports = __toCommonJS(meanBy_exports);
26
+
27
+ // src/math/sum.ts
28
+ function sum(nums) {
29
+ let result = 0;
30
+ for (const num of nums) {
31
+ result += num;
32
+ }
33
+ return result;
34
+ }
35
+
36
+ // src/math/mean.ts
37
+ function mean(nums) {
38
+ return sum(nums) / nums.length;
39
+ }
40
+
41
+ // src/math/meanBy.ts
42
+ function meanBy(items, getValue) {
43
+ const nums = items.map((x) => getValue(x));
44
+ return mean(nums);
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ meanBy
49
+ });
50
+ //# sourceMappingURL=meanBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/math/meanBy.ts","../../src/math/sum.ts","../../src/math/mean.ts"],"sourcesContent":["import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;AFAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;","names":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ meanBy
3
+ } from "../chunk-SDIMTYZW.mjs";
4
+ import "../chunk-LT6E4Y4Z.mjs";
5
+ import "../chunk-NOFHNJ5C.mjs";
6
+ import "../chunk-2MM5EJJX.mjs";
7
+ export {
8
+ meanBy
9
+ };
10
+ //# sourceMappingURL=meanBy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/object/index.ts","../../src/object/omit.ts","../../src/object/omitBy.ts","../../src/object/pick.ts","../../src/object/pickBy.ts"],"sourcesContent":["export { omit } from './omit.ts';\nexport { omitBy } from './omitBy.ts';\nexport { pick } from './pick.ts';\nexport { pickBy } from './pickBy.ts';\n","/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n","/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,mBAAK;AAEpB,aAAW,OAAO,MAAM;AACtB,WAAO,OAAO,GAAG;AAAA,EACnB;AAEA,SAAO;AACT;;;ACLO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,WAAW,OAAO,GAAG,GAAG;AAC1B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;;;AClBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,CAAC;AAEhB,aAAW,OAAO,MAAM;AACtB,WAAO,GAAG,IAAI,IAAI,GAAG;AAAA,EACvB;AAEA,SAAO;AACT;;;ACLO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,CAAC,WAAW,OAAO,GAAG,GAAG;AAC3B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/object/index.ts","../../src/object/omit.ts","../../src/object/omitBy.ts","../../src/object/pick.ts","../../src/object/pickBy.ts"],"sourcesContent":["export { omit } from './omit.ts';\nexport { omitBy } from './omitBy.ts';\nexport { pick } from './pick.ts';\nexport { pickBy } from './pickBy.ts';\n","/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n","/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,mBAAK;AAEpB,aAAW,OAAO,MAAM;AACtB,WAAO,OAAO,GAAG;AAAA,EACnB;AAEA,SAAO;AACT;;;ACNO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,WAAW,OAAO,GAAG,GAAG;AAC1B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;;;ACjBO,SAAS,KAAuD,KAAQ,MAAuB;AACpG,QAAM,SAAS,CAAC;AAEhB,aAAW,OAAO,MAAM;AACtB,WAAO,GAAG,IAAI,IAAI,GAAG;AAAA,EACvB;AAEA,SAAO;AACT;;;ACNO,SAAS,OACd,KACA,YACY;AACZ,QAAM,SAAqB,CAAC;AAE5B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,CAAC,WAAW,OAAO,GAAG,GAAG;AAC3B;AAAA,IACF;AAEA,IAAC,OAAe,GAAG,IAAI;AAAA,EACzB;AAEA,SAAO;AACT;","names":[]}
@@ -1,16 +1,16 @@
1
1
  import "../chunk-T5JCRGXA.mjs";
2
- import {
3
- pickBy
4
- } from "../chunk-MQWVBKUT.mjs";
5
2
  import {
6
3
  omit
7
- } from "../chunk-PLTO44KM.mjs";
4
+ } from "../chunk-QZITBKWX.mjs";
8
5
  import {
9
6
  omitBy
10
- } from "../chunk-A67NF2C7.mjs";
7
+ } from "../chunk-BCTYOXT7.mjs";
11
8
  import {
12
9
  pick
13
- } from "../chunk-OFWKFUFZ.mjs";
10
+ } from "../chunk-HPFDYUGP.mjs";
11
+ import {
12
+ pickBy
13
+ } from "../chunk-6CLH5YZ2.mjs";
14
14
  import "../chunk-2MM5EJJX.mjs";
15
15
  export {
16
16
  omit,
@@ -4,6 +4,8 @@
4
4
  * This function takes an object and an array of keys, and returns a new object that
5
5
  * excludes the properties corresponding to the specified keys.
6
6
  *
7
+ * @template T - The type of object.
8
+ * @template K - The type of keys in object.
7
9
  * @param {T} obj - The object to omit keys from.
8
10
  * @param {K[]} keys - An array of keys to be omitted from the object.
9
11
  * @returns {Omit<T, K>} A new object with the specified keys omitted.
@@ -4,6 +4,8 @@
4
4
  * This function takes an object and an array of keys, and returns a new object that
5
5
  * excludes the properties corresponding to the specified keys.
6
6
  *
7
+ * @template T - The type of object.
8
+ * @template K - The type of keys in object.
7
9
  * @param {T} obj - The object to omit keys from.
8
10
  * @param {K[]} keys - An array of keys to be omitted from the object.
9
11
  * @returns {Omit<T, K>} A new object with the specified keys omitted.