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,7 +1,7 @@
1
1
  /**
2
2
  * Removes a specified number of elements from the end of an array and returns the rest.
3
- *
4
- * This function takes an array and a number, and returns a new array with the specified number
3
+ *
4
+ * This function takes an array and a number, and returns a new array with the specified number
5
5
  * of elements removed from the end.
6
6
  *
7
7
  * @param {T[]} arr - The array from which to drop elements.
@@ -13,6 +13,8 @@
13
13
  * const result = dropRight(array, 2);
14
14
  * // result will be [1, 2, 3] since the last two elements are dropped.
15
15
  */
16
- declare function dropRight<T>(arr: T[], itemsCount: number): T[];
16
+ function dropRight(arr, itemsCount) {
17
+ return arr.slice(0, -itemsCount);
18
+ }
17
19
 
18
20
  export { dropRight };
@@ -1,12 +1,14 @@
1
+ import { dropWhile } from './dropWhile.mjs';
2
+
1
3
  /**
2
4
  * Removes elements from the end of an array until the predicate returns false.
3
- *
4
- * This function iterates over an array from the end and drops elements until the provided
5
+ *
6
+ * This function iterates over an array from the end and drops elements until the provided
5
7
  * predicate function returns false. It then returns a new array with the remaining elements.
6
8
  *
7
9
  * @param {T[]} arr - The array from which to drop elements.
8
- * @param {function(item: T): boolean} canContinueDropping - A predicate function that determines
9
- * whether to continue dropping elements. The function is called with each element from the end,
10
+ * @param {function(item: T): boolean} canContinueDropping - A predicate function that determines
11
+ * whether to continue dropping elements. The function is called with each element from the end,
10
12
  * and dropping continues as long as it returns true.
11
13
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
12
14
  *
@@ -15,6 +17,10 @@
15
17
  * const result = dropRightWhile(array, x => x > 3);
16
18
  * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.
17
19
  */
18
- declare function dropRightWhile<T>(arr: T[], canContinueDropping: (item: T) => boolean): T[];
20
+ function dropRightWhile(arr, canContinueDropping) {
21
+ var reversed = arr.slice().reverse();
22
+ var dropped = dropWhile(reversed, canContinueDropping);
23
+ return dropped.slice().reverse();
24
+ }
19
25
 
20
26
  export { dropRightWhile };
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Removes elements from the beginning of an array until the predicate returns false.
3
- *
4
- * This function iterates over an array and drops elements from the start until the provided
3
+ *
4
+ * This function iterates over an array and drops elements from the start until the provided
5
5
  * predicate function returns false. It then returns a new array with the remaining elements.
6
6
  *
7
7
  * @param {T[]} arr - The array from which to drop elements.
8
- * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
9
- * whether to continue dropping elements. The function is called with each element, and dropping
8
+ * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
9
+ * whether to continue dropping elements. The function is called with each element, and dropping
10
10
  * continues as long as it returns true.
11
11
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
12
12
  *
@@ -15,6 +15,11 @@
15
15
  * const result = dropWhile(array, x => x < 3);
16
16
  * // result will be [3, 4, 5] since elements less than 3 are dropped.
17
17
  */
18
- declare function dropWhile<T>(arr: T[], canContinueDropping: (item: T) => boolean): T[];
18
+ function dropWhile(arr, canContinueDropping) {
19
+ var dropEndIndex = arr.findIndex(function (item) {
20
+ return !canContinueDropping(item);
21
+ });
22
+ return arr.slice(dropEndIndex);
23
+ }
19
24
 
20
25
  export { dropWhile };
