es-toolkit 1.0.3-dev.37 → 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 +48 -118
  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-6ZCQ5ZMB.mjs +0 -13
  290. package/dist/chunk-6ZCQ5ZMB.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-7KIXZNXS.mjs +0 -21
  296. package/dist/chunk-7KIXZNXS.mjs.map +0 -1
  297. package/dist/chunk-7OZZODAE.mjs +0 -19
  298. package/dist/chunk-7OZZODAE.mjs.map +0 -1
  299. package/dist/chunk-7PPND7QY.mjs +0 -16
  300. package/dist/chunk-7PPND7QY.mjs.map +0 -1
  301. package/dist/chunk-7SJHJHBN.mjs +0 -11
  302. package/dist/chunk-7SJHJHBN.mjs.map +0 -1
  303. package/dist/chunk-ARWKEQMQ.mjs +0 -19
  304. package/dist/chunk-ARWKEQMQ.mjs.map +0 -1
  305. package/dist/chunk-ARZ5BDR6.mjs +0 -1
  306. package/dist/chunk-ARZ5BDR6.mjs.map +0 -1
  307. package/dist/chunk-BAJC3BM7.mjs +0 -12
  308. package/dist/chunk-BAJC3BM7.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-L4Y3G6AJ.mjs +0 -23
  324. package/dist/chunk-L4Y3G6AJ.mjs.map +0 -1
  325. package/dist/chunk-LAZNLIBJ.mjs +0 -10
  326. package/dist/chunk-LAZNLIBJ.mjs.map +0 -1
  327. package/dist/chunk-MAJSPFA6.mjs +0 -1
  328. package/dist/chunk-MAJSPFA6.mjs.map +0 -1
  329. package/dist/chunk-NEMQJ2GF.mjs +0 -18
  330. package/dist/chunk-NEMQJ2GF.mjs.map +0 -1
  331. package/dist/chunk-NK2262VG.mjs +0 -9
  332. package/dist/chunk-NK2262VG.mjs.map +0 -1
  333. package/dist/chunk-NSYWEYWT.mjs +0 -13
  334. package/dist/chunk-NSYWEYWT.mjs.map +0 -1
  335. package/dist/chunk-NYVT33DR.mjs +0 -9
  336. package/dist/chunk-NYVT33DR.mjs.map +0 -1
  337. package/dist/chunk-O3DWW7O5.mjs +0 -18
  338. package/dist/chunk-O3DWW7O5.mjs.map +0 -1
  339. package/dist/chunk-O5YJUO7P.mjs +0 -13
  340. package/dist/chunk-O5YJUO7P.mjs.map +0 -1
  341. package/dist/chunk-OBMK7JO2.mjs +0 -13
  342. package/dist/chunk-OBMK7JO2.mjs.map +0 -1
  343. package/dist/chunk-OF7HQYH4.mjs +0 -9
  344. package/dist/chunk-OF7HQYH4.mjs.map +0 -1
  345. package/dist/chunk-PTQLD7TG.mjs +0 -11
  346. package/dist/chunk-PTQLD7TG.mjs.map +0 -1
  347. package/dist/chunk-PWMHSN27.mjs +0 -14
  348. package/dist/chunk-PWMHSN27.mjs.map +0 -1
  349. package/dist/chunk-QRQPLMV4.mjs +0 -16
  350. package/dist/chunk-QRQPLMV4.mjs.map +0 -1
  351. package/dist/chunk-R5DNKXDI.mjs +0 -21
  352. package/dist/chunk-R5DNKXDI.mjs.map +0 -1
  353. package/dist/chunk-RK6PRCEJ.mjs +0 -12
  354. package/dist/chunk-RK6PRCEJ.mjs.map +0 -1
  355. package/dist/chunk-RLDY4N3Q.mjs +0 -13
  356. package/dist/chunk-RLDY4N3Q.mjs.map +0 -1
  357. package/dist/chunk-RU3RXBUC.mjs +0 -17
  358. package/dist/chunk-RU3RXBUC.mjs.map +0 -1
  359. package/dist/chunk-S767XFOS.mjs +0 -10
  360. package/dist/chunk-S767XFOS.mjs.map +0 -1
  361. package/dist/chunk-SGSQKXDO.mjs +0 -15
  362. package/dist/chunk-SGSQKXDO.mjs.map +0 -1
  363. package/dist/chunk-SYQTG4N4.mjs +0 -1
  364. package/dist/chunk-SYQTG4N4.mjs.map +0 -1
  365. package/dist/chunk-T5JCRGXA.mjs +0 -1
  366. package/dist/chunk-T5JCRGXA.mjs.map +0 -1
  367. package/dist/chunk-TOLR2FNF.mjs +0 -13
  368. package/dist/chunk-TOLR2FNF.mjs.map +0 -1
  369. package/dist/chunk-U42V7PZH.mjs +0 -9
  370. package/dist/chunk-U42V7PZH.mjs.map +0 -1
  371. package/dist/chunk-UNX3KZO2.mjs +0 -17
  372. package/dist/chunk-UNX3KZO2.mjs.map +0 -1
  373. package/dist/chunk-UZP4YX7I.mjs +0 -17
  374. package/dist/chunk-UZP4YX7I.mjs.map +0 -1
  375. package/dist/chunk-VACGGQOL.mjs +0 -9
  376. package/dist/chunk-VACGGQOL.mjs.map +0 -1
  377. package/dist/chunk-VAKCSKGR.mjs +0 -17
  378. package/dist/chunk-VAKCSKGR.mjs.map +0 -1
  379. package/dist/chunk-XAJYDHCM.mjs +0 -16
  380. package/dist/chunk-XAJYDHCM.mjs.map +0 -1
  381. package/dist/chunk-XW452I77.mjs +0 -16
  382. package/dist/chunk-XW452I77.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,9 @@
