es-toolkit 1.0.3-dev.38 → 1.0.3

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 (470) hide show
  1. package/dist/array/chunk.d.ts +1 -3
  2. package/dist/array/chunk.spec.d.ts +1 -0
  3. package/dist/array/difference.d.ts +1 -3
  4. package/dist/array/difference.spec.d.ts +1 -0
  5. package/dist/array/differenceBy.d.ts +1 -3
  6. package/dist/array/differenceBy.spec.d.ts +1 -0
  7. package/dist/array/differenceWith.d.ts +1 -3
  8. package/dist/array/differenceWith.spec.d.ts +1 -0
  9. package/dist/array/drop.d.ts +1 -3
  10. package/dist/array/drop.spec.d.ts +1 -0
  11. package/dist/array/dropRight.d.ts +1 -3
  12. package/dist/array/dropRight.spec.d.ts +1 -0
  13. package/dist/array/dropRightWhile.d.ts +1 -3
  14. package/dist/array/dropRightWhile.spec.d.ts +1 -0
  15. package/dist/array/dropWhile.d.ts +1 -3
  16. package/dist/array/dropWhile.spec.d.ts +1 -0
  17. package/dist/array/groupBy.d.ts +1 -3
  18. package/dist/array/groupBy.spec.d.ts +1 -0
  19. package/dist/array/index.d.ts +30 -30
  20. package/dist/array/index.js +842 -199
  21. package/dist/array/intersection.d.ts +1 -3
  22. package/dist/array/intersection.spec.d.ts +1 -0
  23. package/dist/array/intersectionBy.d.ts +1 -3
  24. package/dist/array/intersectionBy.spec.d.ts +1 -0
  25. package/dist/array/intersectionWith.d.ts +1 -3
  26. package/dist/array/intersectionWith.spec.d.ts +1 -0
  27. package/dist/array/partition.d.ts +1 -3
  28. package/dist/array/partition.spec.d.ts +1 -0
  29. package/dist/array/sample.d.ts +1 -3
  30. package/dist/array/sample.spec.d.ts +1 -0
  31. package/dist/array/shuffle.d.ts +1 -3
  32. package/dist/array/shuffle.spec.d.ts +1 -0
  33. package/dist/array/take.d.ts +1 -3
  34. package/dist/array/take.spec.d.ts +1 -0
  35. package/dist/array/takeRight.d.ts +1 -3
  36. package/dist/array/takeRight.spec.d.ts +1 -0
  37. package/dist/array/takeRightWhile.d.ts +1 -3
  38. package/dist/array/takeRightWhile.spec.d.ts +1 -0
  39. package/dist/array/takeWhile.d.ts +1 -3
  40. package/dist/array/takeWhile.spec.d.ts +1 -0
  41. package/dist/array/union.d.ts +1 -3
  42. package/dist/array/union.spec.d.ts +1 -0
  43. package/dist/array/unionBy.d.ts +1 -3
  44. package/dist/array/unionBy.spec.d.ts +1 -0
  45. package/dist/array/unionWith.d.ts +1 -3
  46. package/dist/array/unionWith.spec.d.ts +1 -0
  47. package/dist/array/uniq.d.ts +1 -3
  48. package/dist/array/uniq.spec.d.ts +1 -0
  49. package/dist/array/uniqBy.d.ts +1 -3
  50. package/dist/array/uniqBy.spec.d.ts +1 -0
  51. package/dist/array/uniqWith.d.ts +1 -3
  52. package/dist/array/uniqWith.spec.d.ts +1 -0
  53. package/dist/array/xor.d.ts +1 -3
  54. package/dist/array/xor.spec.d.ts +1 -0
  55. package/dist/array/xorBy.d.ts +1 -3
  56. package/dist/array/xorBy.spec.d.ts +1 -0
  57. package/dist/array/xorWith.d.ts +1 -3
  58. package/dist/array/xorWith.spec.d.ts +1 -0
  59. package/dist/array/zip.d.ts +4 -6
  60. package/dist/array/zip.spec.d.ts +1 -0
  61. package/dist/array/zipWith.d.ts +4 -6
  62. package/dist/array/zipWith.spec.d.ts +1 -0
  63. package/dist/function/debounce.d.ts +1 -3
  64. package/dist/function/debounce.spec.d.ts +1 -0
  65. package/dist/function/index.d.ts +3 -3
  66. package/dist/function/index.js +78 -47
  67. package/dist/function/once.d.ts +1 -3
  68. package/dist/function/once.spec.d.ts +1 -0
  69. package/dist/function/throttle.d.ts +1 -3
  70. package/dist/function/throttle.spec.d.ts +1 -0
  71. package/dist/index.d.ts +6 -45
  72. package/dist/index.js +1271 -288
  73. package/dist/math/clamp.d.ts +2 -4
  74. package/dist/math/clamp.spec.d.ts +1 -0
  75. package/dist/math/index.d.ts +3 -3
  76. package/dist/math/index.js +132 -41
  77. package/dist/math/round.d.ts +1 -3
  78. package/dist/math/round.spec.d.ts +1 -0
  79. package/dist/math/sum.d.ts +1 -3
  80. package/dist/math/sum.spec.d.ts +1 -0
  81. package/dist/object/index.d.ts +4 -4
  82. package/dist/object/index.js +256 -62
  83. package/dist/object/omit.d.ts +1 -3
  84. package/dist/object/omit.spec.d.ts +1 -0
  85. package/dist/object/omitBy.d.ts +1 -3
  86. package/dist/object/omitBy.spec.d.ts +1 -0
  87. package/dist/object/pick.d.ts +1 -3
  88. package/dist/object/pick.spec.d.ts +1 -0
  89. package/dist/object/pickBy.d.ts +1 -3
  90. package/dist/object/pickBy.spec.d.ts +1 -0
  91. package/dist/predicate/index.d.ts +4 -4
  92. package/dist/predicate/index.js +84 -42
  93. package/dist/predicate/isNil.d.ts +1 -3
  94. package/dist/predicate/isNil.spec.d.ts +1 -0
  95. package/dist/predicate/isNotNil.d.ts +1 -3
  96. package/dist/predicate/isNotNil.spec.d.ts +1 -0
  97. package/dist/predicate/isNull.d.ts +1 -3
  98. package/dist/predicate/isNull.spec.d.ts +1 -0
  99. package/dist/predicate/isUndefined.d.ts +1 -3
  100. package/dist/predicate/isUndefined.spec.d.ts +1 -0
  101. package/dist/promise/delay.d.ts +1 -3
  102. package/dist/promise/delay.spec.d.ts +1 -0
  103. package/dist/promise/index.d.ts +1 -1
  104. package/dist/promise/index.js +23 -31
  105. package/esm/_virtual/_rollupPluginBabelHelpers.mjs +163 -0
  106. package/esm/array/_virtual/_rollupPluginBabelHelpers.mjs +78 -0
  107. package/{dist/array/chunk.d.mts → esm/array/chunk.mjs} +13 -1
  108. package/{dist/array/difference.d.mts → esm/array/difference.mjs} +12 -8
  109. package/{dist/array/differenceBy.d.mts → esm/array/differenceBy.mjs} +17 -10
  110. package/{dist/array/differenceWith.d.mts → esm/array/differenceWith.mjs} +12 -6
  111. package/{dist/array/drop.d.mts → esm/array/drop.mjs} +6 -4
  112. package/{dist/array/dropRight.d.mts → esm/array/dropRight.mjs} +5 -3
  113. package/{dist/array/dropRightWhile.d.mts → esm/array/dropRightWhile.mjs} +11 -5
  114. package/{dist/array/dropWhile.d.mts → esm/array/dropWhile.mjs} +10 -5
  115. package/{dist/array/groupBy.d.mts → esm/array/groupBy.mjs} +26 -5
  116. package/{dist/array/intersection.d.mts → esm/array/intersection.mjs} +8 -4
  117. package/{dist/array/intersectionBy.d.mts → esm/array/intersectionBy.mjs} +12 -5
  118. package/{dist/array/intersectionWith.d.mts → esm/array/intersectionWith.mjs} +12 -6
  119. package/{dist/array/partition.d.mts → esm/array/partition.mjs} +30 -8
  120. package/{dist/array/sample.d.mts → esm/array/sample.mjs} +5 -2
  121. package/{dist/array/shuffle.d.mts → esm/array/shuffle.mjs} +13 -2
  122. package/{dist/array/take.d.mts → esm/array/take.mjs} +7 -5
  123. package/{dist/array/takeRight.d.mts → esm/array/takeRight.mjs} +10 -5
  124. package/{dist/array/takeRightWhile.d.mts → esm/array/takeRightWhile.mjs} +12 -5
  125. package/{dist/array/takeWhile.d.mts → esm/array/takeWhile.mjs} +21 -1
  126. package/{dist/array/union.d.mts → esm/array/union.mjs} +7 -3
  127. package/{dist/array/unionBy.d.mts → esm/array/unionBy.mjs} +16 -4
  128. package/{dist/array/unionWith.d.mts → esm/array/unionWith.mjs} +8 -4
  129. package/esm/array/uniq.mjs +37 -0
  130. package/{dist/array/uniqBy.d.mts → esm/array/uniqBy.mjs} +7 -1
  131. package/esm/array/uniqWith.mjs +39 -0
  132. package/{dist/array/xor.d.mts → esm/array/xor.mjs} +10 -4
  133. package/{dist/array/xorBy.d.mts → esm/array/xorBy.mjs} +13 -5
  134. package/{dist/array/xorWith.d.mts → esm/array/xorWith.mjs} +13 -5
  135. package/esm/array/zip.mjs +52 -0
  136. package/{dist/array/zipWith.d.mts → esm/array/zipWith.mjs} +26 -6
  137. package/{dist/function/debounce.d.mts → esm/function/debounce.mjs} +18 -5
  138. package/{dist/function/once.d.mts → esm/function/once.mjs} +14 -2
  139. package/{dist/function/throttle.d.mts → esm/function/throttle.mjs} +13 -3
  140. package/esm/math/_virtual/_rollupPluginBabelHelpers.mjs +66 -0
  141. package/{dist/math/clamp.d.mts → esm/math/clamp.mjs} +7 -2
  142. package/{dist/math/round.d.mts → esm/math/round.mjs} +7 -3
  143. package/esm/math/sum.mjs +33 -0
  144. package/esm/object/_virtual/_rollupPluginBabelHelpers.mjs +151 -0
  145. package/{dist/object/omit.d.mts → esm/object/omit.mjs} +19 -2
  146. package/{dist/object/omitBy.d.mts → esm/object/omitBy.mjs} +18 -4
  147. package/{dist/object/pick.d.mts → esm/object/pick.mjs} +19 -2
  148. package/{dist/object/pickBy.d.mts → esm/object/pickBy.mjs} +18 -4
  149. package/{dist/predicate/isNil.d.mts → esm/predicate/isNil.mjs} +6 -4
  150. package/{dist/predicate/isNotNil.d.mts → esm/predicate/isNotNil.mjs} +4 -2
  151. package/{dist/predicate/isNull.d.mts → esm/predicate/isNull.mjs} +6 -4
  152. package/{dist/predicate/isUndefined.d.mts → esm/predicate/isUndefined.mjs} +6 -4
  153. package/{dist/promise/delay.d.mts → esm/promise/delay.mjs} +8 -4
  154. package/package.json +49 -120
  155. package/dist/array/chunk.js +0 -43
  156. package/dist/array/chunk.js.map +0 -1
  157. package/dist/array/chunk.mjs +0 -8
  158. package/dist/array/chunk.mjs.map +0 -1
  159. package/dist/array/difference.js +0 -35
  160. package/dist/array/difference.js.map +0 -1
  161. package/dist/array/difference.mjs +0 -8
  162. package/dist/array/difference.mjs.map +0 -1
  163. package/dist/array/differenceBy.js +0 -36
  164. package/dist/array/differenceBy.js.map +0 -1
  165. package/dist/array/differenceBy.mjs +0 -8
  166. package/dist/array/differenceBy.mjs.map +0 -1
  167. package/dist/array/differenceWith.js +0 -37
  168. package/dist/array/differenceWith.js.map +0 -1
  169. package/dist/array/differenceWith.mjs +0 -8
  170. package/dist/array/differenceWith.mjs.map +0 -1
  171. package/dist/array/drop.js +0 -33
  172. package/dist/array/drop.js.map +0 -1
  173. package/dist/array/drop.mjs +0 -8
  174. package/dist/array/drop.mjs.map +0 -1
  175. package/dist/array/dropRight.js +0 -33
  176. package/dist/array/dropRight.js.map +0 -1
  177. package/dist/array/dropRight.mjs +0 -8
  178. package/dist/array/dropRight.mjs.map +0 -1
  179. package/dist/array/dropRightWhile.js +0 -43
  180. package/dist/array/dropRightWhile.js.map +0 -1
  181. package/dist/array/dropRightWhile.mjs +0 -9
  182. package/dist/array/dropRightWhile.mjs.map +0 -1
  183. package/dist/array/dropWhile.js +0 -34
  184. package/dist/array/dropWhile.js.map +0 -1
  185. package/dist/array/dropWhile.mjs +0 -8
  186. package/dist/array/dropWhile.mjs.map +0 -1
  187. package/dist/array/groupBy.js +0 -41
  188. package/dist/array/groupBy.js.map +0 -1
  189. package/dist/array/groupBy.mjs +0 -8
  190. package/dist/array/groupBy.mjs.map +0 -1
  191. package/dist/array/index.js.map +0 -1
  192. package/dist/array/index.mjs +0 -125
  193. package/dist/array/index.mjs.map +0 -1
  194. package/dist/array/intersection.js +0 -35
  195. package/dist/array/intersection.js.map +0 -1
  196. package/dist/array/intersection.mjs +0 -8
  197. package/dist/array/intersection.mjs.map +0 -1
  198. package/dist/array/intersectionBy.js +0 -36
  199. package/dist/array/intersectionBy.js.map +0 -1
  200. package/dist/array/intersectionBy.mjs +0 -8
  201. package/dist/array/intersectionBy.mjs.map +0 -1
  202. package/dist/array/intersectionWith.js +0 -37
  203. package/dist/array/intersectionWith.js.map +0 -1
  204. package/dist/array/intersectionWith.mjs +0 -8
  205. package/dist/array/intersectionWith.mjs.map +0 -1
  206. package/dist/array/partition.js +0 -42
  207. package/dist/array/partition.js.map +0 -1
  208. package/dist/array/partition.mjs +0 -8
  209. package/dist/array/partition.mjs.map +0 -1
  210. package/dist/array/sample.js +0 -34
  211. package/dist/array/sample.js.map +0 -1
  212. package/dist/array/sample.mjs +0 -8
  213. package/dist/array/sample.mjs.map +0 -1
  214. package/dist/array/shuffle.js +0 -37
  215. package/dist/array/shuffle.js.map +0 -1
  216. package/dist/array/shuffle.mjs +0 -8
  217. package/dist/array/shuffle.mjs.map +0 -1
  218. package/dist/array/take.js +0 -33
  219. package/dist/array/take.js.map +0 -1
  220. package/dist/array/take.mjs +0 -8
  221. package/dist/array/take.mjs.map +0 -1
  222. package/dist/array/takeRight.js +0 -36
  223. package/dist/array/takeRight.js.map +0 -1
  224. package/dist/array/takeRight.mjs +0 -8
  225. package/dist/array/takeRight.mjs.map +0 -1
  226. package/dist/array/takeRightWhile.js +0 -38
  227. package/dist/array/takeRightWhile.js.map +0 -1
  228. package/dist/array/takeRightWhile.mjs +0 -8
  229. package/dist/array/takeRightWhile.mjs.map +0 -1
  230. package/dist/array/takeWhile.js +0 -40
  231. package/dist/array/takeWhile.js.map +0 -1
  232. package/dist/array/takeWhile.mjs +0 -8
  233. package/dist/array/takeWhile.mjs.map +0 -1
  234. package/dist/array/union.js +0 -47
  235. package/dist/array/union.js.map +0 -1
  236. package/dist/array/union.mjs +0 -9
  237. package/dist/array/union.mjs.map +0 -1
  238. package/dist/array/unionBy.js +0 -40
  239. package/dist/array/unionBy.js.map +0 -1
  240. package/dist/array/unionBy.mjs +0 -8
  241. package/dist/array/unionBy.mjs.map +0 -1
  242. package/dist/array/unionWith.js +0 -47
  243. package/dist/array/unionWith.js.map +0 -1
  244. package/dist/array/unionWith.mjs +0 -9
  245. package/dist/array/unionWith.mjs.map +0 -1
  246. package/dist/array/uniq.d.mts +0 -17
  247. package/dist/array/uniq.js +0 -40
  248. package/dist/array/uniq.js.map +0 -1
  249. package/dist/array/uniq.mjs +0 -8
  250. package/dist/array/uniq.mjs.map +0 -1
  251. package/dist/array/uniqBy.js +0 -47
  252. package/dist/array/uniqBy.js.map +0 -1
  253. package/dist/array/uniqBy.mjs +0 -9
  254. package/dist/array/uniqBy.mjs.map +0 -1
  255. package/dist/array/uniqWith.d.mts +0 -14
  256. package/dist/array/uniqWith.js +0 -40
  257. package/dist/array/uniqWith.js.map +0 -1
  258. package/dist/array/uniqWith.mjs +0 -8
  259. package/dist/array/uniqWith.mjs.map +0 -1
  260. package/dist/array/xor.js +0 -66
  261. package/dist/array/xor.js.map +0 -1
  262. package/dist/array/xor.mjs +0 -12
  263. package/dist/array/xor.mjs.map +0 -1
  264. package/dist/array/xorBy.js +0 -65
  265. package/dist/array/xorBy.js.map +0 -1
  266. package/dist/array/xorBy.mjs +0 -11
  267. package/dist/array/xorBy.mjs.map +0 -1
  268. package/dist/array/xorWith.js +0 -72
  269. package/dist/array/xorWith.js.map +0 -1
  270. package/dist/array/xorWith.mjs +0 -12
  271. package/dist/array/xorWith.mjs.map +0 -1
  272. package/dist/array/zip.d.mts +0 -27
  273. package/dist/array/zip.js +0 -42
  274. package/dist/array/zip.js.map +0 -1
  275. package/dist/array/zip.mjs +0 -8
  276. package/dist/array/zip.mjs.map +0 -1
  277. package/dist/array/zipWith.js +0 -41
  278. package/dist/array/zipWith.js.map +0 -1
  279. package/dist/array/zipWith.mjs +0 -8
  280. package/dist/array/zipWith.mjs.map +0 -1
  281. package/dist/chunk-2KXLTAVK.mjs +0 -16
  282. package/dist/chunk-2KXLTAVK.mjs.map +0 -1
  283. package/dist/chunk-2MM5EJJX.mjs +0 -21
  284. package/dist/chunk-2MM5EJJX.mjs.map +0 -1
  285. package/dist/chunk-2VB6XU3I.mjs +0 -12
  286. package/dist/chunk-2VB6XU3I.mjs.map +0 -1
  287. package/dist/chunk-35TWSMYS.mjs +0 -19
  288. package/dist/chunk-35TWSMYS.mjs.map +0 -1
  289. package/dist/chunk-5JWSGT4R.mjs +0 -18
  290. package/dist/chunk-5JWSGT4R.mjs.map +0 -1
  291. package/dist/chunk-724PNXPR.mjs +0 -13
  292. package/dist/chunk-724PNXPR.mjs.map +0 -1
  293. package/dist/chunk-7GWOR247.mjs +0 -11
  294. package/dist/chunk-7GWOR247.mjs.map +0 -1
  295. package/dist/chunk-7OZZODAE.mjs +0 -19
  296. package/dist/chunk-7OZZODAE.mjs.map +0 -1
  297. package/dist/chunk-7PPND7QY.mjs +0 -16
  298. package/dist/chunk-7PPND7QY.mjs.map +0 -1
  299. package/dist/chunk-7SJHJHBN.mjs +0 -11
  300. package/dist/chunk-7SJHJHBN.mjs.map +0 -1
  301. package/dist/chunk-ARWKEQMQ.mjs +0 -19
  302. package/dist/chunk-ARWKEQMQ.mjs.map +0 -1
  303. package/dist/chunk-ARZ5BDR6.mjs +0 -1
  304. package/dist/chunk-ARZ5BDR6.mjs.map +0 -1
  305. package/dist/chunk-BAJC3BM7.mjs +0 -12
  306. package/dist/chunk-BAJC3BM7.mjs.map +0 -1
  307. package/dist/chunk-EAI4DDCQ.mjs +0 -16
  308. package/dist/chunk-EAI4DDCQ.mjs.map +0 -1
  309. package/dist/chunk-EAI6NLXI.mjs +0 -12
  310. package/dist/chunk-EAI6NLXI.mjs.map +0 -1
  311. package/dist/chunk-EJGAXTF7.mjs +0 -1
  312. package/dist/chunk-EJGAXTF7.mjs.map +0 -1
  313. package/dist/chunk-FUWEG5ZM.mjs +0 -9
  314. package/dist/chunk-FUWEG5ZM.mjs.map +0 -1
  315. package/dist/chunk-GJM7F3TH.mjs +0 -13
  316. package/dist/chunk-GJM7F3TH.mjs.map +0 -1
  317. package/dist/chunk-HQF6OFGM.mjs +0 -9
  318. package/dist/chunk-HQF6OFGM.mjs.map +0 -1
  319. package/dist/chunk-IJLQVGW4.mjs +0 -1
  320. package/dist/chunk-IJLQVGW4.mjs.map +0 -1
  321. package/dist/chunk-J3NTLMAE.mjs +0 -10
  322. package/dist/chunk-J3NTLMAE.mjs.map +0 -1
  323. package/dist/chunk-JMLFPGZ3.mjs +0 -13
  324. package/dist/chunk-JMLFPGZ3.mjs.map +0 -1
  325. package/dist/chunk-L4Y3G6AJ.mjs +0 -23
  326. package/dist/chunk-L4Y3G6AJ.mjs.map +0 -1
  327. package/dist/chunk-LAZNLIBJ.mjs +0 -10
  328. package/dist/chunk-LAZNLIBJ.mjs.map +0 -1
  329. package/dist/chunk-MAJSPFA6.mjs +0 -1
  330. package/dist/chunk-MAJSPFA6.mjs.map +0 -1
  331. package/dist/chunk-NEMQJ2GF.mjs +0 -18
  332. package/dist/chunk-NEMQJ2GF.mjs.map +0 -1
  333. package/dist/chunk-NK2262VG.mjs +0 -9
  334. package/dist/chunk-NK2262VG.mjs.map +0 -1
  335. package/dist/chunk-NSYWEYWT.mjs +0 -13
  336. package/dist/chunk-NSYWEYWT.mjs.map +0 -1
  337. package/dist/chunk-NYVT33DR.mjs +0 -9
  338. package/dist/chunk-NYVT33DR.mjs.map +0 -1
  339. package/dist/chunk-OBMK7JO2.mjs +0 -13
  340. package/dist/chunk-OBMK7JO2.mjs.map +0 -1
  341. package/dist/chunk-PTQLD7TG.mjs +0 -11
  342. package/dist/chunk-PTQLD7TG.mjs.map +0 -1
  343. package/dist/chunk-PWMHSN27.mjs +0 -14
  344. package/dist/chunk-PWMHSN27.mjs.map +0 -1
  345. package/dist/chunk-QRQPLMV4.mjs +0 -16
  346. package/dist/chunk-QRQPLMV4.mjs.map +0 -1
  347. package/dist/chunk-R5DNKXDI.mjs +0 -21
  348. package/dist/chunk-R5DNKXDI.mjs.map +0 -1
  349. package/dist/chunk-RK6PRCEJ.mjs +0 -12
  350. package/dist/chunk-RK6PRCEJ.mjs.map +0 -1
  351. package/dist/chunk-RLDY4N3Q.mjs +0 -13
  352. package/dist/chunk-RLDY4N3Q.mjs.map +0 -1
  353. package/dist/chunk-RU3RXBUC.mjs +0 -17
  354. package/dist/chunk-RU3RXBUC.mjs.map +0 -1
  355. package/dist/chunk-S767XFOS.mjs +0 -10
  356. package/dist/chunk-S767XFOS.mjs.map +0 -1
  357. package/dist/chunk-SGSQKXDO.mjs +0 -15
  358. package/dist/chunk-SGSQKXDO.mjs.map +0 -1
  359. package/dist/chunk-SYQTG4N4.mjs +0 -1
  360. package/dist/chunk-SYQTG4N4.mjs.map +0 -1
  361. package/dist/chunk-T5JCRGXA.mjs +0 -1
  362. package/dist/chunk-T5JCRGXA.mjs.map +0 -1
  363. package/dist/chunk-TOLR2FNF.mjs +0 -13
  364. package/dist/chunk-TOLR2FNF.mjs.map +0 -1
  365. package/dist/chunk-UNX3KZO2.mjs +0 -17
  366. package/dist/chunk-UNX3KZO2.mjs.map +0 -1
  367. package/dist/chunk-UZP4YX7I.mjs +0 -17
  368. package/dist/chunk-UZP4YX7I.mjs.map +0 -1
  369. package/dist/chunk-VACGGQOL.mjs +0 -9
  370. package/dist/chunk-VACGGQOL.mjs.map +0 -1
  371. package/dist/chunk-VAKCSKGR.mjs +0 -17
  372. package/dist/chunk-VAKCSKGR.mjs.map +0 -1
  373. package/dist/chunk-VJGGYY4Y.mjs +0 -13
  374. package/dist/chunk-VJGGYY4Y.mjs.map +0 -1
  375. package/dist/chunk-WFQ3LAHQ.mjs +0 -9
  376. package/dist/chunk-WFQ3LAHQ.mjs.map +0 -1
  377. package/dist/chunk-XS4ZPJMT.mjs +0 -21
  378. package/dist/chunk-XS4ZPJMT.mjs.map +0 -1
  379. package/dist/chunk-XW452I77.mjs +0 -16
  380. package/dist/chunk-XW452I77.mjs.map +0 -1
  381. package/dist/chunk-YMNXRH52.mjs +0 -9
  382. package/dist/chunk-YMNXRH52.mjs.map +0 -1
  383. package/dist/chunk-Z4IO7EIH.mjs +0 -16
  384. package/dist/chunk-Z4IO7EIH.mjs.map +0 -1
  385. package/dist/function/debounce.js +0 -47
  386. package/dist/function/debounce.js.map +0 -1
  387. package/dist/function/debounce.mjs +0 -8
  388. package/dist/function/debounce.mjs.map +0 -1
  389. package/dist/function/index.js.map +0 -1
  390. package/dist/function/index.mjs +0 -17
  391. package/dist/function/index.mjs.map +0 -1
  392. package/dist/function/once.js +0 -43
  393. package/dist/function/once.js.map +0 -1
  394. package/dist/function/once.mjs +0 -8
  395. package/dist/function/once.mjs.map +0 -1
  396. package/dist/function/throttle.js +0 -41
  397. package/dist/function/throttle.js.map +0 -1
  398. package/dist/function/throttle.mjs +0 -8
  399. package/dist/function/throttle.mjs.map +0 -1
  400. package/dist/index.js.map +0 -1
  401. package/dist/index.mjs +0 -190
  402. package/dist/index.mjs.map +0 -1
  403. package/dist/math/clamp.js +0 -36
  404. package/dist/math/clamp.js.map +0 -1
  405. package/dist/math/clamp.mjs +0 -8
  406. package/dist/math/clamp.mjs.map +0 -1
  407. package/dist/math/index.js.map +0 -1
  408. package/dist/math/index.mjs +0 -17
  409. package/dist/math/index.mjs.map +0 -1
  410. package/dist/math/round.js +0 -34
  411. package/dist/math/round.js.map +0 -1
  412. package/dist/math/round.mjs +0 -8
  413. package/dist/math/round.mjs.map +0 -1
  414. package/dist/math/sum.d.mts +0 -16
  415. package/dist/math/sum.js +0 -37
  416. package/dist/math/sum.js.map +0 -1
  417. package/dist/math/sum.mjs +0 -8
  418. package/dist/math/sum.mjs.map +0 -1
  419. package/dist/object/index.js.map +0 -1
  420. package/dist/object/index.mjs +0 -21
  421. package/dist/object/index.mjs.map +0 -1
  422. package/dist/object/omit.js +0 -51
  423. package/dist/object/omit.js.map +0 -1
  424. package/dist/object/omit.mjs +0 -8
  425. package/dist/object/omit.mjs.map +0 -1
  426. package/dist/object/omitBy.js +0 -40
  427. package/dist/object/omitBy.js.map +0 -1
  428. package/dist/object/omitBy.mjs +0 -8
  429. package/dist/object/omitBy.mjs.map +0 -1
  430. package/dist/object/pick.js +0 -37
  431. package/dist/object/pick.js.map +0 -1
  432. package/dist/object/pick.mjs +0 -8
  433. package/dist/object/pick.mjs.map +0 -1
  434. package/dist/object/pickBy.js +0 -40
  435. package/dist/object/pickBy.js.map +0 -1
  436. package/dist/object/pickBy.mjs +0 -8
  437. package/dist/object/pickBy.mjs.map +0 -1
  438. package/dist/predicate/index.js.map +0 -1
  439. package/dist/predicate/index.mjs +0 -21
  440. package/dist/predicate/index.mjs.map +0 -1
  441. package/dist/predicate/isNil.js +0 -33
  442. package/dist/predicate/isNil.js.map +0 -1
  443. package/dist/predicate/isNil.mjs +0 -8
  444. package/dist/predicate/isNil.mjs.map +0 -1
  445. package/dist/predicate/isNotNil.js +0 -33
  446. package/dist/predicate/isNotNil.js.map +0 -1
  447. package/dist/predicate/isNotNil.mjs +0 -8
  448. package/dist/predicate/isNotNil.mjs.map +0 -1
  449. package/dist/predicate/isNull.js +0 -33
  450. package/dist/predicate/isNull.js.map +0 -1
  451. package/dist/predicate/isNull.mjs +0 -8
  452. package/dist/predicate/isNull.mjs.map +0 -1
  453. package/dist/predicate/isUndefined.js +0 -33
  454. package/dist/predicate/isUndefined.js.map +0 -1
  455. package/dist/predicate/isUndefined.mjs +0 -8
  456. package/dist/predicate/isUndefined.mjs.map +0 -1
  457. package/dist/promise/delay.js +0 -35
  458. package/dist/promise/delay.js.map +0 -1
  459. package/dist/promise/delay.mjs +0 -8
  460. package/dist/promise/delay.mjs.map +0 -1
  461. package/dist/promise/index.js.map +0 -1
  462. package/dist/promise/index.mjs +0 -9
  463. package/dist/promise/index.mjs.map +0 -1
  464. /package/{dist/array/index.d.mts → esm/array/index.mjs} +0 -0
  465. /package/{dist/function/index.d.mts → esm/function/index.mjs} +0 -0
  466. /package/{dist/index.d.mts → esm/index.mjs} +0 -0
  467. /package/{dist/math/index.d.mts → esm/math/index.mjs} +0 -0
  468. /package/{dist/object/index.d.mts → esm/object/index.mjs} +0 -0
  469. /package/{dist/predicate/index.d.mts → esm/predicate/index.mjs} +0 -0
  470. /package/{dist/promise/index.d.mts → esm/promise/index.mjs} +0 -0