@@ -1,13 +1,15 @@
1
+ import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
1
3
  /**
2
4
  * Groups the elements of an array based on a provided key-generating function.
3
- *
4
- * This function takes an array and a function that generates a key from each element. It returns
5
- * an object where the keys are the generated keys and the values are arrays of elements that share
5
+ *
6
+ * This function takes an array and a function that generates a key from each element. It returns
7
+ * an object where the keys are the generated keys and the values are arrays of elements that share
6
8
  * the same key.
7
9
  *
8
10
  * @param {T[]} arr - The array to group.
9
11
  * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.
10
- * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that
12
+ * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that
11
13
  * share that key.
12
14
  *
13
15
  * @example
@@ -28,6 +30,25 @@
28
30
  * // ]
29
31
  * // }
30
32
  */
31
- declare function groupBy<T, K extends string>(arr: T[], getKeyFromItem: (item: T) => K): Record<K, T[]>;
33
+ function groupBy(arr, getKeyFromItem) {
34
+ var result = {};
35
+ var _iterator = _createForOfIteratorHelper(arr),
36
+ _step;
37
+ try {
38
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
39
+ var item = _step.value;
40
+ var key = getKeyFromItem(item);
41
+ if (result[key] == null) {
42
+ result[key] = [];
43
+ }
44
+ result[key].push(item);
45
+ }
46
+ } catch (err) {
47
+ _iterator.e(err);
48
+ } finally {
49
+ _iterator.f();
50
+ }
51
+ return result;
52
+ }
32
53
 
33
54
  export { groupBy };
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Returns the intersection of two arrays.
3
- *
4
- * This function takes two arrays and returns a new array containing the elements that are
5
- * present in both arrays. It effectively filters out any elements from the first array that
3
+ *
4
+ * This function takes two arrays and returns a new array containing the elements that are
5
+ * present in both arrays. It effectively filters out any elements from the first array that
6
6
  * are not found in the second array.
7
7
  *
8
8
  * @param {T[]} firstArr - The first array to compare.
@@ -15,6 +15,10 @@
15
15
  * const result = intersection(array1, array2);
16
16
  * // result will be [3, 4, 5] since these elements are in both arrays.
17
17
  */
18
- declare function intersection<T>(firstArr: T[], secondArr: T[]): T[];
18
+ function intersection(firstArr, secondArr) {
19
+ return firstArr.filter(function (item) {
20
+ return secondArr.includes(item);
21
+ });
22
+ }
19
23
 
20
24
  export { intersection };
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Returns the intersection of two arrays based on a mapping function.
3
- *
4
- * This function takes two arrays and a mapping function. It returns a new array containing
5
- * the elements from the first array that, when mapped using the provided function, have matching
6
- * mapped elements in the second array. It effectively filters out any elements from the first array
3
+ *
4
+ * This function takes two arrays and a mapping function. It returns a new array containing
5
+ * the elements from the first array that, when mapped using the provided function, have matching
6
+ * mapped elements in the second array. It effectively filters out any elements from the first array
7
7
  * that do not have corresponding mapped values in the second array.
8
8
  *
9
9
  * @param {T[]} firstArr - The first array to compare.
@@ -18,6 +18,13 @@
18
18
  * const result = intersectionBy(array1, array2, mapper);
19
19
  * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.
20
20
  */
21
- declare function intersectionBy<T, U>(firstArr: T[], secondArr: T[], mapper: (item: T) => U): T[];
21
+ function intersectionBy(firstArr, secondArr, mapper) {
22
+ var mappedSecondArr = secondArr.map(function (x) {
23
+ return mapper(x);
24
+ });
25
+ return firstArr.filter(function (item) {
26
+ return mappedSecondArr.includes(mapper(item));
27
+ });
28
+ }
22
29
 
23
30
  export { intersectionBy };
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * Returns the intersection of two arrays based on a custom equality function.
3
- *
4
- * This function takes two arrays and a custom equality function. It returns a new array containing
5
- * the elements from the first array that have matching elements in the second array, as determined
6
- * by the custom equality function. It effectively filters out any elements from the first array that
3
+ *
4
+ * This function takes two arrays and a custom equality function. It returns a new array containing
5
+ * the elements from the first array that have matching elements in the second array, as determined
6
+ * by the custom equality function. It effectively filters out any elements from the first array that
7
7
  * do not have corresponding matches in the second array according to the equality function.