1
+ import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
1
3
  /**
2
4
  * Creates a new object composed of the picked object properties.
3
5
  *
4
- * This function takes an object and an array of keys, and returns a new object that
6
+ * This function takes an object and an array of keys, and returns a new object that
5
7
  * includes only the properties corresponding to the specified keys.
6
8
  *
7
9
  * @param {T} obj - The object to pick keys from.
@@ -13,6 +15,21 @@
13
15
  * const result = pick(obj, ['a', 'c']);
14
16
  * // result will be { a: 1, c: 3 }
15
17
  */
16
- declare function pick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
18
+ function pick(obj, keys) {
19
+ var result = {};
20
+ var _iterator = _createForOfIteratorHelper(keys),
21
+ _step;
22
+ try {
23
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
24
+ var key = _step.value;
25
+ result[key] = obj[key];
26
+ }
27
+ } catch (err) {
28
+ _iterator.e(err);
29
+ } finally {
30
+ _iterator.f();
31
+ }
32
+ return result;
33
+ }
17
34
 
18
35
  export { pick };
@@ -1,12 +1,14 @@
1
+ import { slicedToArray as _slicedToArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
+
1
3
  /**
2
4
  * Creates a new object composed of the properties that satisfy the predicate function.
3
5
  *
4
- * This function takes an object and a predicate function, and returns a new object that
6
+ * This function takes an object and a predicate function, and returns a new object that
5
7
  * includes only the properties for which the predicate function returns true.
6
8
  *
7
9
  * @param {T} obj - The object to pick properties from.
8
- * @param {(value: T[keyof T], key: string) => boolean} shouldPick - A predicate function that determines
9
- * whether a property should be picked. It takes the property's key and value as arguments and returns `true`
10
+ * @param {(value: T[keyof T], key: string) => boolean} shouldPick - A predicate function that determines
11
+ * whether a property should be picked. It takes the property's key and value as arguments and returns `true`
10
12
  * if the property should be picked, and `false` otherwise.
11
13
  * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.
12
14
  *
@@ -16,6 +18,18 @@
16
18
  * const result = pickBy(obj, shouldPick);
17
19
  * // result will be { b: 'pick' }
18
20
  */
19
- declare function pickBy<T extends Record<string, any>>(obj: T, shouldPick: (value: T[keyof T], key: string) => boolean): Partial<T>;
21
+ function pickBy(obj, shouldPick) {
22
+ var result = {};
23
+ for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
24
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
25
+ key = _Object$entries$_i[0],
26
+ value = _Object$entries$_i[1];
27
+ if (!shouldPick(value, key)) {
28
+ continue;
29
+ }
30
+ result[key] = value;
31
+ }
32
+ return result;
33
+ }
20
34
 