package/dist/index.js CHANGED
@@ -1,221 +1,647 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, { get: all[name], enumerable: true });
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
-
34
- // src/index.ts
35
- var src_exports = {};
36
- __export(src_exports, {
37
- chunk: () => chunk,
38
- clamp: () => clamp,
39
- debounce: () => debounce,
40
- delay: () => delay,
41
- difference: () => difference,
42
- differenceBy: () => differenceBy,
43
- differenceWith: () => differenceWith,
44
- drop: () => drop,
45
- dropRight: () => dropRight,
46
- dropRightWhile: () => dropRightWhile,
47
- dropWhile: () => dropWhile,
48
- groupBy: () => groupBy,
49
- intersection: () => intersection,
50
- intersectionBy: () => intersectionBy,
51
- intersectionWith: () => intersectionWith,
52
- isNil: () => isNil,
53
- isNotNil: () => isNotNil,
54
- isNull: () => isNull,
55
- isUndefined: () => isUndefined,
56
- omit: () => omit,
57
- omitBy: () => omitBy,
58
- once: () => once,
59
- partition: () => partition,
60
- pick: () => pick,
61
- pickBy: () => pickBy,
62
- round: () => round,
63
- sample: () => sample,
64
- shuffle: () => shuffle,
65
- sum: () => sum,
66
- take: () => take,
67
- takeRight: () => takeRight,
68
- takeRightWhile: () => takeRightWhile,
69
- takeWhile: () => takeWhile,
70
- throttle: () => throttle,
71
- union: () => union,
72
- unionBy: () => unionBy,
73
- unionWith: () => unionWith,
74
- uniq: () => uniq,
75
- uniqBy: () => uniqBy,
76
- uniqWith: () => uniqWith,
77
- xor: () => xor,
78
- xorBy: () => xorBy,
79
- xorWith: () => xorWith,
80
- zip: () => zip,
81
- zipWith: () => zipWith
82
- });
83
- module.exports = __toCommonJS(src_exports);
84
-
85
- // src/array/chunk.ts
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * Splits an array into smaller arrays of a specified length.
7
+ *
8
+ * This function takes an input array and divides it into multiple smaller arrays,
9
+ * each of a specified length. If the input array cannot be evenly divided,
10
+ * the final sub-array will contain the remaining elements.
11
+ *
12
+ * @template T The type of elements in the array.
13
+ * @param {T[]} arr - The array to be chunked into smaller arrays.
14
+ * @param {number} size - The size of each smaller array. Must be a positive integer.
15
+ * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.
16
+ * @throws {Error} Throws an error if `size` is not a positive integer.
17
+ *
18
+ * @example
19
+ * // Splits an array of numbers into sub-arrays of length 2
20
+ * chunk([1, 2, 3, 4, 5], 2);
21
+ * // Returns: [[1, 2], [3, 4], [5]]
22
+ *
23
+ * @example
24
+ * // Splits an array of strings into sub-arrays of length 3
25
+ * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);
26
+ * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
27
+ */
86
28
  function chunk(arr, size) {
87
29
  if (!Number.isInteger(size) || size <= 0) {
88
- throw new Error("Size must be an integer greater than zero.");
30
+ throw new Error('Size must be an integer greater than zero.');
89
31
  }
90
- const chunkLength = Math.ceil(arr.length / size);
91
- const result = Array(chunkLength);
92
- for (let index = 0; index < chunkLength; index++) {
93
- const start = index * size;
94
- const end = start + size;
32
+ var chunkLength = Math.ceil(arr.length / size);
33
+ var result = Array(chunkLength);
34
+ for (var index = 0; index < chunkLength; index++) {
35
+ var start = index * size;
36
+ var end = start + size;
95
37
  result[index] = arr.slice(start, end);
96
38
  }
97
39
  return result;
98
40
  }
99
41
 
100
- // src/array/difference.ts
42
+ /**
43
+ * Computes the difference between two arrays.
44
+ *
45
+ * This function takes two arrays and returns a new array containing the elements
46
+ * that are present in the first array but not in the second array. It effectively
47
+ * filters out any elements from the first array that also appear in the second array.
48
+ *
49
+ * @template T
50
+ * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array
51
+ * from which elements will be compared and filtered.
52
+ * @param {T[]} secondArr - The array containing elements to be excluded from the first array.
53
+ * Each element in this array will be checked against the first array, and if a match is found,
54
+ * that element will be excluded from the result.
55
+ * @returns {T[]} A new array containing the elements that are present in the first array but not
56
+ * in the second array.
57
+ *
58
+ * @example
59
+ * * const array1 = [1, 2, 3, 4, 5];
60
+ * const array2 = [2, 4];
61
+ * const result = difference(array1, array2);
62
+ * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.
63
+ */
101
64
  function difference(firstArr, secondArr) {
102
- return firstArr.filter((item) => {
65
+ return firstArr.filter(function (item) {
103
66
  return !secondArr.includes(item);
104
67
  });
105
68
  }
106
69
 
107
- // src/array/differenceBy.ts
70
+ /**
71
+ * Computes the difference between two arrays after mapping their elements through a provided function.
72
+ *
73
+ * This function takes two arrays and a mapper function. It returns a new array containing the elements
74
+ * that are present in the first array but not in the second array, based on the identity calculated
75
+ * by the mapper function.
76
+ *
77
+ * Essentially, it filters out any elements from the first array that, when
78
+ * mapped, match an element in the mapped version of the second array.
79
+ *
80
+ * @template T, U
81
+ * @param {T[]} firstArr - The primary array from which to derive the difference.
82
+ * @param {T[]} secondArr - The array containing elements to be excluded from the first array.
83
+ * @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function
84
+ * is applied to each element in both arrays, and the comparison is made based on the mapped values.
85
+ * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding
86
+ * mapped identity in the second array.
87
+ *
88
+ * @example
89
+ * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
90
+ * const array2 = [{ id: 2 }, { id: 4 }];
91
+ * const mapper = item => item.id;
92
+ * const result = differenceBy(array1, array2, mapper);
93
+ * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.
94
+ */
108
95
  function differenceBy(firstArr, secondArr, mapper) {
109
- const mappedSecondArr = secondArr.map((item) => mapper(item));
110
- return firstArr.filter((item) => {
96
+ var mappedSecondArr = secondArr.map(function (item) {
97
+ return mapper(item);
98
+ });
99
+ return firstArr.filter(function (item) {
111
100
  return !mappedSecondArr.includes(mapper(item));
112
101
  });
113
102
  }
114
103
 
115
- // src/array/differenceWith.ts
104
+ /**
105
+ * Computes the difference between two arrays based on a custom equality function.
106
+ *
107
+ * This function takes two arrays and a custom comparison function. It returns a new array containing
108
+ * the elements that are present in the first array but not in the second array. The comparison to determine
109
+ * if elements are equal is made using the provided custom function.
110
+ *
111
+ * @template T
112
+ * @param {T[]} firstArr - The array from which to get the difference.
113
+ * @param {T[]} secondArr - The array containing elements to exclude from the first array.
114
+ * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.
115
+ * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array
116
+ * according to the custom equality function.
117
+ *
118
+ * @example
119
+ * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
120
+ * const array2 = [{ id: 2 }, { id: 4 }];
121
+ * const areItemsEqual = (a, b) => a.id === b.id;
122
+ * const result = differenceWith(array1, array2, areItemsEqual);
123
+ * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.
124
+ */
116
125
  function differenceWith(firstArr, secondArr, areItemsEqual) {
117
- return firstArr.filter((firstItem) => {
118
- return secondArr.every((secondItem) => {
126
+ return firstArr.filter(function (firstItem) {
127
+ return secondArr.every(function (secondItem) {
119
128
  return !areItemsEqual(firstItem, secondItem);
120
129
  });
121
130
  });
122
131
  }
123
132
 
124
- // src/array/drop.ts
133
+ /**
134
+ * Removes a specified number of elements from the beginning of an array and returns the rest.
135
+ *
136
+ * This function takes an array and a number, and returns a new array with the specified number
137
+ * of elements removed from the start.
138
+ *
139
+ * @param {T[]} arr - The array from which to drop elements.
140
+ * @param {number} itemsCount - The number of elements to drop from the beginning of the array.
141
+ * @returns {T[]} A new array with the specified number of elements removed from the start.
142
+ *
143
+ * @example
144
+ * * const array = [1, 2, 3, 4, 5];
145
+ * const result = drop(array, 2);
146
+ * // result will be [3, 4, 5] since the first two elements are dropped.
147
+ */
125
148
  function drop(arr, itemsCount) {
126
149
  return arr.slice(itemsCount);
127
150
  }
128
151
 
129
- // src/array/dropRight.ts
152
+ /**
153
+ * Removes a specified number of elements from the end of an array and returns the rest.
154
+ *
155
+ * This function takes an array and a number, and returns a new array with the specified number
156
+ * of elements removed from the end.
157
+ *
158
+ * @param {T[]} arr - The array from which to drop elements.
159
+ * @param {number} itemsCount - The number of elements to drop from the end of the array.
160
+ * @returns {T[]} A new array with the specified number of elements removed from the end.
161
+ *
162
+ * @example
163
+ * * const array = [1, 2, 3, 4, 5];
164
+ * const result = dropRight(array, 2);
165
+ * // result will be [1, 2, 3] since the last two elements are dropped.
166
+ */
130
167
  function dropRight(arr, itemsCount) {
131
168
  return arr.slice(0, -itemsCount);
132
169
  }
133
170
 
134
- // src/array/dropWhile.ts
171
+ /**
172
+ * Removes elements from the beginning of an array until the predicate returns false.
173
+ *
174
+ * This function iterates over an array and drops elements from the start until the provided
175
+ * predicate function returns false. It then returns a new array with the remaining elements.
176
+ *
177
+ * @param {T[]} arr - The array from which to drop elements.
178
+ * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
179
+ * whether to continue dropping elements. The function is called with each element, and dropping
180
+ * continues as long as it returns true.
181
+ * @returns {T[]} A new array with the elements remaining after the predicate returns false.
182
+ *
183
+ * @example
184
+ * const array = [1, 2, 3, 4, 5];
185
+ * const result = dropWhile(array, x => x < 3);
186
+ * // result will be [3, 4, 5] since elements less than 3 are dropped.
187
+ */
135
188
  function dropWhile(arr, canContinueDropping) {
136
- const dropEndIndex = arr.findIndex((item) => !canContinueDropping(item));
189
+ var dropEndIndex = arr.findIndex(function (item) {
190
+ return !canContinueDropping(item);
191
+ });
137
192
  return arr.slice(dropEndIndex);
138
193
  }
139
194
 
140
- // src/array/dropRightWhile.ts
195
+ /**
196
+ * Removes elements from the end of an array until the predicate returns false.
197
+ *
198
+ * This function iterates over an array from the end and drops elements until the provided
199
+ * predicate function returns false. It then returns a new array with the remaining elements.
200
+ *
201
+ * @param {T[]} arr - The array from which to drop elements.
202
+ * @param {function(item: T): boolean} canContinueDropping - A predicate function that determines
203
+ * whether to continue dropping elements. The function is called with each element from the end,
204
+ * and dropping continues as long as it returns true.
205
+ * @returns {T[]} A new array with the elements remaining after the predicate returns false.
206
+ *
207
+ * @example
208
+ * const array = [1, 2, 3, 4, 5];
209
+ * const result = dropRightWhile(array, x => x > 3);
210
+ * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.
211
+ */
141
212
  function dropRightWhile(arr, canContinueDropping) {
142
- const reversed = arr.slice().reverse();
143
- const dropped = dropWhile(reversed, canContinueDropping);
213
+ var reversed = arr.slice().reverse();
214
+ var dropped = dropWhile(reversed, canContinueDropping);
144
215
  return dropped.slice().reverse();
145
216
  }
146
217
 
147
- // src/array/groupBy.ts
218
+ function _iterableToArrayLimit(r, l) {
219
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
220
+ if (null != t) {
221
+ var e,
222
+ n,
223
+ i,
224
+ u,
225
+ a = [],
226
+ f = !0,
227
+ o = !1;
228
+ try {
229
+ if (i = (t = t.call(r)).next, 0 === l) {
230
+ if (Object(t) !== t) return;
231
+ f = !1;
232
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
233
+ } catch (r) {
234
+ o = !0, n = r;
235
+ } finally {
236
+ try {
237
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
238
+ } finally {
239
+ if (o) throw n;
240
+ }
241
+ }
242
+ return a;
243
+ }
244
+ }
245
+ function ownKeys(e, r) {
246
+ var t = Object.keys(e);
247
+ if (Object.getOwnPropertySymbols) {
248
+ var o = Object.getOwnPropertySymbols(e);
249
+ r && (o = o.filter(function (r) {
250
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
251
+ })), t.push.apply(t, o);
252
+ }
253
+ return t;
254
+ }
255
+ function _objectSpread2(e) {
256
+ for (var r = 1; r < arguments.length; r++) {
257
+ var t = null != arguments[r] ? arguments[r] : {};
258
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
259
+ _defineProperty(e, r, t[r]);
260
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
261
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
262
+ });
263
+ }
264
+ return e;
265
+ }
266
+ function _toPrimitive(t, r) {
267
+ if ("object" != typeof t || !t) return t;
268
+ var e = t[Symbol.toPrimitive];
269
+ if (void 0 !== e) {
270
+ var i = e.call(t, r || "default");
271
+ if ("object" != typeof i) return i;
272
+ throw new TypeError("@@toPrimitive must return a primitive value.");
273
+ }
274
+ return ("string" === r ? String : Number)(t);
275
+ }
276
+ function _toPropertyKey(t) {
277
+ var i = _toPrimitive(t, "string");
278
+ return "symbol" == typeof i ? i : i + "";
279
+ }
280
+ function _defineProperty(obj, key, value) {
281
+ key = _toPropertyKey(key);
282
+ if (key in obj) {
283
+ Object.defineProperty(obj, key, {
284
+ value: value,
285
+ enumerable: true,
286
+ configurable: true,
287
+ writable: true
288
+ });
289
+ } else {
290
+ obj[key] = value;
291
+ }
292
+ return obj;
293
+ }
294
+ function _slicedToArray(arr, i) {
295
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
296
+ }
297
+ function _toConsumableArray(arr) {
298
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
299
+ }
300
+ function _arrayWithoutHoles(arr) {
301
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
302
+ }
303
+ function _arrayWithHoles(arr) {
304
+ if (Array.isArray(arr)) return arr;
305
+ }
306
+ function _iterableToArray(iter) {
307
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
308
+ }
309
+ function _unsupportedIterableToArray(o, minLen) {
310
+ if (!o) return;
311
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
312
+ var n = Object.prototype.toString.call(o).slice(8, -1);
313
+ if (n === "Object" && o.constructor) n = o.constructor.name;
314
+ if (n === "Map" || n === "Set") return Array.from(o);
315
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
316
+ }
317
+ function _arrayLikeToArray(arr, len) {
318
+ if (len == null || len > arr.length) len = arr.length;
319
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
320
+ return arr2;
321
+ }
322
+ function _nonIterableSpread() {
323
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
324
+ }
325
+ function _nonIterableRest() {
326
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
327
+ }
328
+ function _createForOfIteratorHelper(o, allowArrayLike) {
329
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
330
+ if (!it) {
331
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
332
+ if (it) o = it;
333
+ var i = 0;
334
+ var F = function () {};
335
+ return {
336
+ s: F,
337
+ n: function () {
338
+ if (i >= o.length) return {
339
+ done: true
340
+ };
341
+ return {
342
+ done: false,
343
+ value: o[i++]
344
+ };
345
+ },
346
+ e: function (e) {
347
+ throw e;
348
+ },
349
+ f: F
350
+ };
351
+ }
352
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
353
+ }
354
+ var normalCompletion = true,
355
+ didErr = false,
356
+ err;
357
+ return {
358
+ s: function () {
359
+ it = it.call(o);
360
+ },
361
+ n: function () {
362
+ var step = it.next();
363
+ normalCompletion = step.done;
364
+ return step;
365
+ },
366
+ e: function (e) {
367
+ didErr = true;
368
+ err = e;
369
+ },
370
+ f: function () {
371
+ try {
372
+ if (!normalCompletion && it.return != null) it.return();
373
+ } finally {
374
+ if (didErr) throw err;
375
+ }
376
+ }
377
+ };
378
+ }
379
+
380
+ /**
381
+ * Groups the elements of an array based on a provided key-generating function.
382
+ *
383
+ * This function takes an array and a function that generates a key from each element. It returns
384
+ * an object where the keys are the generated keys and the values are arrays of elements that share
385
+ * the same key.
386
+ *
387
+ * @param {T[]} arr - The array to group.
388
+ * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.
389
+ * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that
390
+ * share that key.
391
+ *
392
+ * @example
393
+ * const array = [
394
+ * { category: 'fruit', name: 'apple' },
395
+ * { category: 'fruit', name: 'banana' },
396
+ * { category: 'vegetable', name: 'carrot' }
397
+ * ];
398
+ * const result = groupBy(array, item => item.category);
399
+ * // result will be:
400
+ * // {
401
+ * // fruit: [
402
+ * // { category: 'fruit', name: 'apple' },
403
+ * // { category: 'fruit', name: 'banana' }
404
+ * // ],
405
+ * // vegetable: [
406
+ * // { category: 'vegetable', name: 'carrot' }
407
+ * // ]
408
+ * // }
409
+ */
148
410
  function groupBy(arr, getKeyFromItem) {
149
- const result = {};
150
- for (const item of arr) {
151
- const key = getKeyFromItem(item);
152
- if (result[key] == null) {
153
- result[key] = [];
411
+ var result = {};
412
+ var _iterator = _createForOfIteratorHelper(arr),
413
+ _step;
414
+ try {
415
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
416
+ var item = _step.value;
417
+ var key = getKeyFromItem(item);
418
+ if (result[key] == null) {
419
+ result[key] = [];
420
+ }
421
+ result[key].push(item);
154
422
  }
155
- result[key].push(item);
423
+ } catch (err) {
424
+ _iterator.e(err);
425
+ } finally {
426
+ _iterator.f();
156
427
  }
157
428
  return result;
158
429
  }
159
430
 
160
- // src/array/intersection.ts
431
+ /**
432
+ * Returns the intersection of two arrays.
433
+ *
434
+ * This function takes two arrays and returns a new array containing the elements that are
435
+ * present in both arrays. It effectively filters out any elements from the first array that
436
+ * are not found in the second array.
437
+ *
438
+ * @param {T[]} firstArr - The first array to compare.
439
+ * @param {T[]} secondArr - The second array to compare.
440
+ * @returns {T[]} A new array containing the elements that are present in both arrays.
441
+ *
442
+ * @example
443
+ * const array1 = [1, 2, 3, 4, 5];
444
+ * const array2 = [3, 4, 5, 6, 7];
445
+ * const result = intersection(array1, array2);
446
+ * // result will be [3, 4, 5] since these elements are in both arrays.
447
+ */
161
448
  function intersection(firstArr, secondArr) {
162
- return firstArr.filter((item) => {
449
+ return firstArr.filter(function (item) {
163
450
  return secondArr.includes(item);
164
451
  });
165
452
  }
166
453
 
167
- // src/array/intersectionBy.ts
454
+ /**
455
+ * Returns the intersection of two arrays based on a mapping function.
456
+ *
457
+ * This function takes two arrays and a mapping function. It returns a new array containing
458
+ * the elements from the first array that, when mapped using the provided function, have matching
459
+ * mapped elements in the second array. It effectively filters out any elements from the first array
460
+ * that do not have corresponding mapped values in the second array.
461
+ *
462
+ * @param {T[]} firstArr - The first array to compare.
463
+ * @param {T[]} secondArr - The second array to compare.
464
+ * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.
465
+ * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.
466
+ *
467
+ * @example
468
+ * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
469
+ * const array2 = [{ id: 2 }, { id: 4 }];
470
+ * const mapper = item => item.id;
471
+ * const result = intersectionBy(array1, array2, mapper);
472
+ * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.
473
+ */
168
474
  function intersectionBy(firstArr, secondArr, mapper) {
169
- const mappedSecondArr = secondArr.map((x) => mapper(x));
170
- return firstArr.filter((item) => {
475
+ var mappedSecondArr = secondArr.map(function (x) {
476
+ return mapper(x);
477
+ });
478
+ return firstArr.filter(function (item) {
171
479
  return mappedSecondArr.includes(mapper(item));
172
480
  });
173
481
  }
174
482
 
175
- // src/array/intersectionWith.ts
483
+ /**
484
+ * Returns the intersection of two arrays based on a custom equality function.
485
+ *
486
+ * This function takes two arrays and a custom equality function. It returns a new array containing
487
+ * the elements from the first array that have matching elements in the second array, as determined
488
+ * by the custom equality function. It effectively filters out any elements from the first array that
489
+ * do not have corresponding matches in the second array according to the equality function.
490
+ *
491
+ * @param {T[]} firstArr - The first array to compare.
492
+ * @param {T[]} secondArr - The second array to compare.
493
+ * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
494
+ * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.
495
+ * @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.
496
+ *
497
+ * @example
498
+ * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
499
+ * const array2 = [{ id: 2 }, { id: 4 }];
500
+ * const areItemsEqual = (a, b) => a.id === b.id;
501
+ * const result = intersectionWith(array1, array2, areItemsEqual);
502
+ * // result will be [{ id: 2 }] since this element has a matching id in both arrays.
503
+ */
176
504
  function intersectionWith(firstArr, secondArr, areItemsEqual) {
177
- return firstArr.filter((firstItem) => {
178
- return secondArr.some((secondItem) => {
505
+ return firstArr.filter(function (firstItem) {
506
+ return secondArr.some(function (secondItem) {
179
507
  return areItemsEqual(firstItem, secondItem);
180
508
  });
181
509
  });
182
510
  }
183
511
 
184
- // src/array/partition.ts
512
+ /**
513
+ * Splits an array into two groups based on a predicate function.
514
+ *
515
+ * This function takes an array and a predicate function. It returns a tuple of two arrays:
516
+ * the first array contains elements for which the predicate function returns true, and
517
+ * the second array contains elements for which the predicate function returns false.
518
+ *
519
+ * @param {T[]} arr - The array to partition.
520
+ * @param {(value: T) => boolean} isInTruthy - A predicate function that determines
521
+ * whether an element should be placed in the truthy array. The function is called with each
522
+ * element of the array.
523
+ * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for
524
+ * which the predicate returned true, and the second array contains elements for which the
525
+ * predicate returned false.
526
+ *
527
+ * @example
528
+ * const array = [1, 2, 3, 4, 5];
529
+ * const isEven = x => x % 2 === 0;
530
+ * const [even, odd] = partition(array, isEven);
531
+ * // even will be [2, 4], and odd will be [1, 3, 5]
532
+ */
185
533
  function partition(arr, isInTruthy) {
186
- const truthy = [];
187
- const falsy = [];
188
- for (const item of arr) {
189
- if (isInTruthy(item)) {
190
- truthy.push(item);
191
- } else {
192
- falsy.push(item);
534
+ var truthy = [];
535
+ var falsy = [];
536
+ var _iterator = _createForOfIteratorHelper(arr),
537
+ _step;
538
+ try {
539
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
540
+ var item = _step.value;
541
+ if (isInTruthy(item)) {
542
+ truthy.push(item);
543
+ } else {
544
+ falsy.push(item);
545
+ }
193
546
  }
547
+ } catch (err) {
548
+ _iterator.e(err);
549
+ } finally {
550
+ _iterator.f();
194
551
  }
195
552
  return [truthy, falsy];
196
553
  }
197
554
 
198
- // src/array/sample.ts
555
+ /**
556
+ * Returns a random element from an array.
557
+ *
558
+ * This function takes an array and returns a single element selected randomly from the array.
559
+ *
560
+ * @param {T[]} arr - The array to sample from.
561
+ * @returns {T} A random element from the array.
562
+ *
563
+ * @example
564
+ * const array = [1, 2, 3, 4, 5];
565
+ * const randomElement = sample(array);
566
+ * // randomElement will be one of the elements from the array, selected randomly.
567
+ */
199
568
  function sample(arr) {
200
- const randomIndex = Math.floor(Math.random() * arr.length);
569
+ var randomIndex = Math.floor(Math.random() * arr.length);
201
570
  return arr[randomIndex];
202
571
  }
203
572
 
204
- // src/array/shuffle.ts
573
+ /**
574
+ * Randomizes the order of elements in an array using the Fisher-Yates algorithm.
575
+ *
576
+ * This function takes an array and returns a new array with its elements shuffled in a random order.
577
+ *
578
+ * @param {T[]} arr - The array to shuffle.
579
+ * @returns {T[]} A new array with its elements shuffled in random order.
580
+ *
581
+ * @example
582
+ * const array = [1, 2, 3, 4, 5];
583
+ * const shuffledArray = shuffle(array);
584
+ * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]
585
+ */
205
586
  function shuffle(arr) {
206
- for (let i = arr.length - 1; i >= 1; i--) {
207
- const j = Math.floor(Math.random() * (i + 1));
208
- [arr[i], arr[j]] = [arr[j], arr[i]];
587
+ /**
588
+ * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
589
+ */
590
+ for (var i = arr.length - 1; i >= 1; i--) {
591
+ var j = Math.floor(Math.random() * (i + 1));
592
+ var _ref = [arr[j], arr[i]];
593
+ arr[i] = _ref[0];
594
+ arr[j] = _ref[1];
209
595
  }
210
596
  return arr;
211
597
  }
212
598
 
213
- // src/array/take.ts
599
+ /**
600
+ * Returns a new array containing the first `count` elements from the input array `arr`.
601
+ * If `count` is greater than the length of `arr`, the entire array is returned.
602
+ *
603
+ * @template T - Type of elements in the input array.
604
+ *
605
+ * @param {T[]} arr - The array to take elements from.
606
+ * @param {number} count - The number of elements to take.
607
+ * @returns {T[]} A new array containing the first `count` elements from `arr`.
608
+ *
609
+ * @example
610
+ * // Returns [1, 2, 3]
611
+ * take([1, 2, 3, 4, 5], 3);
612
+ *
613
+ * @example
614
+ * // Returns ['a', 'b']
615
+ * take(['a', 'b', 'c'], 2);
616
+ *
617
+ * @example
618
+ * // Returns [1, 2, 3]
619
+ * take([1, 2, 3], 5);
620
+ */
214
621
  function take(arr, count) {
215
622
  return arr.slice(0, count);
216
623
  }
217
624
 
218
- // src/array/takeRight.ts
625
+ /**
626
+ * Returns a new array containing the last `count` elements from the input array `arr`.
627
+ * If `count` is greater than the length of `arr`, the entire array is returned.
628
+ *
629
+ * @param {T[]} arr - The array to take elements from.
630
+ * @param {number} count - The number of elements to take.
631
+ * @returns {T[]} A new array containing the last `count` elements from `arr`.
632
+ *
633
+ * @example
634
+ * // Returns [4, 5]
635
+ * takeRight([1, 2, 3, 4, 5], 2);
636
+ *
637
+ * @example
638
+ * // Returns ['b', 'c']
639
+ * takeRight(['a', 'b', 'c'], 2);
640
+ *
641
+ * @example
642
+ * // Returns [1, 2, 3]
643
+ * takeRight([1, 2, 3], 5);
644
+ */
219
645
  function takeRight(arr, count) {
220
646
  if (count === 0) {
221
647
  return [];
@@ -223,9 +649,25 @@ function takeRight(arr, count) {
223
649
  return arr.slice(-count);
224
650
  }
225
651
 
226
- // src/array/takeRightWhile.ts
652
+ /**
653
+ * Takes elements from the end of the array while the predicate function returns `true`.
654
+ *
655
+ * @template T - Type of elements in the input array.
656
+ *
657
+ * @param {T[]} arr - The array to take elements from.
658
+ * @param {function(T): boolean} shouldContinueTaking - The function invoked per element.
659
+ * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.
660
+ *
661
+ * @example
662
+ * // Returns [3, 2, 1]
663
+ * takeRightWhile([5, 4, 3, 2, 1], n => n < 4);
664
+ *
665
+ * @example
666
+ * // Returns []
667
+ * takeRightWhile([1, 2, 3], n => n > 3);
668
+ */
227
669
  function takeRightWhile(arr, shouldContinueTaking) {
228
- for (let i = arr.length - 1; i >= 0; i--) {
670
+ for (var i = arr.length - 1; i >= 0; i--) {
229
671
  if (!shouldContinueTaking(arr[i])) {
230
672
  return arr.slice(i + 1);
231
673
  }
@@ -233,127 +675,406 @@ function takeRightWhile(arr, shouldContinueTaking) {
233
675
  return arr.slice();
234
676
  }
235
677
 
236
- // src/array/takeWhile.ts
678
+ /**
679
+ * Returns a new array containing the leading elements of the provided array
680
+ * that satisfy the provided predicate function. It stops taking elements as soon
681
+ * as an element does not satisfy the predicate.
682
+ *
683
+ * @template T - The type of elements in the array.
684
+ * @param {T[]} arr - The array to process.
685
+ * @param {(element: T) => boolean} shouldContinueTaking - The predicate function that is called with each element. Elements are included in the result as long as this function returns true.
686
+ * @returns {T[]} A new array containing the leading elements that satisfy the predicate.
687
+ *
688
+ * @example
689
+ * // Returns [1, 2]
690
+ * takeWhile([1, 2, 3, 4], x => x < 3);
691
+ *
692
+ * @example
693
+ * // Returns []
694
+ * takeWhile([1, 2, 3, 4], x => x > 3);
695
+ */
237
696
  function takeWhile(arr, shouldContinueTaking) {
238
- const result = [];
239
- for (const item of arr) {
240
- if (!shouldContinueTaking(item)) {
241
- break;
697
+ var result = [];
698
+ var _iterator = _createForOfIteratorHelper(arr),
699
+ _step;
700
+ try {
701
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
702
+ var item = _step.value;
703
+ if (!shouldContinueTaking(item)) {
704
+ break;
705
+ }
706
+ result.push(item);
242
707
  }
243
- result.push(item);
708
+ } catch (err) {
709
+ _iterator.e(err);
710
+ } finally {
711
+ _iterator.f();
244
712
  }
245
713
  return result;
246
714
  }
247
715
 
248
- // src/array/uniq.ts
716
+ /**
717
+ * Creates a duplicate-free version of an array.
718
+ *
719
+ * This function takes an array and returns a new array containing only the unique values
720
+ * from the original array, preserving the order of first occurrence.
721
+ *
722
+ * @param {T[]} arr - The array to process.
723
+ * @returns {T[]} A new array with only unique values from the original array.
724
+ *
725
+ * @example
726
+ * * const array = [1, 2, 2, 3, 4, 4, 5];
727
+ * const result = uniq(array);
728
+ * // result will be [1, 2, 3, 4, 5]
729
+ */
249
730
  function uniq(arr) {
250
- const result = [];
251
- for (const item of arr) {
252
- if (result.includes(item)) {
253
- continue;
731
+ var result = [];
732
+ var _iterator = _createForOfIteratorHelper(arr),
733
+ _step;
734
+ try {
735
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
736
+ var item = _step.value;
737
+ if (result.includes(item)) {
738
+ continue;
739
+ }
740
+ result.push(item);
254
741
  }
255
- result.push(item);
742
+ } catch (err) {
743
+ _iterator.e(err);
744
+ } finally {
745
+ _iterator.f();
256
746
  }
257
747
  return result;
258
748
  }
259
749
 
260
- // src/array/union.ts
750
+ /**
751
+ * Creates an array of unique values from all given arrays.
752
+ *
753
+ * This function takes two arrays, merges them into a single array, and returns a new array
754
+ * containing only the unique values from the merged array.
755
+ *
756
+ * @param {T[]} arr1 - The first array to merge and filter for unique values.
757
+ * @param {T[]} arr2 - The second array to merge and filter for unique values.
758
+ * @returns {T[]} A new array of unique values.
759
+ *
760
+ * @example
761
+ * const array1 = [1, 2, 3];
762
+ * const array2 = [3, 4, 5];
763
+ * const result = union(array1, array2);
764
+ * // result will be [1, 2, 3, 4, 5]
765
+ */
261
766
  function union(arr1, arr2) {
262
767
  return uniq(arr1.concat(arr2));
263
768
  }
264
769
 
265
- // src/array/unionBy.ts
770
+ /**
771
+ * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.
772
+ *
773
+ * @param {T[]} arr1 - The first array.
774
+ * @param {T[]} arr2 - The second array.
775
+ * @param {function(item: T): U} mapper - The function to map array elements to comparison values.
776
+ * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.
777
+ *
778
+ * @example
779
+ * // Custom mapping function for numbers (modulo comparison)
780
+ * const moduloMapper = (x) => x % 3;
781
+ * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);
782
+ * // Returns [1, 2, 3]
783
+ *
784
+ * @example
785
+ * // Custom mapping function for objects with an 'id' property
786
+ * const idMapper = (obj) => obj.id;
787
+ * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
788
+ * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]
789
+ */
266
790
  function unionBy(arr1, arr2, mapper) {
267
- const map = /* @__PURE__ */ new Map();
268
- for (const item of [...arr1, ...arr2]) {
269
- const key = mapper(item);
791
+ var map = new Map();
792
+ for (var _i = 0, _arr = [].concat(_toConsumableArray(arr1), _toConsumableArray(arr2)); _i < _arr.length; _i++) {
793
+ var item = _arr[_i];
794
+ var key = mapper(item);
270
795
  if (!map.has(key)) {
271
796
  map.set(key, item);
272
797
  }
273
798
  }
274
- return [...map.values()];
799
+ return _toConsumableArray(map.values());
275
800
  }
276
801
 
277
- // src/array/uniqWith.ts
802
+ /**
803
+ * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.
804
+ *
805
+ * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.
806
+ *
807
+ * @example
808
+ * ```ts
809
+ * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
810
+ * // [1, 2, 3, 5, 7]
811
+ * ```
812
+ */
278
813
  function uniqWith(arr, areItemsEqual) {
279
- const result = [];
280
- for (const item of arr) {
281
- const isUniq = result.every((v) => !areItemsEqual(v, item));
282
- if (isUniq) {
283
- result.push(item);
814
+ var result = [];
815
+ var _iterator = _createForOfIteratorHelper(arr),
816
+ _step;
817
+ try {
818
+ var _loop = function _loop() {
819
+ var item = _step.value;
820
+ var isUniq = result.every(function (v) {
821
+ return !areItemsEqual(v, item);
822
+ });
823
+ if (isUniq) {
824
+ result.push(item);
825
+ }
826
+ };
827
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
828
+ _loop();
284
829
  }
830
+ } catch (err) {
831
+ _iterator.e(err);
832
+ } finally {
833
+ _iterator.f();
285
834
  }
286
835
  return result;
287
836
  }
288
837
 
289
- // src/array/unionWith.ts
838
+ /**
839
+ * Creates an array of unique values from two given arrays based on a custom equality function.
840
+ *
841
+ * This function takes two arrays and a custom equality function, merges the arrays, and returns
842
+ * a new array containing only the unique values as determined by the custom equality function.
843
+ *
844
+ * @param {T[]} arr1 - The first array to merge and filter for unique values.
845
+ * @param {T[]} arr2 - The second array to merge and filter for unique values.
846
+ * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
847
+ * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.
848
+ * @returns {T[]} A new array of unique values based on the custom equality function.
849
+ *
850
+ * @example
851
+ * const array1 = [{ id: 1 }, { id: 2 }];
852
+ * const array2 = [{ id: 2 }, { id: 3 }];
853
+ * const areItemsEqual = (a, b) => a.id === b.id;
854
+ * const result = unionWith(array1, array2, areItemsEqual);
855
+ * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays
856
+ */
290
857
  function unionWith(arr1, arr2, areItemsEqual) {
291
858
  return uniqWith(arr1.concat(arr2), areItemsEqual);
292
859
  }
293
860
 
294
- // src/array/uniqBy.ts
861
+ /**
862
+ * The `uniqBy` function takes an array as its first argument and a 'converter' function as the second. It maps the array elements using the converter function, then removes any duplicates.
863
+ *
864
+ * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.
865
+ *
866
+ * @example
867
+ * ```ts
868
+ * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
869
+ * // [1.2, 2.1, 3.3, 5.7, 7.19]
870
+ * ```
871
+ */
295
872
  function uniqBy(arr, converter) {
296
- return uniqWith(arr, (item1, item2) => converter(item1) === converter(item2));
873
+ return uniqWith(arr, function (item1, item2) {
874
+ return converter(item1) === converter(item2);
875
+ });
297
876
  }
298
877
 
299
- // src/array/xor.ts
878
+ /**
879
+ * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
880
+ * which are in either of the arrays, but not in their intersection.
881
+ *
882
+ * @param {T[]} arr1 - The first array.
883
+ * @param {T[]} arr2 - The second array.
884
+ * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.
885
+ *
886
+ * @example
887
+ * // Returns [1, 2, 5, 6]
888
+ * xor([1, 2, 3, 4], [3, 4, 5, 6]);
889
+ *
890
+ * @example
891
+ * // Returns ['a', 'c']
892
+ * xor(['a', 'b'], ['b', 'c']);
893
+ */
300
894
  function xor(arr1, arr2) {
301
895
  return difference(union(arr1, arr2), intersection(arr1, arr2));
302
896
  }
303
897
 
304
- // src/array/xorBy.ts
898
+ /**
899
+ * Computes the symmetric difference between two arrays using a custom mapping function.
900
+ * The symmetric difference is the set of elements which are in either of the arrays,
901
+ * but not in their intersection, determined by the result of the mapping function.
902
+ *
903
+ * @template T - Type of elements in the input arrays.
904
+ * @template U - Type of the values returned by the mapping function.
905
+ *
906
+ * @param {T[]} arr1 - The first array.
907
+ * @param {T[]} arr2 - The second array.
908
+ * @param {function(item: T): U} mapper - The function to map array elements to comparison values.
909
+ * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.
910
+ *
911
+ * @example
912
+ * // Custom mapping function for objects with an 'id' property
913
+ * const idMapper = obj => obj.id;
914
+ * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
915
+ * // Returns [{ id: 1 }, { id: 3 }]
916
+ */
305
917
  function xorBy(arr1, arr2, mapper) {
306
- const union2 = unionBy(arr1, arr2, mapper);
307
- const intersection2 = intersectionBy(arr1, arr2, mapper);
308
- return differenceBy(union2, intersection2, mapper);
918
+ var union = unionBy(arr1, arr2, mapper);
919
+ var intersection = intersectionBy(arr1, arr2, mapper);
920
+ return differenceBy(union, intersection, mapper);
309
921
  }
310
922
 
311
- // src/array/xorWith.ts
923
+ /**
924
+ * Computes the symmetric difference between two arrays using a custom equality function.
925
+ * The symmetric difference is the set of elements which are in either of the arrays,
926
+ * but not in their intersection.
927
+ *
928
+ * @template T - Type of elements in the input arrays.
929
+ *
930
+ * @param {T[]} arr1 - The first array.
931
+ * @param {T[]} arr2 - The second array.
932
+ * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.
933
+ * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function.
934
+ *
935
+ * @example
936
+ * // Custom equality function for objects with an 'id' property
937
+ * const areObjectsEqual = (a, b) => a.id === b.id;
938
+ * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);
939
+ * // Returns [{ id: 1 }, { id: 3 }]
940
+ */
312
941
  function xorWith(arr1, arr2, areElementsEqual) {
313
- const union2 = unionWith(arr1, arr2, areElementsEqual);
314
- const intersection2 = intersectionWith(arr1, arr2, areElementsEqual);
315
- return differenceWith(union2, intersection2, areElementsEqual);
316
- }
317
-
318
- // src/array/zip.ts
319
- function zip(...arrs) {
320
- const result = [];
321
- const maxIndex = Math.max(...arrs.map((x) => x.length));
322
- for (let i = 0; i < maxIndex; i++) {
323
- const element = [];
324
- for (const arr of arrs) {
325
- element.push(arr[i]);
942
+ var union = unionWith(arr1, arr2, areElementsEqual);
943
+ var intersection = intersectionWith(arr1, arr2, areElementsEqual);
944
+ return differenceWith(union, intersection, areElementsEqual);
945
+ }
946
+
947
+ /**
948
+ * Combines multiple arrays into a single array of tuples.
949
+ *
950
+ * This function takes multiple arrays and returns a new array where each element is a tuple
951
+ * containing the corresponding elements from the input arrays. If the input arrays are of
952
+ * different lengths, the resulting array will have the length of the longest input array,
953
+ * with undefined values for missing elements.
954
+ *
955
+ * @param {...T[][]} arrs - The arrays to zip together.
956
+ * @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.
957
+ *
958
+ * @example
959
+ * const arr1 = [1, 2, 3];
960
+ * const arr2 = ['a', 'b', 'c'];
961
+ * const result = zip(arr1, arr2);
962
+ * // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
963
+ *
964
+ * const arr3 = [true, false];
965
+ * const result2 = zip(arr1, arr2, arr3);
966
+ * // result2 will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
967
+ */
968
+
969
+ function zip() {
970
+ var result = [];
971
+ for (var _len = arguments.length, arrs = new Array(_len), _key = 0; _key < _len; _key++) {
972
+ arrs[_key] = arguments[_key];
973
+ }
974
+ var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (x) {
975
+ return x.length;
976
+ })));
977
+ for (var i = 0; i < maxIndex; i++) {
978
+ var element = [];
979
+ var _iterator = _createForOfIteratorHelper(arrs),
980
+ _step;
981
+ try {
982
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
983
+ var arr = _step.value;
984
+ element.push(arr[i]);
985
+ }
986
+ } catch (err) {
987
+ _iterator.e(err);
988
+ } finally {
989
+ _iterator.f();
326
990
  }
327
991
  result.push(element);
328
992
  }
329
993
  return result;
330
994
  }
331
995
 
332
- // src/array/zipWith.ts
333
- function zipWith(arr1, ...rest) {
334
- const arrs = [arr1, ...rest.slice(0, -1)];
335
- const combine = rest[rest.length - 1];
336
- const result = [];
337
- const maxIndex = Math.max(...arrs.map((arr) => arr.length));
338
- for (let i = 0; i < maxIndex; i++) {
339
- const elements = arrs.map((arr) => arr[i]);
340
- result.push(combine(...elements));
996
+ /**
997
+ * Combines multiple arrays into a single array using a custom combiner function.
998
+ *
999
+ * This function takes multiple arrays and a combiner function, and returns a new array where each element
1000
+ * is the result of applying the combiner function to the corresponding elements of the input arrays.
1001
+ *
1002
+ * @param {T[]} arr1 - The first array to zip.
1003
+ * @param {U[]} [arr2] - The second array to zip (optional).
1004
+ * @param {V[]} [arr3] - The third array to zip (optional).
1005
+ * @param {W[]} [arr4] - The fourth array to zip (optional).
1006
+ * @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.
1007
+ * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
1008
+ *
1009
+ * @example
1010
+ * // Example usage with two arrays:
1011
+ * const arr1 = [1, 2, 3];
1012
+ * const arr2 = [4, 5, 6];
1013
+ * const result = zipWith(arr1, arr2, (a, b) => a + b);
1014
+ * // result will be [5, 7, 9]
1015
+ *
1016
+ * @example
1017
+ * // Example usage with three arrays:
1018
+ * const arr1 = [1, 2];
1019
+ * const arr2 = [3, 4];
1020
+ * const arr3 = [5, 6];
1021
+ * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);
1022
+ * // result will be [`135`, `246`]
1023
+ */
1024
+
1025
+ function zipWith(arr1) {
1026
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1027
+ rest[_key - 1] = arguments[_key];
1028
+ }
1029
+ var arrs = [arr1].concat(_toConsumableArray(rest.slice(0, -1)));
1030
+ var combine = rest[rest.length - 1];
1031
+ var result = [];
1032
+ var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (arr) {
1033
+ return arr.length;
1034
+ })));
1035
+ var _loop = function _loop(i) {
1036
+ var elements = arrs.map(function (arr) {
1037
+ return arr[i];
1038
+ });
1039
+ result.push(combine.apply(void 0, _toConsumableArray(elements)));
1040
+ };
1041
+ for (var i = 0; i < maxIndex; i++) {
1042
+ _loop(i);
341
1043
  }
342
1044
  return result;
343
1045
  }
344
1046
 
345
- // src/function/debounce.ts
1047
+ /**
1048
+ * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
1049
+ * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
1050
+ * method to cancel any pending execution.
1051
+ *
1052
+ * @param {() => void} func - The function to debounce.
1053
+ * @param {number} debounceMs - The number of milliseconds to delay.
1054
+ * @returns {{ (): void; cancel: () => void }} A new debounced function with a `cancel` method.
1055
+ *
1056
+ * @example
1057
+ * const debouncedFunction = debounce(() => {
1058
+ * console.log('Function executed');
1059
+ * }, 1000);
1060
+ *
1061
+ * // Will log 'Function executed' after 1 second if not called again in that time
1062
+ * debouncedFunction();
1063
+ *
1064
+ * // Will not log anything as the previous call is canceled
1065
+ * debouncedFunction.cancel();
1066
+ */
346
1067
  function debounce(func, debounceMs) {
347
- let timeoutId = null;
348
- const debounced = function() {
1068
+ var timeoutId = null;
1069
+ var debounced = function debounced() {
349
1070
  if (timeoutId != null) {
350
1071
  clearTimeout(timeoutId);
351
1072
  }
352
- timeoutId = setTimeout(() => {
1073
+ timeoutId = setTimeout(function () {
353
1074
  func();
354
1075
  }, debounceMs);
355
1076
  };
356
- debounced.cancel = function() {
1077
+ debounced.cancel = function () {
357
1078
  if (timeoutId != null) {
358
1079
  clearTimeout(timeoutId);
359
1080
  }
@@ -361,26 +1082,65 @@ function debounce(func, debounceMs) {
361
1082
  return debounced;
362
1083
  }
363
1084
 
364
- // src/function/once.ts
1085
+ /**
1086
+ * Creates a function that is restricted to invoking the provided function `func` once.
1087
+ * Repeated calls to the function will return the value from the first invocation.
1088
+ *
1089
+ * @param {F} func - The function to restrict.
1090
+ * @returns {F} A new function that invokes `func` once and caches the result.
1091
+ *
1092
+ * @example
1093
+ * const initialize = once(() => {
1094
+ * console.log('Initialized!');
1095
+ * return true;
1096
+ * });
1097
+ *
1098
+ * initialize(); // Logs: 'Initialized!' and returns true
1099
+ * initialize(); // Returns true without logging
1100
+ */
365
1101
  function once(func) {
366
- let called = false;
367
- let cache;
368
- return function() {
1102
+ var called = false;
1103
+ var cache;
1104
+ return function () {
369
1105
  if (called) {
370
1106
  return cache;
371
1107
  }
372
- const result = func();
1108
+ var result = func();
373
1109
  called = true;
374
1110
  cache = result;
375
1111
  return result;
376
1112
  };
377
1113
  }
378
1114
 
379
- // src/function/throttle.ts
1115
+ /**
1116
+ * Creates a throttled function that only invokes the provided function at most once
1117
+ * per every `throttleMs` milliseconds. Subsequent calls to the throttled function
1118
+ * within the wait time will not trigger the execution of the original function.
1119
+ *
1120
+ * @param {() => void} func - The function to throttle.
1121
+ * @param {number} throttleMs - The number of milliseconds to throttle executions to.
1122
+ * @returns {() => void} A new throttled function.
1123
+ *
1124
+ * @example
1125
+ * const throttledFunction = throttle(() => {
1126
+ * console.log('Function executed');
1127
+ * }, 1000);
1128
+ *
1129
+ * // Will log 'Function executed' immediately
1130
+ * throttledFunction();
1131
+ *
1132
+ * // Will not log anything as it is within the throttle time
1133
+ * throttledFunction();
1134
+ *
1135
+ * // After 1 second
1136
+ * setTimeout(() => {
1137
+ * throttledFunction(); // Will log 'Function executed'
1138
+ * }, 1000);
1139
+ */
380
1140
  function throttle(func, throttleMs) {
381
- let lastCallTime;
382
- const throttledFunction = function() {
383
- const now = Date.now();
1141
+ var lastCallTime;
1142
+ var throttledFunction = function throttledFunction() {
1143
+ var now = Date.now();
384
1144
  if (lastCallTime == null || now - lastCallTime >= throttleMs) {
385
1145
  lastCallTime = now;
386
1146
  func();
@@ -389,7 +1149,24 @@ function throttle(func, throttleMs) {
389
1149
  return throttledFunction;
390
1150
  }
391
1151
 
392
- // src/math/clamp.ts
1152
+ /**
1153
+ * Clamps a number within the inclusive lower and upper bounds.
1154
+ *
1155
+ * This function takes a number and two bounds, and returns the number clamped within the specified bounds.
1156
+ * If only one bound is provided, it returns the minimum of the value and the bound.
1157
+ *
1158
+ * @param {number} value - The number to clamp.
1159
+ * @param {number} minimum - The minimum bound to clamp the number.
1160
+ * @param {number} maximum - The maximum bound to clamp the number.
1161
+ * @returns {number} The clamped number within the specified bounds.
1162
+ *
1163
+ * @example
1164
+ * * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
1165
+ * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
1166
+ * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
1167
+ * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
1168
+ */
1169
+
393
1170
  function clamp(value, bound1, bound2) {
394
1171
  if (bound2 == null) {
395
1172
  return Math.min(value, bound1);
@@ -397,34 +1174,113 @@ function clamp(value, bound1, bound2) {
397
1174
  return Math.min(Math.max(value, bound1), bound2);
398
1175
  }
399
1176
 
400
- // src/math/round.ts
401
- function round(value, precision = 0) {
402
- const multiplier = Math.pow(10, precision);
1177
+ /**
1178
+ * Rounds a number to a specified precision.
1179
+ *
1180
+ * This function takes a number and an optional precision value, and returns the number rounded
1181
+ * to the specified number of decimal places.
1182
+ *
1183
+ * @param {number} value - The number to round.
1184
+ * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.
1185
+ * @returns {number} The rounded number.
1186
+ *
1187
+ * @example
1188
+ * * const result1 = round(1.2345); // result1 will be 1
1189
+ * const result2 = round(1.2345, 2); // result2 will be 1.23
1190
+ * const result3 = round(1.2345, 3); // result3 will be 1.235
1191
+ */
1192
+ function round(value) {
1193
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1194
+ var multiplier = Math.pow(10, precision);
403
1195
  return Math.round(value * multiplier) / multiplier;
404
1196
  }
405
1197
 
406
- // src/math/sum.ts
1198
+ /**
1199
+ * Calculates the sum of an array of numbers.
1200
+ *
1201
+ * This function takes an array of numbers and returns the sum of all the elements in the array.
1202
+ *
1203
+ * @param {number[]} nums - An array of numbers to be summed.
1204
+ * @returns {number} The sum of all the numbers in the array.
1205
+ *
1206
+ * @example
1207
+ * * const numbers = [1, 2, 3, 4, 5];
1208
+ * const result = sum(numbers);
1209
+ * // result will be 15
1210
+ */
407
1211
  function sum(nums) {
408
- let result = 0;
409
- for (const num of nums) {
410
- result += num;
1212
+ var result = 0;
1213
+ var _iterator = _createForOfIteratorHelper(nums),
1214
+ _step;
1215
+ try {
1216
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1217
+ var num = _step.value;
1218
+ result += num;
1219
+ }
1220
+ } catch (err) {
1221
+ _iterator.e(err);
1222
+ } finally {
1223
+ _iterator.f();
411
1224
  }
412
1225
  return result;
413
1226
  }
414
1227
 
415
- // src/object/omit.ts
1228
+ /**
1229
+ * Creates a new object with specified keys omitted.
1230
+ *
1231
+ * This function takes an object and an array of keys, and returns a new object that
1232
+ * excludes the properties corresponding to the specified keys.
1233
+ *
1234
+ * @param {T} obj - The object to omit keys from.
1235
+ * @param {K[]} keys - An array of keys to be omitted from the object.
1236
+ * @returns {Omit<T, K>} A new object with the specified keys omitted.
1237
+ *
1238
+ * @example
1239
+ * * const obj = { a: 1, b: 2, c: 3 };
1240
+ * const result = omit(obj, ['b', 'c']);
1241
+ * // result will be { a: 1 }
1242
+ */
416
1243
  function omit(obj, keys) {
417
- const result = __spreadValues({}, obj);
418
- for (const key of keys) {
419
- delete result[key];
1244
+ var result = _objectSpread2({}, obj);
1245
+ var _iterator = _createForOfIteratorHelper(keys),
1246
+ _step;
1247
+ try {
1248
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1249
+ var key = _step.value;
1250
+ delete result[key];
1251
+ }
1252
+ } catch (err) {
1253
+ _iterator.e(err);
1254
+ } finally {
1255
+ _iterator.f();
420
1256
  }
421
1257
  return result;
422
1258
  }
423
1259
 
424
- // src/object/omitBy.ts
1260
+ /**
1261
+ * Creates a new object composed of the properties that do not satisfy the predicate function.
1262
+ *
1263
+ * This function takes an object and a predicate function, and returns a new object that
1264
+ * includes only the properties for which the predicate function returns false.
1265
+ *
1266
+ * @param {T} obj - The object to omit properties from.
1267
+ * @param {(value: T[string], key: string) => boolean} shouldOmit - A predicate function that determines
1268
+ * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
1269
+ * if the property should be omitted, and `false` otherwise.
1270
+ * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.
1271
+ *
1272
+ * @example
1273
+ * const obj = { a: 1, b: 'omit', c: 3 };
1274
+ * const shouldOmit = (key, value) => typeof value === 'string';
1275
+ * const result = omitBy(obj, shouldOmit);
1276
+ * // result will be { a: 1, c: 3 }
1277
+ */
425
1278
  function omitBy(obj, shouldOmit) {
426
- const result = {};
427
- for (const [key, value] of Object.entries(obj)) {
1279
+ var result = {};
1280
+ for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
1281
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
1282
+ key = _Object$entries$_i[0],
1283
+ value = _Object$entries$_i[1];
428
1284
  if (shouldOmit(value, key)) {
429
1285
  continue;
430
1286
  }
@@ -433,19 +1289,62 @@ function omitBy(obj, shouldOmit) {
433
1289
  return result;
434
1290
  }
435
1291
 
436
- // src/object/pick.ts
1292
+ /**
1293
+ * Creates a new object composed of the picked object properties.
1294
+ *
1295
+ * This function takes an object and an array of keys, and returns a new object that
1296
+ * includes only the properties corresponding to the specified keys.
1297
+ *
1298
+ * @param {T} obj - The object to pick keys from.
1299
+ * @param {K[]} keys - An array of keys to be picked from the object.
1300
+ * @returns {Pick<T, K>} A new object with the specified keys picked.
1301
+ *
1302
+ * @example
1303
+ * * const obj = { a: 1, b: 2, c: 3 };
1304
+ * const result = pick(obj, ['a', 'c']);
1305
+ * // result will be { a: 1, c: 3 }
1306
+ */
437
1307
  function pick(obj, keys) {
438
- const result = {};
439
- for (const key of keys) {
440
- result[key] = obj[key];
1308
+ var result = {};
1309
+ var _iterator = _createForOfIteratorHelper(keys),
1310
+ _step;
1311
+ try {
1312
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1313
+ var key = _step.value;
1314
+ result[key] = obj[key];
1315
+ }
1316
+ } catch (err) {
1317
+ _iterator.e(err);
1318
+ } finally {
1319
+ _iterator.f();
441
1320
  }
442
1321
  return result;
443
1322
  }
444
1323
 
445
- // src/object/pickBy.ts
1324
+ /**
1325
+ * Creates a new object composed of the properties that satisfy the predicate function.
1326
+ *
1327
+ * This function takes an object and a predicate function, and returns a new object that
1328
+ * includes only the properties for which the predicate function returns true.
1329
+ *
1330
+ * @param {T} obj - The object to pick properties from.
1331
+ * @param {(value: T[keyof T], key: string) => boolean} shouldPick - A predicate function that determines
1332
+ * whether a property should be picked. It takes the property's key and value as arguments and returns `true`
1333
+ * if the property should be picked, and `false` otherwise.
1334
+ * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.
1335
+ *
1336
+ * @example
1337
+ * const obj = { a: 1, b: 'pick', c: 3 };
1338
+ * const shouldPick = (value) => typeof value === 'string';
1339
+ * const result = pickBy(obj, shouldPick);
1340
+ * // result will be { b: 'pick' }
1341
+ */
446
1342
  function pickBy(obj, shouldPick) {
447
- const result = {};
448
- for (const [key, value] of Object.entries(obj)) {
1343
+ var result = {};
1344
+ for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
1345
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
1346
+ key = _Object$entries$_i[0],
1347
+ value = _Object$entries$_i[1];
449
1348
  if (!shouldPick(value, key)) {
450
1349
  continue;
451
1350
  }
@@ -454,78 +1353,162 @@ function pickBy(obj, shouldPick) {
454
1353
  return result;
455
1354
  }
456
1355
 
457
- // src/predicate/isNil.ts
1356
+ /**
1357
+ * Checks if a given value is null or undefined.
1358
+ *
1359
+ * This function tests whether the provided value is either `null` or `undefined`.
1360
+ * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.
1361
+ *
1362
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.
1363
+ *
1364
+ * @param {unknown} x - The value to test for null or undefined.
1365
+ * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.
1366
+ *
1367
+ * @example
1368
+ * * const value1 = null;
1369
+ * const value2 = undefined;
1370
+ * const value3 = 42;
1371
+ * const result1 = isNil(value1); // true
1372
+ * const result2 = isNil(value2); // true
1373
+ * const result3 = isNil(value3); // false
1374
+ */
458
1375
  function isNil(x) {
459
- return x === null || x === void 0;
1376
+ return x == null || x == undefined;
460
1377
  }
461
1378
 
462
- // src/predicate/isNotNil.ts
1379
+ /**
1380
+ * Checks if the given value is not null nor undefined.
1381
+ *
1382
+ * The main use of this function is to be used with TypeScript as a type predicate.
1383
+ *
1384
+ * @param {T | null | undefined} x - The value to test if it is not null nor undefined.
1385
+ * @returns {x is T} True if the value is not null nor undefined, false otherwise.
1386
+ *
1387
+ * @example
1388
+ * // Here the type of `arr` is (number | undefined)[]
1389
+ * const arr = [1, undefined, 3];
1390
+ * // Here the type of `result` is number[]
1391
+ * const result = arr.filter(isNotNil);
1392
+ * // result will be [1, 3]
1393
+ */
463
1394
  function isNotNil(x) {
464
- return x !== null && x !== void 0;
1395
+ return x != null && x != undefined;
465
1396
  }
466
1397
 
467
- // src/predicate/isNull.ts
1398
+ /**
1399
+ * Checks if the given value is null.
1400
+ *
1401
+ * This function tests whether the provided value is strictly equal to `null`.
1402
+ * It returns `true` if the value is `null`, and `false` otherwise.
1403
+ *
1404
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.
1405
+ *
1406
+ * @param {unknown} x - The value to test if it is null.
1407
+ * @returns {x is null} True if the value is null, false otherwise.
1408
+ *
1409
+ * @example
1410
+ * * const value1 = null;
1411
+ * const value2 = undefined;
1412
+ * const value3 = 42;
1413
+ *
1414
+ * console.log(isNull(value1)); // true
1415
+ * console.log(isNull(value2)); // false
1416
+ * console.log(isNull(value3)); // false
1417
+ */
468
1418
  function isNull(x) {
469
1419
  return x === null;
470
1420
  }
471
1421
 
472
- // src/predicate/isUndefined.ts
1422
+ /**
1423
+ * Checks if the given value is undefined.
1424
+ *
1425
+ * This function tests whether the provided value is strictly equal to `undefined`.
1426
+ * It returns `true` if the value is `undefined`, and `false` otherwise.
1427
+ *
1428
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.
1429
+ *
1430
+ * @param {unknown} x - The value to test if it is undefined.
1431
+ * @returns {x is undefined} true if the value is undefined, false otherwise.
1432
+ *
1433
+ * @example
1434
+ * * const value1 = undefined;
1435
+ * const value2 = null;
1436
+ * const value3 = 42;
1437
+ *
1438
+ * console.log(isUndefined(value1)); // true
1439
+ * console.log(isUndefined(value2)); // false
1440
+ * console.log(isUndefined(value3)); // false
1441
+ */
473
1442
  function isUndefined(x) {
474
- return x === void 0;
1443
+ return x === undefined;
475
1444
  }
476
1445
 
477
- // src/promise/delay.ts
1446
+ /**
1447
+ * Delays the execution of code for a specified number of milliseconds.
1448
+ *
1449
+ * This function returns a Promise that resolves after the specified delay, allowing you to use it
1450
+ * with async/await to pause execution.
1451
+ *
1452
+ * @param {number} ms - The number of milliseconds to delay.
1453
+ * @returns {Promise<void>} A Promise that resolves after the specified delay.
1454
+ *
1455
+ * @example
1456
+ * async function foo() {
1457
+ * console.log('Start');
1458
+ * await delay(1000); // Delays execution for 1 second
1459
+ * console.log('End');
1460
+ * }
1461
+ *
1462
+ * foo();
1463
+ */
478
1464
  function delay(ms) {
479
- return new Promise((resolve) => {
1465
+ return new Promise(function (resolve) {
480
1466
  setTimeout(resolve, ms);
481
1467
  });
482
1468
  }
483
- // Annotate the CommonJS export names for ESM import in node:
484
- 0 && (module.exports = {
485
- chunk,
486
- clamp,
487
- debounce,
488
- delay,
489
- difference,
490
- differenceBy,
491
- differenceWith,
492
- drop,
493
- dropRight,
494
- dropRightWhile,
495
- dropWhile,
496
- groupBy,
497
- intersection,
498
- intersectionBy,
499
- intersectionWith,
500
- isNil,
501
- isNotNil,
502
- isNull,
503
- isUndefined,
504
- omit,
505
- omitBy,
506
- once,
507
- partition,
508
- pick,
509
- pickBy,
510
- round,
511
- sample,
512
- shuffle,
513
- sum,
514
- take,
515
- takeRight,
516
- takeRightWhile,
517
- takeWhile,
518
- throttle,
519
- union,
520
- unionBy,
521
- unionWith,
522
- uniq,
523
- uniqBy,
524
- uniqWith,
525
- xor,
526
- xorBy,
527
- xorWith,
528
- zip,
529
- zipWith
530
- });
531
- //# sourceMappingURL=index.js.map
1469
+
1470
+ exports.chunk = chunk;
1471
+ exports.clamp = clamp;
1472
+ exports.debounce = debounce;
1473
+ exports.delay = delay;
1474
+ exports.difference = difference;
1475
+ exports.differenceBy = differenceBy;
1476
+ exports.differenceWith = differenceWith;
1477
+ exports.drop = drop;
1478
+ exports.dropRight = dropRight;
1479
+ exports.dropRightWhile = dropRightWhile;
1480
+ exports.dropWhile = dropWhile;
1481
+ exports.groupBy = groupBy;
1482
+ exports.intersection = intersection;
1483
+ exports.intersectionBy = intersectionBy;
1484
+ exports.intersectionWith = intersectionWith;
1485
+ exports.isNil = isNil;
1486
+ exports.isNotNil = isNotNil;
1487
+ exports.isNull = isNull;
1488
+ exports.isUndefined = isUndefined;
1489
+ exports.omit = omit;
1490
+ exports.omitBy = omitBy;
1491
+ exports.once = once;
1492
+ exports.partition = partition;
1493
+ exports.pick = pick;
1494
+ exports.pickBy = pickBy;
1495
+ exports.round = round;
1496
+ exports.sample = sample;
1497
+ exports.shuffle = shuffle;
1498
+ exports.sum = sum;
1499
+ exports.take = take;
1500
+ exports.takeRight = takeRight;
1501
+ exports.takeRightWhile = takeRightWhile;
1502
+ exports.takeWhile = takeWhile;
1503
+ exports.throttle = throttle;
1504
+ exports.union = union;
1505
+ exports.unionBy = unionBy;
1506
+ exports.unionWith = unionWith;
1507
+ exports.uniq = uniq;
1508
+ exports.uniqBy = uniqBy;
1509
+ exports.uniqWith = uniqWith;
1510
+ exports.xor = xor;
1511
+ exports.xorBy = xorBy;
1512
+ exports.xorWith = xorWith;
1513
+ exports.zip = zip;
1514
+ exports.zipWith = zipWith;