8
8
  *
9
9
  * @param {T[]} firstArr - The first array to compare.
10
10
  * @param {T[]} secondArr - The second array to compare.
11
- * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
11
+ * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
12
12
  * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.
13
13
  * @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.
14
14
  *
@@ -19,6 +19,12 @@
19
19
  * const result = intersectionWith(array1, array2, areItemsEqual);
20
20
  * // result will be [{ id: 2 }] since this element has a matching id in both arrays.
21
21
  */
22
- declare function intersectionWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[];
22
+ function intersectionWith(firstArr, secondArr, areItemsEqual) {
23
+ return firstArr.filter(function (firstItem) {
24
+ return secondArr.some(function (secondItem) {
25
+ return areItemsEqual(firstItem, secondItem);
26
+ });
27
+ });
28
+ }
23
29
 
24
30
  export { intersectionWith };
@@ -1,16 +1,18 @@
1
+ import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
1
3
  /**
2
4
  * Splits an array into two groups based on a predicate function.
3
- *
4
- * This function takes an array and a predicate function. It returns a tuple of two arrays:
5
- * the first array contains elements for which the predicate function returns true, and
5
+ *
6
+ * This function takes an array and a predicate function. It returns a tuple of two arrays:
7
+ * the first array contains elements for which the predicate function returns true, and
6
8
  * the second array contains elements for which the predicate function returns false.
7
9
  *
8
10
  * @param {T[]} arr - The array to partition.
9
- * @param {(value: T) => boolean} isInTruthy - A predicate function that determines
10
- * whether an element should be placed in the truthy array. The function is called with each
11
+ * @param {(value: T) => boolean} isInTruthy - A predicate function that determines
12
+ * whether an element should be placed in the truthy array. The function is called with each
11
13
  * element of the array.
12
- * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for
13
- * which the predicate returned true, and the second array contains elements for which the
14
+ * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for
15
+ * which the predicate returned true, and the second array contains elements for which the
14
16
  * predicate returned false.
15
17
  *
16
18
  * @example
@@ -19,6 +21,26 @@
19
21
  * const [even, odd] = partition(array, isEven);
20
22
  * // even will be [2, 4], and odd will be [1, 3, 5]
21
23
  */
22
- declare function partition<T>(arr: T[], isInTruthy: (value: T) => boolean): [truthy: T[], falsy: T[]];
24
+ function partition(arr, isInTruthy) {
25
+ var truthy = [];
26
+ var falsy = [];
27
+ var _iterator = _createForOfIteratorHelper(arr),
28
+ _step;
29
+ try {
30
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
31
+ var item = _step.value;
32
+ if (isInTruthy(item)) {
33
+ truthy.push(item);
34
+ } else {
35
+ falsy.push(item);
36
+ }
37
+ }
38
+ } catch (err) {
39
+ _iterator.e(err);
40
+ } finally {
41
+ _iterator.f();
42
+ }
43
+ return [truthy, falsy];
44
+ }
23
45
 
24
46
  export { partition };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Returns a random element from an array.
3
- *
3
+ *
4
4
  * This function takes an array and returns a single element selected randomly from the array.
5
5
  *
6
6
  * @param {T[]} arr - The array to sample from.
@@ -11,6 +11,9 @@
11
11
  * const randomElement = sample(array);
12
12
  * // randomElement will be one of the elements from the array, selected randomly.
13
13
  */
14
- declare function sample<T>(arr: T[]): T;
14
+ function sample(arr) {
15
+ var randomIndex = Math.floor(Math.random() * arr.length);
16
+ return arr[randomIndex];
17
+ }
15
18
 
16
19
  export { sample };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Randomizes the order of elements in an array using the Fisher-Yates algorithm.
3
- *
3
+ *
4
4
  * This function takes an array and returns a new array with its elements shuffled in a random order.
5
5
  *