21
35
  export { pickBy };
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Checks if a given value is null or undefined.
3
- *
4
- * This function tests whether the provided value is either `null` or `undefined`.
3
+ *
4
+ * This function tests whether the provided value is either `null` or `undefined`.
5
5
  * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.
6
- *
6
+ *
7
7
  * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.
8
8
  *
9
9
  * @param {unknown} x - The value to test for null or undefined.
@@ -17,6 +17,8 @@
17
17
  * const result2 = isNil(value2); // true
18
18
  * const result3 = isNil(value3); // false
19
19
  */
20
- declare function isNil(x: unknown): x is null | undefined;
20
+ function isNil(x) {
21
+ return x == null || x == undefined;
22
+ }
21
23
 
22
24
  export { isNil };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Checks if the given value is not null nor undefined.
3
- *
3
+ *
4
4
  * The main use of this function is to be used with TypeScript as a type predicate.
5
5
  *
6
6
  * @param {T | null | undefined} x - The value to test if it is not null nor undefined.
@@ -13,6 +13,8 @@
13
13
  * const result = arr.filter(isNotNil);
14
14
  * // result will be [1, 3]
15
15
  */
16
- declare function isNotNil<T>(x: T | null | undefined): x is T;
16
+ function isNotNil(x) {
17
+ return x != null && x != undefined;
18
+ }
17
19
 
18
20
  export { isNotNil };
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Checks if the given value is null.
3
3
  *
4
- * This function tests whether the provided value is strictly equal to `null`.
4
+ * This function tests whether the provided value is strictly equal to `null`.
5
5
  * It returns `true` if the value is `null`, and `false` otherwise.
6
6
  *
7
7
  * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.
8
- *
8
+ *
9
9
  * @param {unknown} x - The value to test if it is null.
10
10
  * @returns {x is null} True if the value is null, false otherwise.
11
11
  *
@@ -13,11 +13,13 @@
13
13
  * * const value1 = null;
14
14
  * const value2 = undefined;
15
15
  * const value3 = 42;
16
- *
16
+ *
17
17
  * console.log(isNull(value1)); // true
18
18
  * console.log(isNull(value2)); // false
19
19
  * console.log(isNull(value3)); // false
20
20
  */
21
- declare function isNull(x: unknown): x is null;
21
+ function isNull(x) {
22
+ return x === null;
23
+ }
22
24
 
23
25
  export { isNull };
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Checks if the given value is undefined.
3
3
  *
4
- * This function tests whether the provided value is strictly equal to `undefined`.
4
+ * This function tests whether the provided value is strictly equal to `undefined`.
5
5
  * It returns `true` if the value is `undefined`, and `false` otherwise.
6
- *
6
+ *
7
7
  * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.
8
8
  *
9
9
  * @param {unknown} x - The value to test if it is undefined.
@@ -13,11 +13,13 @@
13
13
  * * const value1 = undefined;
14
14
  * const value2 = null;
15
15
  * const value3 = 42;
16
- *
16
+ *
17
17
  * console.log(isUndefined(value1)); // true
18
18
  * console.log(isUndefined(value2)); // false
19
19
  * console.log(isUndefined(value3)); // false
20
20
  */
21
- declare function isUndefined(x: unknown): x is undefined;
21
+ function isUndefined(x) {
22
+ return x === undefined;
23
+ }
22
24
 
23
25
  export { isUndefined };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Delays the execution of code for a specified number of milliseconds.
