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
@@ -1,192 +1,562 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/array/index.ts
21
- var array_exports = {};
22
- __export(array_exports, {
23
- chunk: () => chunk,
24
- difference: () => difference,
25
- differenceBy: () => differenceBy,
26
- differenceWith: () => differenceWith,
27
- drop: () => drop,
28
- dropRight: () => dropRight,
29
- dropRightWhile: () => dropRightWhile,
30
- dropWhile: () => dropWhile,
31
- groupBy: () => groupBy,
32
- intersection: () => intersection,
33
- intersectionBy: () => intersectionBy,
34
- intersectionWith: () => intersectionWith,
35
- partition: () => partition,
36
- sample: () => sample,
37
- shuffle: () => shuffle,
38
- take: () => take,
39
- takeRight: () => takeRight,
40
- takeRightWhile: () => takeRightWhile,
41
- takeWhile: () => takeWhile,
42
- union: () => union,
43
- unionBy: () => unionBy,
44
- unionWith: () => unionWith,
45
- uniq: () => uniq,
46
- uniqBy: () => uniqBy,
47
- uniqWith: () => uniqWith,
48
- xor: () => xor,
49
- xorBy: () => xorBy,
50
- xorWith: () => xorWith,
51
- zip: () => zip,
52
- zipWith: () => zipWith
53
- });
54
- module.exports = __toCommonJS(array_exports);
55
-
56
- // 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
+ */
57
28
  function chunk(arr, size) {
58
29
  if (!Number.isInteger(size) || size <= 0) {
59
- throw new Error("Size must be an integer greater than zero.");
30
+ throw new Error('Size must be an integer greater than zero.');
60
31
  }
61
- const chunkLength = Math.ceil(arr.length / size);
62
- const result = Array(chunkLength);
63
- for (let index = 0; index < chunkLength; index++) {
64
- const start = index * size;
65
- 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;
66
37
  result[index] = arr.slice(start, end);
67
38
  }
68
39
  return result;
69
40
  }
70
41
 