6
6
  * @param {T[]} arr - The array to shuffle.
@@ -11,6 +11,17 @@
11
11
  * const shuffledArray = shuffle(array);
12
12
  * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]
13
13
  */
14
- declare function shuffle<T>(arr: T[]): T[];
14
+ function shuffle(arr) {
15
+ /**
16
+ * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
17
+ */
18
+ for (var i = arr.length - 1; i >= 1; i--) {
19
+ var j = Math.floor(Math.random() * (i + 1));
20
+ var _ref = [arr[j], arr[i]];
21
+ arr[i] = _ref[0];
22
+ arr[j] = _ref[1];
23
+ }
24
+ return arr;
25
+ }
15
26
 
16
27
  export { shuffle };
@@ -3,23 +3,25 @@
3
3
  * If `count` is greater than the length of `arr`, the entire array is returned.
4
4
  *
5
5
  * @template T - Type of elements in the input array.
6
- *
6
+ *
7
7
  * @param {T[]} arr - The array to take elements from.
8
8
  * @param {number} count - The number of elements to take.
9
9
  * @returns {T[]} A new array containing the first `count` elements from `arr`.
10
- *
10
+ *
11
11
  * @example
12
12
  * // Returns [1, 2, 3]
13
13
  * take([1, 2, 3, 4, 5], 3);
14
- *
14
+ *
15
15
  * @example
16
16
  * // Returns ['a', 'b']
17
17
  * take(['a', 'b', 'c'], 2);
18
- *
18
+ *
19
19
  * @example
20
20
  * // Returns [1, 2, 3]
21
21
  * take([1, 2, 3], 5);
22
22
  */
23
- declare function take<T>(arr: T[], count: number): T[];
23
+ function take(arr, count) {
24
+ return arr.slice(0, count);
25
+ }
24
26
 
25
27
  export { take };
@@ -1,23 +1,28 @@
1
1
  /**
2
2
  * Returns a new array containing the last `count` elements from the input array `arr`.
3
3
  * If `count` is greater than the length of `arr`, the entire array is returned.
4
- *
4
+ *
5
5
  * @param {T[]} arr - The array to take elements from.
6
6
  * @param {number} count - The number of elements to take.
7
7
  * @returns {T[]} A new array containing the last `count` elements from `arr`.
8
- *
8
+ *
9
9
  * @example
10
10
  * // Returns [4, 5]
11
11
  * takeRight([1, 2, 3, 4, 5], 2);
12
- *
12
+ *
13
13
  * @example
14
14
  * // Returns ['b', 'c']
15
15
  * takeRight(['a', 'b', 'c'], 2);
16
- *
16
+ *
17
17
  * @example
18
18
  * // Returns [1, 2, 3]
19
19
  * takeRight([1, 2, 3], 5);
20
20
  */
21
- declare function takeRight<T>(arr: T[], count: number): T[];
21
+ function takeRight(arr, count) {
22
+ if (count === 0) {
23
+ return [];
24
+ }
25
+ return arr.slice(-count);
26
+ }
22
27
 
23
28
  export { takeRight };
@@ -1,20 +1,27 @@
1
1
  /**
2
2
  * Takes elements from the end of the array while the predicate function returns `true`.
3
- *
3
+ *
4
4
  * @template T - Type of elements in the input array.
5
- *
5
+ *
6
6
  * @param {T[]} arr - The array to take elements from.
7
7
  * @param {function(T): boolean} shouldContinueTaking - The function invoked per element.
8
8
  * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.
9
- *
9
+ *
10
10
  * @example
11
11
  * // Returns [3, 2, 1]
12
12
  * takeRightWhile([5, 4, 3, 2, 1], n => n < 4);
13
- *
13
+ *
14
14
  * @example
15
15
  * // Returns []
16
16
  * takeRightWhile([1, 2, 3], n => n > 3);
17
17
  */