3
- *
4
- * This function returns a Promise that resolves after the specified delay, allowing you to use it
3
+ *
4
+ * This function returns a Promise that resolves after the specified delay, allowing you to use it
5
5
  * with async/await to pause execution.
6
6
  *
7
7
  * @param {number} ms - The number of milliseconds to delay.
@@ -13,9 +13,13 @@
13
13
  * await delay(1000); // Delays execution for 1 second
14
14
  * console.log('End');
15
15
  * }
16
- *
16
+ *
17
17
  * foo();
18
18
  */
19
- declare function delay(ms: number): Promise<void>;
19
+ function delay(ms) {
20
+ return new Promise(function (resolve) {
21
+ setTimeout(resolve, ms);
22
+ });
23
+ }
20
24
 
21
25
  export { delay };
package/package.json CHANGED
@@ -1,163 +1,93 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.0.3-dev.37+9bde10a5",
4
+ "version": "1.0.3",
5
5
  "workspaces": [
6
6
  "docs"
7
7
  ],
8
8
  "packageManager": "yarn@4.2.2",
9
9
  "exports": {
10
10
  ".": {
11
- "import": {
12
- "types": "./dist/index.d.mts",
13
- "default": "./dist/index.mjs"
14
- },
15
- "require": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.js"
18
- }
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./esm/index.mjs",
13
+ "require": "./dist/index.js"
19
14
  },
20
15
  "./array": {
21
- "import": {
22
- "types": "./dist/array/index.d.mts",
23
- "default": "./dist/array/index.mjs"
24
- },
25
- "require": {
26
- "types": "./dist/array/index.d.ts",
27
- "default": "./dist/array/index.js"
28
- }
16
+ "types": "./dist/array/index.d.ts",
17
+ "import": "./esm/array/index.mjs",
18
+ "require": "./dist/array/index.js"
29
19
  },
30
20
  "./function": {
31
- "import": {
32
- "types": "./dist/function/index.d.mts",
33
- "default": "./dist/function/index.mjs"
34
- },
35
- "require": {
36
- "types": "./dist/function/index.d.ts",
37
- "default": "./dist/function/index.js"
38
- }
21
+ "types": "./dist/function/index.d.ts",
22
+ "import": "./esm/function/index.mjs",
23
+ "require": "./dist/function/index.js"
39
24
  },
40
25
  "./math": {
41
- "import": {
42
- "types": "./dist/math/index.d.mts",
43
- "default": "./dist/math/index.mjs"
44
- },
45
- "require": {
46
- "types": "./dist/math/index.d.ts",
47
- "default": "./dist/math/index.js"
48
- }
26
+ "types": "./dist/math/index.d.ts",
27
+ "import": "./esm/math/index.mjs",
28
+ "require": "./dist/math/index.js"
49
29
  },
50
30
  "./object": {
51
- "import": {
52
- "types": "./dist/object/index.d.mts",
53
- "default": "./dist/object/index.mjs"
54
- },
55
- "require": {
56
- "types": "./dist/object/index.d.ts",
57
- "default": "./dist/object/index.js"
58
- }
31
+ "types": "./dist/object/index.d.ts",
32
+ "import": "./esm/object/index.mjs",
33
+ "require": "./dist/object/index.js"
59
34
  },
60
35
  "./predicate": {
61
- "import": {
62
- "types": "./dist/predicate/index.d.mts",
63
- "default": "./dist/predicate/index.mjs"
64
- },
65
- "require": {
66
- "types": "./dist/predicate/index.d.ts",
67
- "default": "./dist/predicate/index.js"
68
- }
36
+ "types": "./dist/predicate/index.d.ts",
37
+ "import": "./esm/predicate/index.mjs",
38
+ "require": "./dist/predicate/index.js"
69
39
  },