71
- // 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
+ */
72
64
  function difference(firstArr, secondArr) {
73
- return firstArr.filter((item) => {
65
+ return firstArr.filter(function (item) {
74
66
  return !secondArr.includes(item);
75
67
  });
76
68
  }
77
69
 
78
- // 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
+ */
79
95
  function differenceBy(firstArr, secondArr, mapper) {
80
- const mappedSecondArr = secondArr.map((item) => mapper(item));
81
- return firstArr.filter((item) => {
96
+ var mappedSecondArr = secondArr.map(function (item) {
97
+ return mapper(item);
98
+ });
99
+ return firstArr.filter(function (item) {
82
100
  return !mappedSecondArr.includes(mapper(item));
83
101
  });
84
102
  }
85
103
 
86
- // 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
+ */
87
125
  function differenceWith(firstArr, secondArr, areItemsEqual) {
88
- return firstArr.filter((firstItem) => {
89
- return secondArr.every((secondItem) => {
126
+ return firstArr.filter(function (firstItem) {
127
+ return secondArr.every(function (secondItem) {
90
128
  return !areItemsEqual(firstItem, secondItem);
91
129
  });
92
130
  });
93
131
  }
94
132
 
95
- // 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
+ */
96
148
  function drop(arr, itemsCount) {
97
149
  return arr.slice(itemsCount);
98
150
  }
99
151
 
100
- // 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
+ */
101
167
  function dropRight(arr, itemsCount) {
102
168
  return arr.slice(0, -itemsCount);
103
169
  }
104
170
 
105
- // 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
+ */
106
188
  function dropWhile(arr, canContinueDropping) {
107
- const dropEndIndex = arr.findIndex((item) => !canContinueDropping(item));
189
+ var dropEndIndex = arr.findIndex(function (item) {
190
+ return !canContinueDropping(item);
191
+ });
108
192
  return arr.slice(dropEndIndex);
109
193
  }
110
194
 
111
- // 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
+ */
112
212
  function dropRightWhile(arr, canContinueDropping) {
113
- const reversed = arr.slice().reverse();
114
- const dropped = dropWhile(reversed, canContinueDropping);
213
+ var reversed = arr.slice().reverse();
214
+ var dropped = dropWhile(reversed, canContinueDropping);
115
215
  return dropped.slice().reverse();
116
216
  }
117
217
 
118
- // src/array/groupBy.ts
218
+ function _toConsumableArray(arr) {
219
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
220
+ }
221
+ function _arrayWithoutHoles(arr) {
222
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
223
+ }
224
+ function _iterableToArray(iter) {
225
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
226
+ }
227
+ function _unsupportedIterableToArray(o, minLen) {
228
+ if (!o) return;
229
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
230
+ var n = Object.prototype.toString.call(o).slice(8, -1);
231
+ if (n === "Object" && o.constructor) n = o.constructor.name;
232
+ if (n === "Map" || n === "Set") return Array.from(o);
233
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
234
+ }
235
+ function _arrayLikeToArray(arr, len) {
236
+ if (len == null || len > arr.length) len = arr.length;
237
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
238
+ return arr2;
239
+ }
240
+ function _nonIterableSpread() {
241
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
242
+ }
243
+ function _createForOfIteratorHelper(o, allowArrayLike) {
244
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
245
+ if (!it) {
246
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
247
+ if (it) o = it;
248
+ var i = 0;
249
+ var F = function () {};
250
+ return {
251
+ s: F,
252
+ n: function () {
253
+ if (i >= o.length) return {
254
+ done: true
255
+ };
256
+ return {
257
+ done: false,
258
+ value: o[i++]
259
+ };
260
+ },
261
+ e: function (e) {
262
+ throw e;
263
+ },
264
+ f: F
265
+ };
266
+ }
267
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
268
+ }
269
+ var normalCompletion = true,
270
+ didErr = false,
271
+ err;
272
+ return {
273
+ s: function () {
274
+ it = it.call(o);
275
+ },
276
+ n: function () {
277
+ var step = it.next();
278
+ normalCompletion = step.done;
279
+ return step;
280
+ },
281
+ e: function (e) {
282
+ didErr = true;
283
+ err = e;
284
+ },
285
+ f: function () {
286
+ try {
287
+ if (!normalCompletion && it.return != null) it.return();
288
+ } finally {
289
+ if (didErr) throw err;
290
+ }
291
+ }
292
+ };
293
+ }
294
+
295
+ /**
296
+ * Groups the elements of an array based on a provided key-generating function.
297
+ *
298
+ * This function takes an array and a function that generates a key from each element. It returns
299
+ * an object where the keys are the generated keys and the values are arrays of elements that share
300
+ * the same key.
301
+ *
302
+ * @param {T[]} arr - The array to group.
303
+ * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.
304
+ * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that
305
+ * share that key.
306
+ *
307
+ * @example
308
+ * const array = [
309
+ * { category: 'fruit', name: 'apple' },
310
+ * { category: 'fruit', name: 'banana' },
311
+ * { category: 'vegetable', name: 'carrot' }
312
+ * ];
313
+ * const result = groupBy(array, item => item.category);
314
+ * // result will be:
315
+ * // {
316
+ * // fruit: [
317
+ * // { category: 'fruit', name: 'apple' },
318
+ * // { category: 'fruit', name: 'banana' }
319
+ * // ],
320
+ * // vegetable: [
321
+ * // { category: 'vegetable', name: 'carrot' }
322
+ * // ]
323
+ * // }
324
+ */
119
325
  function groupBy(arr, getKeyFromItem) {
120
- const result = {};
121
- for (const item of arr) {
122
- const key = getKeyFromItem(item);
123
- if (result[key] == null) {
124
- result[key] = [];
326
+ var result = {};
327
+ var _iterator = _createForOfIteratorHelper(arr),
328
+ _step;
329
+ try {
330
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
331
+ var item = _step.value;
332
+ var key = getKeyFromItem(item);
333
+ if (result[key] == null) {
334
+ result[key] = [];
335
+ }
336
+ result[key].push(item);
125
337
  }
126
- result[key].push(item);
338
+ } catch (err) {
339
+ _iterator.e(err);
340
+ } finally {
341
+ _iterator.f();
127
342
  }
128
343
  return result;
129
344
  }
130
345
 
131
- // src/array/intersection.ts
346
+ /**
347
+ * Returns the intersection of two arrays.
348
+ *
349
+ * This function takes two arrays and returns a new array containing the elements that are
350
+ * present in both arrays. It effectively filters out any elements from the first array that
351
+ * are not found in the second array.
352
+ *
353
+ * @param {T[]} firstArr - The first array to compare.
354
+ * @param {T[]} secondArr - The second array to compare.
355
+ * @returns {T[]} A new array containing the elements that are present in both arrays.
356
+ *
357
+ * @example
358
+ * const array1 = [1, 2, 3, 4, 5];
359
+ * const array2 = [3, 4, 5, 6, 7];
360
+ * const result = intersection(array1, array2);
361
+ * // result will be [3, 4, 5] since these elements are in both arrays.
362
+ */
132
363
  function intersection(firstArr, secondArr) {
133
- return firstArr.filter((item) => {
364
+ return firstArr.filter(function (item) {
134
365
  return secondArr.includes(item);
135
366
  });
136
367
  }
137
368
 
138
- // src/array/intersectionBy.ts
369
+ /**
370
+ * Returns the intersection of two arrays based on a mapping function.
371
+ *
372
+ * This function takes two arrays and a mapping function. It returns a new array containing
373
+ * the elements from the first array that, when mapped using the provided function, have matching
374
+ * mapped elements in the second array. It effectively filters out any elements from the first array
375
+ * that do not have corresponding mapped values in the second array.
376
+ *
377
+ * @param {T[]} firstArr - The first array to compare.
378
+ * @param {T[]} secondArr - The second array to compare.
379
+ * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.
380
+ * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.
381
+ *
382
+ * @example
383
+ * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
384
+ * const array2 = [{ id: 2 }, { id: 4 }];
385
+ * const mapper = item => item.id;
386
+ * const result = intersectionBy(array1, array2, mapper);
387
+ * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.
388
+ */
139
389
  function intersectionBy(firstArr, secondArr, mapper) {
140
- const mappedSecondArr = secondArr.map((x) => mapper(x));
141
- return firstArr.filter((item) => {
390
+ var mappedSecondArr = secondArr.map(function (x) {
391
+ return mapper(x);
392
+ });
393
+ return firstArr.filter(function (item) {
142
394
  return mappedSecondArr.includes(mapper(item));
143
395
  });
144
396
  }
145
397
 
146
- // src/array/intersectionWith.ts
398
+ /**
399
+ * Returns the intersection of two arrays based on a custom equality function.
400
+ *
401
+ * This function takes two arrays and a custom equality function. It returns a new array containing
402
+ * the elements from the first array that have matching elements in the second array, as determined
403
+ * by the custom equality function. It effectively filters out any elements from the first array that
404
+ * do not have corresponding matches in the second array according to the equality function.
405
+ *
406
+ * @param {T[]} firstArr - The first array to compare.
407
+ * @param {T[]} secondArr - The second array to compare.
408
+ * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
409
+ * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.
410
+ * @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.
411
+ *
412
+ * @example
413
+ * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
414
+ * const array2 = [{ id: 2 }, { id: 4 }];
415
+ * const areItemsEqual = (a, b) => a.id === b.id;
416
+ * const result = intersectionWith(array1, array2, areItemsEqual);
417
+ * // result will be [{ id: 2 }] since this element has a matching id in both arrays.
418
+ */
147
419
  function intersectionWith(firstArr, secondArr, areItemsEqual) {
148
- return firstArr.filter((firstItem) => {
149
- return secondArr.some((secondItem) => {
420
+ return firstArr.filter(function (firstItem) {
421
+ return secondArr.some(function (secondItem) {
150
422
  return areItemsEqual(firstItem, secondItem);
151
423
  });
152
424
  });
153
425
  }
154
426
 
155
- // src/array/partition.ts
427
+ /**
428
+ * Splits an array into two groups based on a predicate function.
429
+ *
430
+ * This function takes an array and a predicate function. It returns a tuple of two arrays:
431
+ * the first array contains elements for which the predicate function returns true, and
432
+ * the second array contains elements for which the predicate function returns false.
433
+ *
434
+ * @param {T[]} arr - The array to partition.
435
+ * @param {(value: T) => boolean} isInTruthy - A predicate function that determines
436
+ * whether an element should be placed in the truthy array. The function is called with each
437
+ * element of the array.
438
+ * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for
439
+ * which the predicate returned true, and the second array contains elements for which the
440
+ * predicate returned false.
441
+ *
442
+ * @example
443
+ * const array = [1, 2, 3, 4, 5];
444
+ * const isEven = x => x % 2 === 0;
445
+ * const [even, odd] = partition(array, isEven);
446
+ * // even will be [2, 4], and odd will be [1, 3, 5]
447
+ */
156
448
  function partition(arr, isInTruthy) {
157
- const truthy = [];
158
- const falsy = [];
159
- for (const item of arr) {
160
- if (isInTruthy(item)) {
161
- truthy.push(item);
162
- } else {
163
- falsy.push(item);
449
+ var truthy = [];
450
+ var falsy = [];
451
+ var _iterator = _createForOfIteratorHelper(arr),
452
+ _step;
453
+ try {
454
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
455
+ var item = _step.value;
456
+ if (isInTruthy(item)) {
457
+ truthy.push(item);
458
+ } else {
459
+ falsy.push(item);
460
+ }
164
461
  }
462
+ } catch (err) {
463
+ _iterator.e(err);
464
+ } finally {
465
+ _iterator.f();
165
466
  }
166
467
  return [truthy, falsy];
167
468
  }
168
469
 
169
- // src/array/sample.ts
470
+ /**
471
+ * Returns a random element from an array.
472
+ *
473
+ * This function takes an array and returns a single element selected randomly from the array.
474
+ *
475
+ * @param {T[]} arr - The array to sample from.
476
+ * @returns {T} A random element from the array.
477
+ *
478
+ * @example
479
+ * const array = [1, 2, 3, 4, 5];
480
+ * const randomElement = sample(array);
481
+ * // randomElement will be one of the elements from the array, selected randomly.
482
+ */
170
483
  function sample(arr) {
171
- const randomIndex = Math.floor(Math.random() * arr.length);
484
+ var randomIndex = Math.floor(Math.random() * arr.length);
172
485
  return arr[randomIndex];
173
486
  }
174
487
 
175
- // src/array/shuffle.ts
488
+ /**
489
+ * Randomizes the order of elements in an array using the Fisher-Yates algorithm.
490
+ *
491
+ * This function takes an array and returns a new array with its elements shuffled in a random order.
492
+ *
493
+ * @param {T[]} arr - The array to shuffle.
494
+ * @returns {T[]} A new array with its elements shuffled in random order.
495
+ *
496
+ * @example
497
+ * const array = [1, 2, 3, 4, 5];
498
+ * const shuffledArray = shuffle(array);
499
+ * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]
500
+ */
176
501
  function shuffle(arr) {
177
- for (let i = arr.length - 1; i >= 1; i--) {
178
- const j = Math.floor(Math.random() * (i + 1));
179
- [arr[i], arr[j]] = [arr[j], arr[i]];
502
+ /**
503
+ * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
504
+ */
505
+ for (var i = arr.length - 1; i >= 1; i--) {
506
+ var j = Math.floor(Math.random() * (i + 1));
507
+ var _ref = [arr[j], arr[i]];
508
+ arr[i] = _ref[0];
509
+ arr[j] = _ref[1];
180
510
  }
181
511
  return arr;
182
512
  }
183
513
 
184
- // src/array/take.ts
514
+ /**
515
+ * Returns a new array containing the first `count` elements from the input array `arr`.
516
+ * If `count` is greater than the length of `arr`, the entire array is returned.
517
+ *
518
+ * @template T - Type of elements in the input array.
519
+ *
520
+ * @param {T[]} arr - The array to take elements from.
521
+ * @param {number} count - The number of elements to take.
522
+ * @returns {T[]} A new array containing the first `count` elements from `arr`.
523
+ *
524
+ * @example
525
+ * // Returns [1, 2, 3]
526
+ * take([1, 2, 3, 4, 5], 3);
527
+ *
528
+ * @example
529
+ * // Returns ['a', 'b']
530
+ * take(['a', 'b', 'c'], 2);
531
+ *
532
+ * @example
533
+ * // Returns [1, 2, 3]
534
+ * take([1, 2, 3], 5);
535
+ */
185
536
  function take(arr, count) {
186
537
  return arr.slice(0, count);
187
538
  }
188
539
 
189
- // src/array/takeRight.ts
540
+ /**
541
+ * Returns a new array containing the last `count` elements from the input array `arr`.
542
+ * If `count` is greater than the length of `arr`, the entire array is returned.
543
+ *
544
+ * @param {T[]} arr - The array to take elements from.
545
+ * @param {number} count - The number of elements to take.
546
+ * @returns {T[]} A new array containing the last `count` elements from `arr`.
547
+ *
548
+ * @example
549
+ * // Returns [4, 5]
550
+ * takeRight([1, 2, 3, 4, 5], 2);
551
+ *
552
+ * @example
553
+ * // Returns ['b', 'c']
554
+ * takeRight(['a', 'b', 'c'], 2);
555
+ *
556
+ * @example
557
+ * // Returns [1, 2, 3]
558
+ * takeRight([1, 2, 3], 5);
559
+ */
190
560
  function takeRight(arr, count) {
191
561
  if (count === 0) {
192
562
  return [];
@@ -194,9 +564,25 @@ function takeRight(arr, count) {
194
564
  return arr.slice(-count);
195
565
  }
196
566
 
197
- // src/array/takeRightWhile.ts
567
+ /**
568
+ * Takes elements from the end of the array while the predicate function returns `true`.
569
+ *
570
+ * @template T - Type of elements in the input array.
571
+ *
572
+ * @param {T[]} arr - The array to take elements from.
573
+ * @param {function(T): boolean} shouldContinueTaking - The function invoked per element.
574
+ * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.
575
+ *
576
+ * @example
577
+ * // Returns [3, 2, 1]
578
+ * takeRightWhile([5, 4, 3, 2, 1], n => n < 4);
579
+ *
580
+ * @example
581
+ * // Returns []
582
+ * takeRightWhile([1, 2, 3], n => n > 3);
583
+ */
198
584
  function takeRightWhile(arr, shouldContinueTaking) {
199
- for (let i = arr.length - 1; i >= 0; i--) {
585
+ for (var i = arr.length - 1; i >= 0; i--) {
200
586
  if (!shouldContinueTaking(arr[i])) {
201
587
  return arr.slice(i + 1);
202
588
  }
@@ -204,145 +590,402 @@ function takeRightWhile(arr, shouldContinueTaking) {
204
590
  return arr.slice();
205
591
  }
206
592
 
207
- // src/array/takeWhile.ts
593
+ /**
594
+ * Returns a new array containing the leading elements of the provided array
595
+ * that satisfy the provided predicate function. It stops taking elements as soon
596
+ * as an element does not satisfy the predicate.
597
+ *
598
+ * @template T - The type of elements in the array.
599
+ * @param {T[]} arr - The array to process.
600
+ * @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.
601
+ * @returns {T[]} A new array containing the leading elements that satisfy the predicate.
602
+ *
603
+ * @example
604
+ * // Returns [1, 2]
605
+ * takeWhile([1, 2, 3, 4], x => x < 3);
606
+ *
607
+ * @example
608
+ * // Returns []
609
+ * takeWhile([1, 2, 3, 4], x => x > 3);
610
+ */
208
611
  function takeWhile(arr, shouldContinueTaking) {
209
- const result = [];
210
- for (const item of arr) {
211
- if (!shouldContinueTaking(item)) {
212
- break;
612
+ var result = [];
613
+ var _iterator = _createForOfIteratorHelper(arr),
614
+ _step;
615
+ try {
616
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
617
+ var item = _step.value;
618
+ if (!shouldContinueTaking(item)) {
619
+ break;
620
+ }
621
+ result.push(item);
213
622
  }
214
- result.push(item);
623
+ } catch (err) {
624
+ _iterator.e(err);
625
+ } finally {
626
+ _iterator.f();
215
627
  }
216
628
  return result;
217
629
  }
218
630
 
219
- // src/array/uniq.ts
631
+ /**
632
+ * Creates a duplicate-free version of an array.
633
+ *
634
+ * This function takes an array and returns a new array containing only the unique values
635
+ * from the original array, preserving the order of first occurrence.
636
+ *
637
+ * @param {T[]} arr - The array to process.
638
+ * @returns {T[]} A new array with only unique values from the original array.
639
+ *
640
+ * @example
641
+ * * const array = [1, 2, 2, 3, 4, 4, 5];
642
+ * const result = uniq(array);
643
+ * // result will be [1, 2, 3, 4, 5]
644
+ */
220
645
  function uniq(arr) {
221
- const result = [];
222
- for (const item of arr) {
223
- if (result.includes(item)) {
224
- continue;
646
+ var result = [];
647
+ var _iterator = _createForOfIteratorHelper(arr),
648
+ _step;
649
+ try {
650
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
651
+ var item = _step.value;
652
+ if (result.includes(item)) {
653
+ continue;
654
+ }
655
+ result.push(item);
225
656
  }
226
- result.push(item);
657
+ } catch (err) {
658
+ _iterator.e(err);
659
+ } finally {
660
+ _iterator.f();
227
661
  }
228
662
  return result;
229
663
  }
230
664
 
231
- // src/array/union.ts
665
+ /**
666
+ * Creates an array of unique values from all given arrays.
667
+ *
668
+ * This function takes two arrays, merges them into a single array, and returns a new array
669
+ * containing only the unique values from the merged array.
670
+ *
671
+ * @param {T[]} arr1 - The first array to merge and filter for unique values.
672
+ * @param {T[]} arr2 - The second array to merge and filter for unique values.
673
+ * @returns {T[]} A new array of unique values.
674
+ *
675
+ * @example
676
+ * const array1 = [1, 2, 3];
677
+ * const array2 = [3, 4, 5];
678
+ * const result = union(array1, array2);
679
+ * // result will be [1, 2, 3, 4, 5]
680
+ */
232
681
  function union(arr1, arr2) {
233
682
  return uniq(arr1.concat(arr2));
234
683
  }
235
684
 
236
- // src/array/unionBy.ts
685
+ /**
686
+ * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.
687
+ *
688
+ * @param {T[]} arr1 - The first array.
689
+ * @param {T[]} arr2 - The second array.
690
+ * @param {function(item: T): U} mapper - The function to map array elements to comparison values.
691
+ * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.
692
+ *
693
+ * @example
694
+ * // Custom mapping function for numbers (modulo comparison)
695
+ * const moduloMapper = (x) => x % 3;
696
+ * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);
697
+ * // Returns [1, 2, 3]
698
+ *
699
+ * @example
700
+ * // Custom mapping function for objects with an 'id' property
701
+ * const idMapper = (obj) => obj.id;
702
+ * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
703
+ * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]
704
+ */
237
705
  function unionBy(arr1, arr2, mapper) {
238
- const map = /* @__PURE__ */ new Map();
239
- for (const item of [...arr1, ...arr2]) {
240
- const key = mapper(item);
706
+ var map = new Map();
707
+ for (var _i = 0, _arr = [].concat(_toConsumableArray(arr1), _toConsumableArray(arr2)); _i < _arr.length; _i++) {
708
+ var item = _arr[_i];
709
+ var key = mapper(item);
241
710
  if (!map.has(key)) {
242
711
  map.set(key, item);
243
712
  }
244
713
  }
245
- return [...map.values()];
714
+ return _toConsumableArray(map.values());
246
715
  }
247
716
 
248
- // src/array/uniqWith.ts
717
+ /**
718
+ * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.
719
+ *
720
+ * 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.
721
+ *
722
+ * @example
723
+ * ```ts
724
+ * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
725
+ * // [1, 2, 3, 5, 7]
726
+ * ```
727
+ */
249
728
  function uniqWith(arr, areItemsEqual) {
250
- const result = [];
251
- for (const item of arr) {
252
- const isUniq = result.every((v) => !areItemsEqual(v, item));
253
- if (isUniq) {
254
- result.push(item);
729
+ var result = [];
730
+ var _iterator = _createForOfIteratorHelper(arr),
731
+ _step;
732
+ try {
733
+ var _loop = function _loop() {
734
+ var item = _step.value;
735
+ var isUniq = result.every(function (v) {
736
+ return !areItemsEqual(v, item);
737
+ });
738
+ if (isUniq) {
739
+ result.push(item);
740
+ }
741
+ };
742
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
743
+ _loop();
255
744
  }
745
+ } catch (err) {
746
+ _iterator.e(err);
747
+ } finally {
748
+ _iterator.f();
256
749
  }
257
750
  return result;
258
751
  }
259
752
 
260
- // src/array/unionWith.ts
753
+ /**
754
+ * Creates an array of unique values from two given arrays based on a custom equality function.
755
+ *
756
+ * This function takes two arrays and a custom equality function, merges the arrays, and returns
757
+ * a new array containing only the unique values as determined by the custom equality function.
758
+ *
759
+ * @param {T[]} arr1 - The first array to merge and filter for unique values.
760
+ * @param {T[]} arr2 - The second array to merge and filter for unique values.
761
+ * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
762
+ * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.
763
+ * @returns {T[]} A new array of unique values based on the custom equality function.
764
+ *
765
+ * @example
766
+ * const array1 = [{ id: 1 }, { id: 2 }];
767
+ * const array2 = [{ id: 2 }, { id: 3 }];
768
+ * const areItemsEqual = (a, b) => a.id === b.id;
769
+ * const result = unionWith(array1, array2, areItemsEqual);
770
+ * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays
771
+ */
261
772
  function unionWith(arr1, arr2, areItemsEqual) {
262
773
  return uniqWith(arr1.concat(arr2), areItemsEqual);
263
774
  }
264
775
 
265
- // src/array/uniqBy.ts
776
+ /**
777
+ * 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.
778
+ *
779
+ * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.
780
+ *
781
+ * @example
782
+ * ```ts
783
+ * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
784
+ * // [1.2, 2.1, 3.3, 5.7, 7.19]
785
+ * ```
786
+ */
266
787
  function uniqBy(arr, converter) {
267
- return uniqWith(arr, (item1, item2) => converter(item1) === converter(item2));
788
+ return uniqWith(arr, function (item1, item2) {
789
+ return converter(item1) === converter(item2);
790
+ });
268
791
  }
269
792
 
270
- // src/array/xor.ts
793
+ /**
794
+ * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
795
+ * which are in either of the arrays, but not in their intersection.
796
+ *
797
+ * @param {T[]} arr1 - The first array.
798
+ * @param {T[]} arr2 - The second array.
799
+ * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.
800
+ *
801
+ * @example
802
+ * // Returns [1, 2, 5, 6]
803
+ * xor([1, 2, 3, 4], [3, 4, 5, 6]);
804
+ *
805
+ * @example
806
+ * // Returns ['a', 'c']
807
+ * xor(['a', 'b'], ['b', 'c']);
808
+ */
271
809
  function xor(arr1, arr2) {
272
810
  return difference(union(arr1, arr2), intersection(arr1, arr2));
273
811
  }
274
812
 
275
- // src/array/xorBy.ts
813
+ /**
814
+ * Computes the symmetric difference between two arrays using a custom mapping function.
815
+ * The symmetric difference is the set of elements which are in either of the arrays,
816
+ * but not in their intersection, determined by the result of the mapping function.
817
+ *
818
+ * @template T - Type of elements in the input arrays.
819
+ * @template U - Type of the values returned by the mapping function.
820
+ *
821
+ * @param {T[]} arr1 - The first array.
822
+ * @param {T[]} arr2 - The second array.
823
+ * @param {function(item: T): U} mapper - The function to map array elements to comparison values.
824
+ * @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.
825
+ *
826
+ * @example
827
+ * // Custom mapping function for objects with an 'id' property
828
+ * const idMapper = obj => obj.id;
829
+ * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
830
+ * // Returns [{ id: 1 }, { id: 3 }]
831
+ */
276
832
  function xorBy(arr1, arr2, mapper) {
277
- const union2 = unionBy(arr1, arr2, mapper);
278
- const intersection2 = intersectionBy(arr1, arr2, mapper);
279
- return differenceBy(union2, intersection2, mapper);
833
+ var union = unionBy(arr1, arr2, mapper);
834
+ var intersection = intersectionBy(arr1, arr2, mapper);
835
+ return differenceBy(union, intersection, mapper);
280
836
  }
281
837
 
282
- // src/array/xorWith.ts
838
+ /**
839
+ * Computes the symmetric difference between two arrays using a custom equality function.
840
+ * The symmetric difference is the set of elements which are in either of the arrays,
841
+ * but not in their intersection.
842
+ *
843
+ * @template T - Type of elements in the input arrays.
844
+ *
845
+ * @param {T[]} arr1 - The first array.
846
+ * @param {T[]} arr2 - The second array.
847
+ * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.
848
+ * @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.
849
+ *
850
+ * @example
851
+ * // Custom equality function for objects with an 'id' property
852
+ * const areObjectsEqual = (a, b) => a.id === b.id;
853
+ * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);
854
+ * // Returns [{ id: 1 }, { id: 3 }]
855
+ */
283
856
  function xorWith(arr1, arr2, areElementsEqual) {
284
- const union2 = unionWith(arr1, arr2, areElementsEqual);
285
- const intersection2 = intersectionWith(arr1, arr2, areElementsEqual);
286
- return differenceWith(union2, intersection2, areElementsEqual);
287
- }
288
-
289
- // src/array/zip.ts
290
- function zip(...arrs) {
291
- const result = [];
292
- const maxIndex = Math.max(...arrs.map((x) => x.length));
293
- for (let i = 0; i < maxIndex; i++) {
294
- const element = [];
295
- for (const arr of arrs) {
296
- element.push(arr[i]);
857
+ var union = unionWith(arr1, arr2, areElementsEqual);
858
+ var intersection = intersectionWith(arr1, arr2, areElementsEqual);
859
+ return differenceWith(union, intersection, areElementsEqual);
860
+ }
861
+
862
+ /**
863
+ * Combines multiple arrays into a single array of tuples.
864
+ *
865
+ * This function takes multiple arrays and returns a new array where each element is a tuple
866
+ * containing the corresponding elements from the input arrays. If the input arrays are of
867
+ * different lengths, the resulting array will have the length of the longest input array,
868
+ * with undefined values for missing elements.
869
+ *
870
+ * @param {...T[][]} arrs - The arrays to zip together.
871
+ * @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.
872
+ *
873
+ * @example
874
+ * const arr1 = [1, 2, 3];
875
+ * const arr2 = ['a', 'b', 'c'];
876
+ * const result = zip(arr1, arr2);
877
+ * // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
878
+ *
879
+ * const arr3 = [true, false];
880
+ * const result2 = zip(arr1, arr2, arr3);
881
+ * // result2 will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
882
+ */
883
+
884
+ function zip() {
885
+ var result = [];
886
+ for (var _len = arguments.length, arrs = new Array(_len), _key = 0; _key < _len; _key++) {
887
+ arrs[_key] = arguments[_key];
888
+ }
889
+ var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (x) {
890
+ return x.length;
891
+ })));
892
+ for (var i = 0; i < maxIndex; i++) {
893
+ var element = [];
894
+ var _iterator = _createForOfIteratorHelper(arrs),
895
+ _step;
896
+ try {
897
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
898
+ var arr = _step.value;
899
+ element.push(arr[i]);
900
+ }
901
+ } catch (err) {
902
+ _iterator.e(err);
903
+ } finally {
904
+ _iterator.f();
297
905
  }
298
906
  result.push(element);
299
907
  }
300
908
  return result;
301
909
  }
302
910
 
303
- // src/array/zipWith.ts
304
- function zipWith(arr1, ...rest) {
305
- const arrs = [arr1, ...rest.slice(0, -1)];
306
- const combine = rest[rest.length - 1];
307
- const result = [];
308
- const maxIndex = Math.max(...arrs.map((arr) => arr.length));
309
- for (let i = 0; i < maxIndex; i++) {
310
- const elements = arrs.map((arr) => arr[i]);
311
- result.push(combine(...elements));
911
+ /**
912
+ * Combines multiple arrays into a single array using a custom combiner function.
913
+ *
914
+ * This function takes multiple arrays and a combiner function, and returns a new array where each element
915
+ * is the result of applying the combiner function to the corresponding elements of the input arrays.
916
+ *
917
+ * @param {T[]} arr1 - The first array to zip.
918
+ * @param {U[]} [arr2] - The second array to zip (optional).
919
+ * @param {V[]} [arr3] - The third array to zip (optional).
920
+ * @param {W[]} [arr4] - The fourth array to zip (optional).
921
+ * @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.
922
+ * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
923
+ *
924
+ * @example
925
+ * // Example usage with two arrays:
926
+ * const arr1 = [1, 2, 3];
927
+ * const arr2 = [4, 5, 6];
928
+ * const result = zipWith(arr1, arr2, (a, b) => a + b);
929
+ * // result will be [5, 7, 9]
930
+ *
931
+ * @example
932
+ * // Example usage with three arrays:
933
+ * const arr1 = [1, 2];
934
+ * const arr2 = [3, 4];
935
+ * const arr3 = [5, 6];
936
+ * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);
937
+ * // result will be [`135`, `246`]
938
+ */
939
+
940
+ function zipWith(arr1) {
941
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
942
+ rest[_key - 1] = arguments[_key];
943
+ }
944
+ var arrs = [arr1].concat(_toConsumableArray(rest.slice(0, -1)));
945
+ var combine = rest[rest.length - 1];
946
+ var result = [];
947
+ var maxIndex = Math.max.apply(Math, _toConsumableArray(arrs.map(function (arr) {
948
+ return arr.length;
949
+ })));
950
+ var _loop = function _loop(i) {
951
+ var elements = arrs.map(function (arr) {
952
+ return arr[i];
953
+ });
954
+ result.push(combine.apply(void 0, _toConsumableArray(elements)));
955
+ };
956
+ for (var i = 0; i < maxIndex; i++) {
957
+ _loop(i);
312
958
  }
313
959
  return result;
314
960
  }
315
- // Annotate the CommonJS export names for ESM import in node:
316
- 0 && (module.exports = {
317
- chunk,
318
- difference,
319
- differenceBy,
320
- differenceWith,
321
- drop,
322
- dropRight,
323
- dropRightWhile,
324
- dropWhile,
325
- groupBy,
326
- intersection,
327
- intersectionBy,
328
- intersectionWith,
329
- partition,
330
- sample,
331
- shuffle,
332
- take,
333
- takeRight,
334
- takeRightWhile,
335
- takeWhile,
336
- union,
337
- unionBy,
338
- unionWith,
339
- uniq,
340
- uniqBy,
341
- uniqWith,
342
- xor,
343
- xorBy,
344
- xorWith,
345
- zip,
346
- zipWith
347
- });
348
- //# sourceMappingURL=index.js.map
961
+
962
+ exports.chunk = chunk;
963
+ exports.difference = difference;
964
+ exports.differenceBy = differenceBy;
965
+ exports.differenceWith = differenceWith;
966
+ exports.drop = drop;
967
+ exports.dropRight = dropRight;
968
+ exports.dropRightWhile = dropRightWhile;
969
+ exports.dropWhile = dropWhile;
970
+ exports.groupBy = groupBy;
971
+ exports.intersection = intersection;
972
+ exports.intersectionBy = intersectionBy;
973
+ exports.intersectionWith = intersectionWith;
974
+ exports.partition = partition;
975
+ exports.sample = sample;
976
+ exports.shuffle = shuffle;
977
+ exports.take = take;
978
+ exports.takeRight = takeRight;
979
+ exports.takeRightWhile = takeRightWhile;
980
+ exports.takeWhile = takeWhile;
981
+ exports.union = union;
982
+ exports.unionBy = unionBy;
983
+ exports.unionWith = unionWith;
984
+ exports.uniq = uniq;
985
+ exports.uniqBy = uniqBy;
986
+ exports.uniqWith = uniqWith;
987
+ exports.xor = xor;
988
+ exports.xorBy = xorBy;
989
+ exports.xorWith = xorWith;
990
+ exports.zip = zip;
991
+ exports.zipWith = zipWith;