18
- declare function takeRightWhile<T>(arr: T[], shouldContinueTaking: (item: T) => boolean): T[];
18
+ function takeRightWhile(arr, shouldContinueTaking) {
19
+ for (var i = arr.length - 1; i >= 0; i--) {
20
+ if (!shouldContinueTaking(arr[i])) {
21
+ return arr.slice(i + 1);
22
+ }
23
+ }
24
+ return arr.slice();
25
+ }
19
26
 
20
27
  export { takeRightWhile };
@@ -1,3 +1,5 @@
1
+ import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
1
3
  /**
2
4
  * Returns a new array containing the leading elements of the provided array
3
5
  * that satisfy the provided predicate function. It stops taking elements as soon
@@ -16,6 +18,24 @@
16
18
  * // Returns []
17
19
  * takeWhile([1, 2, 3, 4], x => x > 3);
18
20
  */
19
- declare function takeWhile<T>(arr: T[], shouldContinueTaking: (element: T) => boolean): T[];
21
+ function takeWhile(arr, shouldContinueTaking) {
22
+ var result = [];
23
+ var _iterator = _createForOfIteratorHelper(arr),
24
+ _step;
25
+ try {
26
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
27
+ var item = _step.value;
28
+ if (!shouldContinueTaking(item)) {
29
+ break;
30
+ }
31
+ result.push(item);
32
+ }
33
+ } catch (err) {
34
+ _iterator.e(err);
35
+ } finally {
36
+ _iterator.f();
37
+ }
38
+ return result;
39
+ }
20
40
 
21
41
  export { takeWhile };
@@ -1,7 +1,9 @@
1
+ import { uniq } from './uniq.mjs';
2
+
1
3
  /**
2
4
  * Creates an array of unique values from all given arrays.
3
- *
4
- * This function takes two arrays, merges them into a single array, and returns a new array
5
+ *
6
+ * This function takes two arrays, merges them into a single array, and returns a new array
5
7
  * containing only the unique values from the merged array.
6
8
  *
7
9
  * @param {T[]} arr1 - The first array to merge and filter for unique values.
@@ -14,6 +16,8 @@
14
16
  * const result = union(array1, array2);
15
17
  * // result will be [1, 2, 3, 4, 5]
16
18
  */
17
- declare function union<T>(arr1: T[], arr2: T[]): T[];
19
+ function union(arr1, arr2) {
20
+ return uniq(arr1.concat(arr2));
21
+ }
18
22
 
19
23
  export { union };