70
40
  "./promise": {
71
- "import": {
72
- "types": "./dist/promise/index.d.mts",
73
- "default": "./dist/promise/index.mjs"
74
- },
75
- "require": {
76
- "types": "./dist/promise/index.d.ts",
77
- "default": "./dist/promise/index.js"
78
- }
41
+ "types": "./dist/promise/index.d.ts",
42
+ "import": "./esm/promise/index.mjs",
43
+ "require": "./dist/promise/index.js"
79
44
  },
80
45
  "./package.json": "./package.json"
81
46
  },
82
47
  "files": [
83
- "dist",
48
+ "dist/**/*",
49
+ "esm/**/*",
84
50
  "*.d.ts"
85
51
  ],
86
52
  "publishConfig": {
87
53
  "access": "public",
88
54
  "main": "./dist/index.js",
89
- "module": "./dist/index.mjs",
90
55
  "types": "./dist/index.d.ts",
91
56
  "exports": {
92
57
  ".": {
93
- "import": {
94
- "types": "./dist/index.d.mts",
95
- "default": "./dist/index.mjs"
96
- },
97
- "require": {
98
- "types": "./dist/index.d.ts",
99
- "default": "./dist/index.js"
100
- }
58
+ "types": "./dist/index.d.ts",
59
+ "import": "./esm/index.mjs",
60
+ "require": "./dist/index.js"
101
61
  },
102
62
  "./array": {
103
- "import": {
104
- "types": "./dist/array/index.d.mts",
105
- "default": "./dist/array/index.mjs"
106
- },
107
- "require": {
108
- "types": "./dist/array/index.d.ts",
109
- "default": "./dist/array/index.js"
110
- }
63
+ "types": "./dist/array/index.d.ts",
64
+ "import": "./esm/array/index.mjs",
65
+ "require": "./dist/array/index.js"
111
66
  },
112
67
  "./function": {
113
- "import": {
114
- "types": "./dist/function/index.d.mts",
115
- "default": "./dist/function/index.mjs"
116
- },
117
- "require": {
118
- "types": "./dist/function/index.d.ts",
119
- "default": "./dist/function/index.js"
120
- }
68
+ "types": "./dist/function/index.d.ts",
69
+ "import": "./esm/function/index.mjs",
70
+ "require": "./dist/function/index.js"
121
71
  },
122
72
  "./math": {
123
- "import": {
124
- "types": "./dist/math/index.d.mts",
125
- "default": "./dist/math/index.mjs"
126
- },
127
- "require": {
128
- "types": "./dist/math/index.d.ts",
129
- "default": "./dist/math/index.js"
130
- }
73
+ "types": "./dist/math/index.d.ts",
74
+ "import": "./esm/math/index.mjs",
75
+ "require": "./dist/math/index.js"
131
76
  },
132
77
  "./object": {
133
- "import": {
134
- "types": "./dist/object/index.d.mts",
135
- "default": "./dist/object/index.mjs"
136
- },
137
- "require": {
138
- "types": "./dist/object/index.d.ts",
139
- "default": "./dist/object/index.js"
140
- }
78
+ "types": "./dist/object/index.d.ts",
79
+ "import": "./esm/object/index.mjs",
80
+ "require": "./dist/object/index.js"
141
81
  },
142
82
  "./predicate": {
143
- "import": {
144
- "types": "./dist/predicate/index.d.mts",
145
- "default": "./dist/predicate/index.mjs"
146
- },
147
- "require": {
148
- "types": "./dist/predicate/index.d.ts",
149
- "default": "./dist/predicate/index.js"
150
- }
83
+ "types": "./dist/predicate/index.d.ts",
84
+ "import": "./esm/predicate/index.mjs",
85
+ "require": "./dist/predicate/index.js"
151
86
  },
152
87
  "./promise": {
153
- "import": {
154
- "types": "./dist/promise/index.d.mts",
155
- "default": "./dist/promise/index.mjs"
156
- },
157
- "require": {
158
- "types": "./dist/promise/index.d.ts",
159
- "default": "./dist/promise/index.js"
160
- }
88
+ "types": "./dist/promise/index.d.ts",
89
+ "import": "./esm/promise/index.mjs",
90
+ "require": "./dist/promise/index.js"
161
91
  },
162
92
  "./package.json": "./package.json"
163
93
  }
@@ -168,6 +98,7 @@
168
98
  "@babel/preset-typescript": "^7.24.1",
169
99
  "@changesets/changelog-github": "^0.5.0",
170
100
  "@changesets/cli": "^2.27.1",
101
+ "@toss/rollup-config": "0.2.0-canary.0",
171
102
  "@types/babel__core": "^7",
172
103
  "@types/babel__preset-env": "^7",
173
104
  "@types/broken-link-checker": "^0",
@@ -181,17 +112,16 @@
181
112
  "eslint-config-prettier": "^8.5.0",
182
113
  "lodash": "^4.17.21",
183
114
  "prettier": "^3.2.5",
184
- "tsup": "^8.1.0",
115
+ "rollup": "^2.78.0",
185
116
  "typescript": "^5.4.5",
186
117
  "vitest": "^1.5.2"
187
118
  },
188
119
  "sideEffects": false,
189
120
  "scripts": {
190
121
  "prepack": "yarn build",
191
- "build": "tsup && ./.scripts/postbuild.sh",
122
+ "build": "rm -rf dist esm && tsc -p tsconfig.json --declaration --emitDeclarationOnly --declarationDir dist && rollup -c rollup.config.js && ./.scripts/postbuild.sh",
192
123
  "test": "vitest run --coverage --typecheck"
193
124
  },
194
125
  "main": "./dist/index.js",
195
- "module": "./dist/index.mjs",
196
126
  "types": "./dist/index.d.ts"
197
127
  }
@@ -1,43 +0,0 @@
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/chunk.ts
21
- var chunk_exports = {};
22
- __export(chunk_exports, {
23
- chunk: () => chunk
24
- });
25
- module.exports = __toCommonJS(chunk_exports);
26
- function chunk(arr, size) {
27
- if (!Number.isInteger(size) || size <= 0) {
28
- throw new Error("Size must be an integer greater than zero.");
29
- }
30
- const chunkLength = Math.ceil(arr.length / size);
31
- const result = Array(chunkLength);
32
- for (let index = 0; index < chunkLength; index++) {
33
- const start = index * size;
34
- const end = start + size;
35
- result[index] = arr.slice(start, end);
36
- }
37
- return result;
38
- }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- chunk
42
- });
43
- //# sourceMappingURL=chunk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/array/chunk.ts"],"sourcesContent":["/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: T[], size: number): T[][] {\n if (!Number.isInteger(size) || size <= 0) {\n throw new Error('Size must be an integer greater than zero.');\n }\n\n const chunkLength = Math.ceil(arr.length / size);\n const result: T[][] = Array(chunkLength);\n\n for (let index = 0; index < chunkLength; index++) {\n const start = index * size;\n const end = start + size;\n \n result[index] = arr.slice(start, end);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,SAAS,MAAS,KAAU,MAAqB;AACtD,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,QAAQ,GAAG;AACxC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,cAAc,KAAK,KAAK,IAAI,SAAS,IAAI;AAC/C,QAAM,SAAgB,MAAM,WAAW;AAEvC,WAAS,QAAQ,GAAG,QAAQ,aAAa,SAAS;AAChD,UAAM,QAAQ,QAAQ;AACtB,UAAM,MAAM,QAAQ;AAEpB,WAAO,KAAK,IAAI,IAAI,MAAM,OAAO,GAAG;AAAA,EACtC;AAEA,SAAO;AACT;","names":[]}
@@ -1,8 +0,0 @@
1
- import {
2
- chunk
3
- } from "../chunk-35TWSMYS.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
5
- export {
6
- chunk
7
- };
8
- //# sourceMappingURL=chunk.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,35 +0,0 @@
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/difference.ts
21
- var difference_exports = {};
22
- __export(difference_exports, {
23
- difference: () => difference
24
- });
25
- module.exports = __toCommonJS(difference_exports);
26
- function difference(firstArr, secondArr) {
27
- return firstArr.filter((item) => {
28
- return !secondArr.includes(item);
29
- });
30
- }
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- difference
34
- });
35
- //# sourceMappingURL=difference.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/array/difference.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays.\n * \n * This function takes two arrays and returns a new array containing the elements \n * that are present in the first array but not in the second array. It effectively \n * filters out any elements from the first array that also appear in the second array.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array \n * from which elements will be compared and filtered.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array. \n * Each element in this array will be checked against the first array, and if a match is found, \n * that element will be excluded from the result.\n * @returns {T[]} A new array containing the elements that are present in the first array but not \n * in the second array.\n *\n * @example\n * * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [2, 4];\n * const result = difference(array1, array2);\n * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.\n */\nexport function difference<T>(firstArr: T[], secondArr: T[]): T[] {\n return firstArr.filter(item => {\n return !secondArr.includes(item)\n });\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,SAAS,WAAc,UAAe,WAAqB;AAChE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,UAAU,SAAS,IAAI;AAAA,EACjC,CAAC;AACH;","names":[]}
@@ -1,8 +0,0 @@
1
- import {
2
- difference
3
- } from "../chunk-PTQLD7TG.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
5
- export {
6
- difference
7
- };
8
- //# sourceMappingURL=difference.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,36 +0,0 @@
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/differenceBy.ts
21
- var differenceBy_exports = {};
22
- __export(differenceBy_exports, {
23
- differenceBy: () => differenceBy
24
- });
25
- module.exports = __toCommonJS(differenceBy_exports);
26
- function differenceBy(firstArr, secondArr, mapper) {
27
- const mappedSecondArr = secondArr.map((item) => mapper(item));
28
- return firstArr.filter((item) => {
29
- return !mappedSecondArr.includes(mapper(item));
30
- });
31
- }
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- differenceBy
35
- });
36
- //# sourceMappingURL=differenceBy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/array/differenceBy.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays after mapping their elements through a provided function.\n * \n * This function takes two arrays and a mapper function. It returns a new array containing the elements \n * that are present in the first array but not in the second array, based on the identity calculated \n * by the mapper function. \n * \n * Essentially, it filters out any elements from the first array that, when \n * mapped, match an element in the mapped version of the second array.\n *\n * @template T, U\n * @param {T[]} firstArr - The primary array from which to derive the difference. \n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function \n * is applied to each element in both arrays, and the comparison is made based on the mapped values.\n * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding \n * mapped identity in the second array.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = differenceBy(array1, array2, mapper);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.\n */\nexport function differenceBy<T, U>(firstArr: T[], secondArr: T[], mapper: (value: T) => U): T[] {\n const mappedSecondArr = secondArr.map(item => mapper(item));\n \n return firstArr.filter(item => {\n return !mappedSecondArr.includes(mapper(item));\n });\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBO,SAAS,aAAmB,UAAe,WAAgB,QAA8B;AAC9F,QAAM,kBAAkB,UAAU,IAAI,UAAQ,OAAO,IAAI,CAAC;AAE1D,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAAA,EAC/C,CAAC;AACH;","names":[]}
@@ -1,8 +0,0 @@
1
- import {
2
- differenceBy
3
- } from "../chunk-EAI6NLXI.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
5
- export {
6
- differenceBy
7
- };
8
- //# sourceMappingURL=differenceBy.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,37 +0,0 @@
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/differenceWith.ts
21
- var differenceWith_exports = {};
22
- __export(differenceWith_exports, {
23
- differenceWith: () => differenceWith
24
- });
25
- module.exports = __toCommonJS(differenceWith_exports);
26
- function differenceWith(firstArr, secondArr, areItemsEqual) {
27
- return firstArr.filter((firstItem) => {
28
- return secondArr.every((secondItem) => {
29
- return !areItemsEqual(firstItem, secondItem);
30
- });
31
- });
32
- }
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- differenceWith
36
- });
37
- //# sourceMappingURL=differenceWith.js.map