@@ -1,23 +1,35 @@
1
+ import { toConsumableArray as _toConsumableArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
1
3
  /**
2
4
  * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.
3
- *
5
+ *
4
6
  * @param {T[]} arr1 - The first array.
5
7
  * @param {T[]} arr2 - The second array.
6
8
  * @param {function(item: T): U} mapper - The function to map array elements to comparison values.
7
9
  * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.
8
- *
10
+ *
9
11
  * @example
10
12
  * // Custom mapping function for numbers (modulo comparison)
11
13
  * const moduloMapper = (x) => x % 3;
12
14
  * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);
13
15
  * // Returns [1, 2, 3]
14
- *
16
+ *
15
17
  * @example
16
18
  * // Custom mapping function for objects with an 'id' property
17
19
  * const idMapper = (obj) => obj.id;
18
20
  * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
19
21
  * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]
20
22
  */
21
- declare function unionBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[];
23
+ function unionBy(arr1, arr2, mapper) {
24
+ var map = new Map();
25
+ for (var _i = 0, _arr = [].concat(_toConsumableArray(arr1), _toConsumableArray(arr2)); _i < _arr.length; _i++) {
26
+ var item = _arr[_i];
27
+ var key = mapper(item);
28
+ if (!map.has(key)) {
29
+ map.set(key, item);
30
+ }
31
+ }
32
+ return _toConsumableArray(map.values());
33
+ }
22
34
 
23
35
  export { unionBy };
@@ -1,12 +1,14 @@
1
+ import { uniqWith } from './uniqWith.mjs';
2
+
1
3
  /**
2
4
  * Creates an array of unique values from two given arrays based on a custom equality function.
3
- *
4
- * This function takes two arrays and a custom equality function, merges the arrays, and returns
5
+ *
6
+ * This function takes two arrays and a custom equality function, merges the arrays, and returns
5
7
  * a new array containing only the unique values as determined by the custom equality function.
6
8
  *
7
9
  * @param {T[]} arr1 - The first array to merge and filter for unique values.
8
10
  * @param {T[]} arr2 - The second array to merge and filter for unique values.
9
- * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
11
+ * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
10
12
  * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.
11
13
  * @returns {T[]} A new array of unique values based on the custom equality function.
12
14
  *
@@ -17,6 +19,8 @@
17
19
  * const result = unionWith(array1, array2, areItemsEqual);
18
20
  * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays
19
21
  */
20
- declare function unionWith<T>(arr1: T[], arr2: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[];
22
+ function unionWith(arr1, arr2, areItemsEqual) {
23
+ return uniqWith(arr1.concat(arr2), areItemsEqual);
24
+ }
21
25
 
22
26
  export { unionWith };
@@ -0,0 +1,37 @@
1
+ import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
3
+ /**
4
+ * Creates a duplicate-free version of an array.
5
+ *
6
+ * This function takes an array and returns a new array containing only the unique values
7
+ * from the original array, preserving the order of first occurrence.
8
+ *
9
+ * @param {T[]} arr - The array to process.
10
+ * @returns {T[]} A new array with only unique values from the original array.
11
+ *
12
+ * @example
13
+ * * const array = [1, 2, 2, 3, 4, 4, 5];
14
+ * const result = uniq(array);
15
+ * // result will be [1, 2, 3, 4, 5]
16
+ */
17
+ function uniq(arr) {
18
+ var result = [];
19
+ var _iterator = _createForOfIteratorHelper(arr),
20
+ _step;
21
+ try {
22
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
23
+ var item = _step.value;
24
+ if (result.includes(item)) {
25
+ continue;
26
+ }
27
+ result.push(item);
28
+ }
29
+ } catch (err) {
30
+ _iterator.e(err);
31
+ } finally {
32
+ _iterator.f();
33
+ }
34
+ return result;
35
+ }
36
+
37
+ export { uniq };
@@ -1,3 +1,5 @@
1
+ import { uniqWith } from './uniqWith.mjs';
2
+
1
3
  /**
2
4
  * 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.
3
5
  *
@@ -9,6 +11,10 @@
9
11
  * // [1.2, 2.1, 3.3, 5.7, 7.19]
10
12
  * ```
11
13
  */
12
- declare function uniqBy<T, U>(arr: T[], converter: (item: T) => U): T[];
14
+ function uniqBy(arr, converter) {
15
+ return uniqWith(arr, function (item1, item2) {
16
+ return converter(item1) === converter(item2);
17
+ });
18
+ }
13
19
 
14
20
  export { uniqBy };
@@ -0,0 +1,39 @@
1
+ import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
3
+ /**
4
+ * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.
5
+ *
6
+ * 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.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
11
+ * // [1, 2, 3, 5, 7]
12
+ * ```
13
+ */
14
+ function uniqWith(arr, areItemsEqual) {
15
+ var result = [];
16
+ var _iterator = _createForOfIteratorHelper(arr),
17
+ _step;
18
+ try {
19
+ var _loop = function _loop() {
20
+ var item = _step.value;
21
+ var isUniq = result.every(function (v) {
22
+ return !areItemsEqual(v, item);
23
+ });
24
+ if (isUniq) {
25
+ result.push(item);
26
+ }
27
+ };
28
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
29
+ _loop();
30
+ }
31
+ } catch (err) {
32
+ _iterator.e(err);
33
+ } finally {
34
+ _iterator.f();
35
+ }
36
+ return result;
37
+ }
38
+
39
+ export { uniqWith };