es-toolkit 1.6.1-dev.137 → 1.6.1-dev.139

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 (291) hide show
  1. package/dist/array/compact.d.mts +1 -0
  2. package/dist/array/compact.d.ts +1 -0
  3. package/dist/array/compact.js.map +1 -1
  4. package/dist/array/compact.mjs +1 -1
  5. package/dist/array/drop.d.mts +1 -0
  6. package/dist/array/drop.d.ts +1 -0
  7. package/dist/array/drop.js.map +1 -1
  8. package/dist/array/drop.mjs +1 -1
  9. package/dist/array/dropRight.d.mts +1 -0
  10. package/dist/array/dropRight.d.ts +1 -0
  11. package/dist/array/dropRight.js.map +1 -1
  12. package/dist/array/dropRight.mjs +1 -1
  13. package/dist/array/dropRightWhile.d.mts +1 -0
  14. package/dist/array/dropRightWhile.d.ts +1 -0
  15. package/dist/array/dropRightWhile.js.map +1 -1
  16. package/dist/array/dropRightWhile.mjs +2 -2
  17. package/dist/array/dropWhile.d.mts +1 -0
  18. package/dist/array/dropWhile.d.ts +1 -0
  19. package/dist/array/dropWhile.js.map +1 -1
  20. package/dist/array/dropWhile.mjs +1 -1
  21. package/dist/array/fill.d.mts +29 -0
  22. package/dist/array/fill.d.ts +29 -0
  23. package/dist/array/fill.js +38 -0
  24. package/dist/array/fill.js.map +1 -0
  25. package/dist/array/fill.mjs +8 -0
  26. package/dist/array/groupBy.d.mts +2 -0
  27. package/dist/array/groupBy.d.ts +2 -0
  28. package/dist/array/groupBy.js.map +1 -1
  29. package/dist/array/groupBy.mjs +1 -1
  30. package/dist/array/index.d.mts +1 -0
  31. package/dist/array/index.d.ts +1 -0
  32. package/dist/array/index.js +12 -0
  33. package/dist/array/index.js.map +1 -1
  34. package/dist/array/index.mjs +71 -67
  35. package/dist/array/intersection.d.mts +1 -0
  36. package/dist/array/intersection.d.ts +1 -0
  37. package/dist/array/intersection.js.map +1 -1
  38. package/dist/array/intersection.mjs +1 -1
  39. package/dist/array/intersectionBy.d.mts +2 -0
  40. package/dist/array/intersectionBy.d.ts +2 -0
  41. package/dist/array/intersectionBy.js.map +1 -1
  42. package/dist/array/intersectionBy.mjs +1 -1
  43. package/dist/array/intersectionWith.d.mts +1 -0
  44. package/dist/array/intersectionWith.d.ts +1 -0
  45. package/dist/array/intersectionWith.js.map +1 -1
  46. package/dist/array/intersectionWith.mjs +1 -1
  47. package/dist/array/keyBy.d.mts +2 -0
  48. package/dist/array/keyBy.d.ts +2 -0
  49. package/dist/array/keyBy.js.map +1 -1
  50. package/dist/array/keyBy.mjs +1 -1
  51. package/dist/array/maxBy.d.mts +1 -0
  52. package/dist/array/maxBy.d.ts +1 -0
  53. package/dist/array/maxBy.js.map +1 -1
  54. package/dist/array/maxBy.mjs +1 -1
  55. package/dist/array/minBy.d.mts +1 -0
  56. package/dist/array/minBy.d.ts +1 -0
  57. package/dist/array/minBy.js.map +1 -1
  58. package/dist/array/minBy.mjs +1 -1
  59. package/dist/array/partition.d.mts +1 -0
  60. package/dist/array/partition.d.ts +1 -0
  61. package/dist/array/partition.js.map +1 -1
  62. package/dist/array/partition.mjs +1 -1
  63. package/dist/array/sample.d.mts +1 -0
  64. package/dist/array/sample.d.ts +1 -0
  65. package/dist/array/sample.js.map +1 -1
  66. package/dist/array/sample.mjs +1 -1
  67. package/dist/array/sampleSize.d.mts +1 -0
  68. package/dist/array/sampleSize.d.ts +1 -0
  69. package/dist/array/sampleSize.js.map +1 -1
  70. package/dist/array/sampleSize.mjs +3 -3
  71. package/dist/array/shuffle.d.mts +1 -0
  72. package/dist/array/shuffle.d.ts +1 -0
  73. package/dist/array/shuffle.js.map +1 -1
  74. package/dist/array/shuffle.mjs +1 -1
  75. package/dist/array/takeRight.d.mts +1 -0
  76. package/dist/array/takeRight.d.ts +1 -0
  77. package/dist/array/takeRight.js.map +1 -1
  78. package/dist/array/takeRight.mjs +1 -1
  79. package/dist/array/union.d.mts +1 -0
  80. package/dist/array/union.d.ts +1 -0
  81. package/dist/array/union.js.map +1 -1
  82. package/dist/array/union.mjs +2 -2
  83. package/dist/array/unionBy.d.mts +2 -0
  84. package/dist/array/unionBy.d.ts +2 -0
  85. package/dist/array/unionBy.js.map +1 -1
  86. package/dist/array/unionBy.mjs +1 -1
  87. package/dist/array/unionWith.d.mts +1 -0
  88. package/dist/array/unionWith.d.ts +1 -0
  89. package/dist/array/unionWith.js.map +1 -1
  90. package/dist/array/unionWith.mjs +2 -2
  91. package/dist/array/uniq.d.mts +1 -0
  92. package/dist/array/uniq.d.ts +1 -0
  93. package/dist/array/uniq.js.map +1 -1
  94. package/dist/array/uniq.mjs +1 -1
  95. package/dist/array/uniqBy.d.mts +2 -0
  96. package/dist/array/uniqBy.d.ts +2 -0
  97. package/dist/array/uniqBy.js.map +1 -1
  98. package/dist/array/uniqBy.mjs +1 -1
  99. package/dist/array/uniqWith.d.mts +1 -0
  100. package/dist/array/uniqWith.d.ts +1 -0
  101. package/dist/array/uniqWith.js.map +1 -1
  102. package/dist/array/uniqWith.mjs +1 -1
  103. package/dist/array/xor.d.mts +1 -0
  104. package/dist/array/xor.d.ts +1 -0
  105. package/dist/array/xor.js.map +1 -1
  106. package/dist/array/xor.mjs +4 -4
  107. package/dist/array/xorBy.js.map +1 -1
  108. package/dist/array/xorBy.mjs +3 -3
  109. package/dist/array/xorWith.js.map +1 -1
  110. package/dist/array/xorWith.mjs +4 -4
  111. package/dist/array/zipObject.d.mts +2 -0
  112. package/dist/array/zipObject.d.ts +2 -0
  113. package/dist/array/zipObject.js.map +1 -1
  114. package/dist/array/zipObject.mjs +1 -1
  115. package/dist/{chunk-2PFDLYQC.mjs → chunk-237HGSZS.mjs} +1 -1
  116. package/dist/chunk-237HGSZS.mjs.map +1 -0
  117. package/dist/chunk-23O4IK6D.mjs +1 -0
  118. package/dist/chunk-23O4IK6D.mjs.map +1 -0
  119. package/dist/{chunk-DOOIIHT3.mjs → chunk-2KNLZB7V.mjs} +1 -1
  120. package/dist/chunk-2KNLZB7V.mjs.map +1 -0
  121. package/dist/{chunk-OUTSP4VR.mjs → chunk-2ZCITDMK.mjs} +2 -2
  122. package/dist/chunk-2ZCITDMK.mjs.map +1 -0
  123. package/dist/{chunk-G42NUGNE.mjs → chunk-3IP4JVLL.mjs} +1 -1
  124. package/dist/chunk-3IP4JVLL.mjs.map +1 -0
  125. package/dist/{chunk-MQWVBKUT.mjs → chunk-6CLH5YZ2.mjs} +1 -1
  126. package/dist/chunk-6CLH5YZ2.mjs.map +1 -0
  127. package/dist/{chunk-DA7GSKQ5.mjs → chunk-6GWEY5EL.mjs} +1 -1
  128. package/dist/chunk-6GWEY5EL.mjs.map +1 -0
  129. package/dist/{chunk-KSXWREB5.mjs → chunk-AJKZMN2V.mjs} +1 -1
  130. package/dist/chunk-AJKZMN2V.mjs.map +1 -0
  131. package/dist/{chunk-A67NF2C7.mjs → chunk-BCTYOXT7.mjs} +1 -1
  132. package/dist/chunk-BCTYOXT7.mjs.map +1 -0
  133. package/dist/{chunk-ZQNAZPSK.mjs → chunk-BMRTZMRE.mjs} +1 -1
  134. package/dist/chunk-BMRTZMRE.mjs.map +1 -0
  135. package/dist/chunk-C4WE4GLC.mjs +14 -0
  136. package/dist/chunk-C4WE4GLC.mjs.map +1 -0
  137. package/dist/{chunk-UFAA5WKR.mjs → chunk-CMBC4MXG.mjs} +1 -1
  138. package/dist/chunk-CMBC4MXG.mjs.map +1 -0
  139. package/dist/{chunk-JGNFYNYU.mjs → chunk-CXGIXTSH.mjs} +1 -1
  140. package/dist/chunk-CXGIXTSH.mjs.map +1 -0
  141. package/dist/{chunk-5L2V7WD3.mjs → chunk-DN3NOZ3H.mjs} +1 -1
  142. package/dist/chunk-DN3NOZ3H.mjs.map +1 -0
  143. package/dist/{chunk-NKTBEEIT.mjs → chunk-DTJJIMKJ.mjs} +1 -1
  144. package/dist/chunk-DTJJIMKJ.mjs.map +1 -0
  145. package/dist/{chunk-XFCW7XJ4.mjs → chunk-DVK2N4KC.mjs} +1 -1
  146. package/dist/chunk-DVK2N4KC.mjs.map +1 -0
  147. package/dist/{chunk-Q5XXJXXQ.mjs → chunk-DXB7EZUQ.mjs} +1 -1
  148. package/dist/chunk-DXB7EZUQ.mjs.map +1 -0
  149. package/dist/{chunk-H5YR3ZV4.mjs → chunk-E6E4RZLN.mjs} +1 -1
  150. package/dist/chunk-E6E4RZLN.mjs.map +1 -0
  151. package/dist/{chunk-PYLGHB3F.mjs → chunk-FVVSE2F2.mjs} +1 -1
  152. package/dist/chunk-FVVSE2F2.mjs.map +1 -0
  153. package/dist/{chunk-DPLJQQFX.mjs → chunk-G7UQ5PUR.mjs} +1 -1
  154. package/dist/chunk-G7UQ5PUR.mjs.map +1 -0
  155. package/dist/{chunk-OFWKFUFZ.mjs → chunk-HPFDYUGP.mjs} +1 -1
  156. package/dist/chunk-HPFDYUGP.mjs.map +1 -0
  157. package/dist/{chunk-OIHARMNM.mjs → chunk-IJD7FE2Z.mjs} +1 -1
  158. package/dist/chunk-IJD7FE2Z.mjs.map +1 -0
  159. package/dist/{chunk-XDKEPIUV.mjs → chunk-IQLKIDXF.mjs} +1 -1
  160. package/dist/chunk-IQLKIDXF.mjs.map +1 -0
  161. package/dist/{chunk-GTVOVGGZ.mjs → chunk-JE6JKZU3.mjs} +2 -2
  162. package/dist/chunk-JE6JKZU3.mjs.map +1 -0
  163. package/dist/{chunk-Q75KEFW5.mjs → chunk-JEKUA56R.mjs} +1 -1
  164. package/dist/chunk-JEKUA56R.mjs.map +1 -0
  165. package/dist/{chunk-VKM3R5T5.mjs → chunk-L7FQX5MN.mjs} +3 -3
  166. package/dist/chunk-L7FQX5MN.mjs.map +1 -0
  167. package/dist/{chunk-K2BAFL2T.mjs → chunk-LJ2C6MVP.mjs} +1 -1
  168. package/dist/chunk-LJ2C6MVP.mjs.map +1 -0
  169. package/dist/{chunk-4MRXVNGG.mjs → chunk-LUIKU43M.mjs} +1 -1
  170. package/dist/chunk-LUIKU43M.mjs.map +1 -0
  171. package/dist/{chunk-NRNKP6JF.mjs → chunk-NFS7RWWE.mjs} +1 -1
  172. package/dist/chunk-NFS7RWWE.mjs.map +1 -0
  173. package/dist/{chunk-H2FV6Z5X.mjs → chunk-O64NE2P4.mjs} +2 -2
  174. package/dist/{chunk-GNSJP2AB.mjs → chunk-O6UXZR3U.mjs} +1 -1
  175. package/dist/chunk-O6UXZR3U.mjs.map +1 -0
  176. package/dist/{chunk-FXOABQRO.mjs → chunk-OOKNBU4V.mjs} +1 -1
  177. package/dist/chunk-OOKNBU4V.mjs.map +1 -0
  178. package/dist/{chunk-WPDDOUQT.mjs → chunk-OXAZEEGP.mjs} +1 -1
  179. package/dist/chunk-OXAZEEGP.mjs.map +1 -0
  180. package/dist/{chunk-E54CCWDL.mjs → chunk-Q47NGNXT.mjs} +3 -3
  181. package/dist/{chunk-OEOAJOLQ.mjs → chunk-QOJGMVVR.mjs} +1 -1
  182. package/dist/chunk-QOJGMVVR.mjs.map +1 -0
  183. package/dist/{chunk-JSS4FXUD.mjs → chunk-QRSJBBFY.mjs} +3 -3
  184. package/dist/{chunk-PLTO44KM.mjs → chunk-QZITBKWX.mjs} +1 -1
  185. package/dist/chunk-QZITBKWX.mjs.map +1 -0
  186. package/dist/{chunk-UPJXHWSJ.mjs → chunk-R6QA7PLZ.mjs} +2 -2
  187. package/dist/chunk-R6QA7PLZ.mjs.map +1 -0
  188. package/dist/{chunk-ACFP3XMB.mjs → chunk-S3CORED5.mjs} +1 -1
  189. package/dist/chunk-S3CORED5.mjs.map +1 -0
  190. package/dist/{chunk-2EFS3VA3.mjs → chunk-XI7KRD2C.mjs} +1 -1
  191. package/dist/chunk-XI7KRD2C.mjs.map +1 -0
  192. package/dist/error/AbortError.d.mts +1 -1
  193. package/dist/error/AbortError.d.ts +1 -1
  194. package/dist/error/AbortError.js.map +1 -1
  195. package/dist/error/AbortError.mjs +1 -1
  196. package/dist/error/index.js.map +1 -1
  197. package/dist/error/index.mjs +1 -1
  198. package/dist/function/debounce.d.mts +1 -0
  199. package/dist/function/debounce.d.ts +1 -0
  200. package/dist/function/debounce.js.map +1 -1
  201. package/dist/function/debounce.mjs +1 -1
  202. package/dist/function/index.js.map +1 -1
  203. package/dist/function/index.mjs +3 -3
  204. package/dist/function/once.d.mts +1 -0
  205. package/dist/function/once.d.ts +1 -0
  206. package/dist/function/once.js.map +1 -1
  207. package/dist/function/once.mjs +1 -1
  208. package/dist/function/throttle.d.mts +1 -0
  209. package/dist/function/throttle.d.ts +1 -0
  210. package/dist/function/throttle.js.map +1 -1
  211. package/dist/function/throttle.mjs +1 -1
  212. package/dist/index.d.mts +1 -0
  213. package/dist/index.d.ts +1 -0
  214. package/dist/index.js +12 -0
  215. package/dist/index.js.map +1 -1
  216. package/dist/index.mjs +106 -102
  217. package/dist/math/index.js.map +1 -1
  218. package/dist/math/index.mjs +6 -6
  219. package/dist/math/meanBy.d.mts +1 -0
  220. package/dist/math/meanBy.d.ts +1 -0
  221. package/dist/math/meanBy.js.map +1 -1
  222. package/dist/math/meanBy.mjs +1 -1
  223. package/dist/object/index.js.map +1 -1
  224. package/dist/object/index.mjs +6 -6
  225. package/dist/object/omit.d.mts +2 -0
  226. package/dist/object/omit.d.ts +2 -0
  227. package/dist/object/omit.js.map +1 -1
  228. package/dist/object/omit.mjs +1 -1
  229. package/dist/object/omitBy.d.mts +1 -0
  230. package/dist/object/omitBy.d.ts +1 -0
  231. package/dist/object/omitBy.js.map +1 -1
  232. package/dist/object/omitBy.mjs +1 -1
  233. package/dist/object/pick.d.mts +2 -0
  234. package/dist/object/pick.d.ts +2 -0
  235. package/dist/object/pick.js.map +1 -1
  236. package/dist/object/pick.mjs +1 -1
  237. package/dist/object/pickBy.d.mts +1 -0
  238. package/dist/object/pickBy.d.ts +1 -0
  239. package/dist/object/pickBy.js.map +1 -1
  240. package/dist/object/pickBy.mjs +1 -1
  241. package/dist/predicate/index.js.map +1 -1
  242. package/dist/predicate/index.mjs +4 -4
  243. package/dist/predicate/isNotNil.d.mts +1 -0
  244. package/dist/predicate/isNotNil.d.ts +1 -0
  245. package/dist/predicate/isNotNil.js.map +1 -1
  246. package/dist/predicate/isNotNil.mjs +1 -1
  247. package/dist/promise/delay.js.map +1 -1
  248. package/dist/promise/delay.mjs +2 -2
  249. package/dist/promise/index.js.map +1 -1
  250. package/dist/promise/index.mjs +2 -2
  251. package/package.json +2 -1
  252. package/dist/chunk-2EFS3VA3.mjs.map +0 -1
  253. package/dist/chunk-2PFDLYQC.mjs.map +0 -1
  254. package/dist/chunk-4MRXVNGG.mjs.map +0 -1
  255. package/dist/chunk-5L2V7WD3.mjs.map +0 -1
  256. package/dist/chunk-A67NF2C7.mjs.map +0 -1
  257. package/dist/chunk-ACFP3XMB.mjs.map +0 -1
  258. package/dist/chunk-D735JOLS.mjs +0 -1
  259. package/dist/chunk-DA7GSKQ5.mjs.map +0 -1
  260. package/dist/chunk-DOOIIHT3.mjs.map +0 -1
  261. package/dist/chunk-DPLJQQFX.mjs.map +0 -1
  262. package/dist/chunk-FXOABQRO.mjs.map +0 -1
  263. package/dist/chunk-G42NUGNE.mjs.map +0 -1
  264. package/dist/chunk-GNSJP2AB.mjs.map +0 -1
  265. package/dist/chunk-GTVOVGGZ.mjs.map +0 -1
  266. package/dist/chunk-H5YR3ZV4.mjs.map +0 -1
  267. package/dist/chunk-JGNFYNYU.mjs.map +0 -1
  268. package/dist/chunk-K2BAFL2T.mjs.map +0 -1
  269. package/dist/chunk-KSXWREB5.mjs.map +0 -1
  270. package/dist/chunk-MQWVBKUT.mjs.map +0 -1
  271. package/dist/chunk-NKTBEEIT.mjs.map +0 -1
  272. package/dist/chunk-NRNKP6JF.mjs.map +0 -1
  273. package/dist/chunk-OEOAJOLQ.mjs.map +0 -1
  274. package/dist/chunk-OFWKFUFZ.mjs.map +0 -1
  275. package/dist/chunk-OIHARMNM.mjs.map +0 -1
  276. package/dist/chunk-OUTSP4VR.mjs.map +0 -1
  277. package/dist/chunk-PLTO44KM.mjs.map +0 -1
  278. package/dist/chunk-PYLGHB3F.mjs.map +0 -1
  279. package/dist/chunk-Q5XXJXXQ.mjs.map +0 -1
  280. package/dist/chunk-Q75KEFW5.mjs.map +0 -1
  281. package/dist/chunk-UFAA5WKR.mjs.map +0 -1
  282. package/dist/chunk-UPJXHWSJ.mjs.map +0 -1
  283. package/dist/chunk-VKM3R5T5.mjs.map +0 -1
  284. package/dist/chunk-WPDDOUQT.mjs.map +0 -1
  285. package/dist/chunk-XDKEPIUV.mjs.map +0 -1
  286. package/dist/chunk-XFCW7XJ4.mjs.map +0 -1
  287. package/dist/chunk-ZQNAZPSK.mjs.map +0 -1
  288. /package/dist/{chunk-D735JOLS.mjs.map → array/fill.mjs.map} +0 -0
  289. /package/dist/{chunk-H2FV6Z5X.mjs.map → chunk-O64NE2P4.mjs.map} +0 -0
  290. /package/dist/{chunk-E54CCWDL.mjs.map → chunk-Q47NGNXT.mjs.map} +0 -0
  291. /package/dist/{chunk-JSS4FXUD.mjs.map → chunk-QRSJBBFY.mjs.map} +0 -0
@@ -2,6 +2,7 @@ type NotFalsey<T> = Exclude<T, false | null | 0 | '' | undefined>;
2
2
  /**
3
3
  * Removes falsey values (false, null, 0, '', undefined, NaN) from an array.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {readonly T[]} arr - The input array to remove falsey values.
6
7
  * @returns {Array<Exclude<T, false | null | 0 | '' | undefined>>} - A new array with all falsey values removed.
7
8
  *
@@ -2,6 +2,7 @@ type NotFalsey<T> = Exclude<T, false | null | 0 | '' | undefined>;
2
2
  /**
3
3
  * Removes falsey values (false, null, 0, '', undefined, NaN) from an array.
4
4
  *
5
+ * @template T - The type of elements in the array.
5
6
  * @param {readonly T[]} arr - The input array to remove falsey values.
6
7
  * @returns {Array<Exclude<T, false | null | 0 | '' | undefined>>} - A new array with all falsey values removed.
7
8
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/compact.ts"],"sourcesContent":["type NotFalsey<T> = Exclude<T, false | null | 0 | '' | undefined>;\n\n/**\n * Removes falsey values (false, null, 0, '', undefined, NaN) from an array.\n *\n * @param {readonly T[]} arr - The input array to remove falsey values.\n * @returns {Array<Exclude<T, false | null | 0 | '' | undefined>>} - A new array with all falsey values removed.\n *\n * @example\n * compact([0, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);\n * Returns: [1, 2, 3, 4, 5]\n */\nexport function compact<T>(arr: readonly T[]): Array<NotFalsey<T>> {\n const result: Array<NotFalsey<T>> = [];\n\n for (const item of arr) {\n if (item) {\n result.push(item as NotFalsey<T>);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,QAAW,KAAwC;AACjE,QAAM,SAA8B,CAAC;AAErC,aAAW,QAAQ,KAAK;AACtB,QAAI,MAAM;AACR,aAAO,KAAK,IAAoB;AAAA,IAClC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/array/compact.ts"],"sourcesContent":["type NotFalsey<T> = Exclude<T, false | null | 0 | '' | undefined>;\n\n/**\n * Removes falsey values (false, null, 0, '', undefined, NaN) from an array.\n *\n * @template T - The type of elements in the array.\n * @param {readonly T[]} arr - The input array to remove falsey values.\n * @returns {Array<Exclude<T, false | null | 0 | '' | undefined>>} - A new array with all falsey values removed.\n *\n * @example\n * compact([0, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);\n * Returns: [1, 2, 3, 4, 5]\n */\nexport function compact<T>(arr: readonly T[]): Array<NotFalsey<T>> {\n const result: Array<NotFalsey<T>> = [];\n\n for (const item of arr) {\n if (item) {\n result.push(item as NotFalsey<T>);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,QAAW,KAAwC;AACjE,QAAM,SAA8B,CAAC;AAErC,aAAW,QAAQ,KAAK;AACtB,QAAI,MAAM;AACR,aAAO,KAAK,IAAoB;AAAA,IAClC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compact
3
- } from "../chunk-NKTBEEIT.mjs";
3
+ } from "../chunk-DTJJIMKJ.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  compact
@@ -4,6 +4,7 @@
4
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 start.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {number} itemsCount - The number of elements to drop from the beginning of the array.
9
10
  * @returns {T[]} A new array with the specified number of elements removed from the start.
@@ -4,6 +4,7 @@
4
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 start.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {number} itemsCount - The number of elements to drop from the beginning of the array.
9
10
  * @returns {T[]} A new array with the specified number of elements removed from the start.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: readonly T[], itemsCount: number): T[] {\n return arr.slice(itemsCount);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,KAAQ,KAAmB,YAAyB;AAClE,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: readonly T[], itemsCount: number): T[] {\n return arr.slice(itemsCount);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,KAAQ,KAAmB,YAAyB;AAClE,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  drop
3
- } from "../chunk-ACFP3XMB.mjs";
3
+ } from "../chunk-S3CORED5.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  drop
@@ -4,6 +4,7 @@
4
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
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {number} itemsCount - The number of elements to drop from the end of the array.
9
10
  * @returns {T[]} A new array with the specified number of elements removed from the end.
@@ -4,6 +4,7 @@
4
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
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {number} itemsCount - The number of elements to drop from the end of the array.
9
10
  * @returns {T[]} A new array with the specified number of elements removed from the end.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: readonly T[], itemsCount: number): T[] {\n return arr.slice(0, -itemsCount);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,UAAa,KAAmB,YAAyB;AACvE,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
1
+ {"version":3,"sources":["../../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: readonly T[], itemsCount: number): T[] {\n return arr.slice(0, -itemsCount);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,UAAa,KAAmB,YAAyB;AACvE,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dropRight
3
- } from "../chunk-Q75KEFW5.mjs";
3
+ } from "../chunk-JEKUA56R.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  dropRight
@@ -4,6 +4,7 @@
4
4
  * This function iterates over an array from the end and drops elements until the provided
5
5
  * predicate function returns false. It then returns a new array with the remaining elements.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
9
10
  * whether to continue dropping elements. The function is called with each element from the end,
@@ -4,6 +4,7 @@
4
4
  * This function iterates over an array from the end and drops elements until the provided
5
5
  * predicate function returns false. It then returns a new array with the remaining elements.
6
6
  *
7
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
9
10
  * whether to continue dropping elements. The function is called with each element from the end,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/dropRightWhile.ts","../../src/array/dropWhile.ts"],"sourcesContent":["import { dropWhile } from './dropWhile.ts';\n\n/**\n * Removes elements from the end of an array until the predicate returns false.\n *\n * This function iterates over an array from the end and drops elements until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element from the end,\n * and dropping continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRightWhile(array, x => x > 3);\n * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.\n */\nexport function dropRightWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const reversed = arr.slice().reverse();\n const dropped = dropWhile(reversed, canContinueDropping);\n return dropped.slice().reverse();\n}\n","/**\n * Removes elements from the beginning of an array until the predicate returns false.\n *\n * This function iterates over an array and drops elements from the start until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element, and dropping\n * continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropWhile(array, x => x < 3);\n * // result will be [3, 4, 5] since elements less than 3 are dropped.\n */\nexport function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const dropEndIndex = arr.findIndex(item => !canContinueDropping(item));\n if (dropEndIndex === -1) {\n return [];\n }\n\n return arr.slice(dropEndIndex);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,UAAa,KAAmB,qBAAgD;AAC9F,QAAM,eAAe,IAAI,UAAU,UAAQ,CAAC,oBAAoB,IAAI,CAAC;AACrE,MAAI,iBAAiB,IAAI;AACvB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,YAAY;AAC/B;;;ADLO,SAAS,eAAkB,KAAmB,qBAAgD;AACnG,QAAM,WAAW,IAAI,MAAM,EAAE,QAAQ;AACrC,QAAM,UAAU,UAAU,UAAU,mBAAmB;AACvD,SAAO,QAAQ,MAAM,EAAE,QAAQ;AACjC;","names":[]}
1
+ {"version":3,"sources":["../../src/array/dropRightWhile.ts","../../src/array/dropWhile.ts"],"sourcesContent":["import { dropWhile } from './dropWhile.ts';\n\n/**\n * Removes elements from the end of an array until the predicate returns false.\n *\n * This function iterates over an array from the end and drops elements until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element from the end,\n * and dropping continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRightWhile(array, x => x > 3);\n * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.\n */\nexport function dropRightWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const reversed = arr.slice().reverse();\n const dropped = dropWhile(reversed, canContinueDropping);\n return dropped.slice().reverse();\n}\n","/**\n * Removes elements from the beginning of an array until the predicate returns false.\n *\n * This function iterates over an array and drops elements from the start until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element, and dropping\n * continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropWhile(array, x => x < 3);\n * // result will be [3, 4, 5] since elements less than 3 are dropped.\n */\nexport function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const dropEndIndex = arr.findIndex(item => !canContinueDropping(item));\n if (dropEndIndex === -1) {\n return [];\n }\n\n return arr.slice(dropEndIndex);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACkBO,SAAS,UAAa,KAAmB,qBAAgD;AAC9F,QAAM,eAAe,IAAI,UAAU,UAAQ,CAAC,oBAAoB,IAAI,CAAC;AACrE,MAAI,iBAAiB,IAAI;AACvB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,YAAY;AAC/B;;;ADLO,SAAS,eAAkB,KAAmB,qBAAgD;AACnG,QAAM,WAAW,IAAI,MAAM,EAAE,QAAQ;AACrC,QAAM,UAAU,UAAU,UAAU,mBAAmB;AACvD,SAAO,QAAQ,MAAM,EAAE,QAAQ;AACjC;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  dropRightWhile
3
- } from "../chunk-GTVOVGGZ.mjs";
4
- import "../chunk-K2BAFL2T.mjs";
3
+ } from "../chunk-JE6JKZU3.mjs";
4
+ import "../chunk-LJ2C6MVP.mjs";
5
5
  import "../chunk-2MM5EJJX.mjs";
6
6
  export {
7
7
  dropRightWhile
@@ -4,6 +4,7 @@
4
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
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
9
10
  * whether to continue dropping elements. The function is called with each element, and dropping
@@ -4,6 +4,7 @@
4
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
+ * @template T - The type of elements in the array.
7
8
  * @param {T[]} arr - The array from which to drop elements.
8
9
  * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines
9
10
  * whether to continue dropping elements. The function is called with each element, and dropping
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/dropWhile.ts"],"sourcesContent":["/**\n * Removes elements from the beginning of an array until the predicate returns false.\n *\n * This function iterates over an array and drops elements from the start until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element, and dropping\n * continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropWhile(array, x => x < 3);\n * // result will be [3, 4, 5] since elements less than 3 are dropped.\n */\nexport function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const dropEndIndex = arr.findIndex(item => !canContinueDropping(item));\n if (dropEndIndex === -1) {\n return [];\n }\n\n return arr.slice(dropEndIndex);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,UAAa,KAAmB,qBAAgD;AAC9F,QAAM,eAAe,IAAI,UAAU,UAAQ,CAAC,oBAAoB,IAAI,CAAC;AACrE,MAAI,iBAAiB,IAAI;AACvB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,YAAY;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/array/dropWhile.ts"],"sourcesContent":["/**\n * Removes elements from the beginning of an array until the predicate returns false.\n *\n * This function iterates over an array and drops elements from the start until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element, and dropping\n * continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropWhile(array, x => x < 3);\n * // result will be [3, 4, 5] since elements less than 3 are dropped.\n */\nexport function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const dropEndIndex = arr.findIndex(item => !canContinueDropping(item));\n if (dropEndIndex === -1) {\n return [];\n }\n\n return arr.slice(dropEndIndex);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,SAAS,UAAa,KAAmB,qBAAgD;AAC9F,QAAM,eAAe,IAAI,UAAU,UAAQ,CAAC,oBAAoB,IAAI,CAAC;AACrE,MAAI,iBAAiB,IAAI;AACvB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,YAAY;AAC/B;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dropWhile
3
- } from "../chunk-K2BAFL2T.mjs";
3
+ } from "../chunk-LJ2C6MVP.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  dropWhile
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Fills elements of an array with a specified value from the start position up to, but not including, the end position.
3
+ *
4
+ * This function mutates the original array and replaces its elements with the provided value, starting from the specified
5
+ * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the
6
+ * entire array. Negative indices can be used to specify positions from the end of the array.
7
+ *
8
+ * @param {Array<T | P>} arr - The array to fill.
9
+ * @param {P} value - The value to fill the array with.
10
+ * @param {number} [start=0] - The start position. Defaults to 0.
11
+ * @param {number} [end=arr.length] - The end position. Defaults to the array's length.
12
+ * @returns {Array<T | P>} The array with the filled values.
13
+ *
14
+ * @example
15
+ * const array = [1, 2, 3];
16
+ * const result = fill(array, 'a');
17
+ * // => ['a', 'a', 'a']
18
+ *
19
+ * const result = fill(Array(3), 2);
20
+ * // => [2, 2, 2]
21
+ *
22
+ * const result = fill([4, 6, 8, 10], '*', 1, 3);
23
+ * // => [4, '*', '*', 10]
24
+ */
25
+ declare function fill<T>(arr: unknown[], value: T): T[];
26
+ declare function fill<T, P>(arr: Array<T | P>, value: P, start: number): Array<T | P>;
27
+ declare function fill<T, P>(arr: Array<T | P>, value: P, start: number, end: number): Array<T | P>;
28
+
29
+ export { fill };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Fills elements of an array with a specified value from the start position up to, but not including, the end position.
3
+ *
4
+ * This function mutates the original array and replaces its elements with the provided value, starting from the specified
5
+ * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the
6
+ * entire array. Negative indices can be used to specify positions from the end of the array.
7
+ *
8
+ * @param {Array<T | P>} arr - The array to fill.
9
+ * @param {P} value - The value to fill the array with.
10
+ * @param {number} [start=0] - The start position. Defaults to 0.
11
+ * @param {number} [end=arr.length] - The end position. Defaults to the array's length.
12
+ * @returns {Array<T | P>} The array with the filled values.
13
+ *
14
+ * @example
15
+ * const array = [1, 2, 3];
16
+ * const result = fill(array, 'a');
17
+ * // => ['a', 'a', 'a']
18
+ *
19
+ * const result = fill(Array(3), 2);
20
+ * // => [2, 2, 2]
21
+ *
22
+ * const result = fill([4, 6, 8, 10], '*', 1, 3);
23
+ * // => [4, '*', '*', 10]
24
+ */
25
+ declare function fill<T>(arr: unknown[], value: T): T[];
26
+ declare function fill<T, P>(arr: Array<T | P>, value: P, start: number): Array<T | P>;
27
+ declare function fill<T, P>(arr: Array<T | P>, value: P, start: number, end: number): Array<T | P>;
28
+
29
+ export { fill };
@@ -0,0 +1,38 @@
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/fill.ts
21
+ var fill_exports = {};
22
+ __export(fill_exports, {
23
+ fill: () => fill
24
+ });
25
+ module.exports = __toCommonJS(fill_exports);
26
+ function fill(arr, value, start = 0, end = arr.length) {
27
+ start = Math.max(start, 0);
28
+ end = Math.min(end, arr.length);
29
+ for (let i = start; i < end; i++) {
30
+ arr[i] = value;
31
+ }
32
+ return arr;
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ fill
37
+ });
38
+ //# sourceMappingURL=fill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/array/fill.ts"],"sourcesContent":["/**\n * Fills elements of an array with a specified value from the start position up to, but not including, the end position.\n *\n * This function mutates the original array and replaces its elements with the provided value, starting from the specified\n * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the\n * entire array. Negative indices can be used to specify positions from the end of the array.\n *\n * @param {Array<T | P>} arr - The array to fill.\n * @param {P} value - The value to fill the array with.\n * @param {number} [start=0] - The start position. Defaults to 0.\n * @param {number} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | P>} The array with the filled values.\n *\n * @example\n * const array = [1, 2, 3];\n * const result = fill(array, 'a');\n * // => ['a', 'a', 'a']\n *\n * const result = fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * const result = fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\n\nexport function fill<T>(arr: unknown[], value: T): T[];\nexport function fill<T, P>(arr: Array<T | P>, value: P, start: number): Array<T | P>;\nexport function fill<T, P>(arr: Array<T | P>, value: P, start: number, end: number): Array<T | P>;\nexport function fill<T, P>(arr: Array<T | P>, value: P, start = 0, end = arr.length): Array<T | P> {\n start = Math.max(start, 0);\n end = Math.min(end, arr.length);\n\n for (let i = start; i < end; i++) {\n arr[i] = value;\n }\n\n return arr;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BO,SAAS,KAAW,KAAmB,OAAU,QAAQ,GAAG,MAAM,IAAI,QAAsB;AACjG,UAAQ,KAAK,IAAI,OAAO,CAAC;AACzB,QAAM,KAAK,IAAI,KAAK,IAAI,MAAM;AAE9B,WAAS,IAAI,OAAO,IAAI,KAAK,KAAK;AAChC,QAAI,CAAC,IAAI;AAAA,EACX;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ fill
3
+ } from "../chunk-C4WE4GLC.mjs";
4
+ import "../chunk-2MM5EJJX.mjs";
5
+ export {
6
+ fill
7
+ };
8
+ //# sourceMappingURL=fill.mjs.map
@@ -5,6 +5,8 @@
5
5
  * an object where the keys are the generated keys and the values are arrays of elements that share
6
6
  * the same key.
7
7
  *
8
+ * @template T - The type of elements in the array.
9
+ * @template K - The type of keys.
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
12
  * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that
@@ -5,6 +5,8 @@
5
5
  * an object where the keys are the generated keys and the values are arrays of elements that share
6
6
  * the same key.
7
7
  *
8
+ * @template T - The type of elements in the array.
9
+ * @template K - The type of keys.
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
12
  * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/groupBy.ts"],"sourcesContent":["/**\n * Groups the elements of an array based on a provided key-generating function.\n *\n * This function takes an array and a function that generates a key from each element. It returns\n * an object where the keys are the generated keys and the values are arrays of elements that share\n * the same key.\n *\n * @param {T[]} arr - The array to group.\n * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.\n * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that\n * share that key.\n *\n * @example\n * const array = [\n * { category: 'fruit', name: 'apple' },\n * { category: 'fruit', name: 'banana' },\n * { category: 'vegetable', name: 'carrot' }\n * ];\n * const result = groupBy(array, item => item.category);\n * // result will be:\n * // {\n * // fruit: [\n * // { category: 'fruit', name: 'apple' },\n * // { category: 'fruit', name: 'banana' }\n * // ],\n * // vegetable: [\n * // { category: 'vegetable', name: 'carrot' }\n * // ]\n * // }\n */\nexport function groupBy<T, K extends PropertyKey>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T[]> {\n const result = {} as Record<K, T[]>;\n\n for (const item of arr) {\n const key = getKeyFromItem(item);\n\n if (result[key] == null) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,SAAS,QAAkC,KAAmB,gBAAgD;AACnH,QAAM,SAAS,CAAC;AAEhB,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,eAAe,IAAI;AAE/B,QAAI,OAAO,GAAG,KAAK,MAAM;AACvB,aAAO,GAAG,IAAI,CAAC;AAAA,IACjB;AAEA,WAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EACvB;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/array/groupBy.ts"],"sourcesContent":["/**\n * Groups the elements of an array based on a provided key-generating function.\n *\n * This function takes an array and a function that generates a key from each element. It returns\n * an object where the keys are the generated keys and the values are arrays of elements that share\n * the same key.\n *\n * @template T - The type of elements in the array.\n * @template K - The type of keys.\n * @param {T[]} arr - The array to group.\n * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.\n * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that\n * share that key.\n *\n * @example\n * const array = [\n * { category: 'fruit', name: 'apple' },\n * { category: 'fruit', name: 'banana' },\n * { category: 'vegetable', name: 'carrot' }\n * ];\n * const result = groupBy(array, item => item.category);\n * // result will be:\n * // {\n * // fruit: [\n * // { category: 'fruit', name: 'apple' },\n * // { category: 'fruit', name: 'banana' }\n * // ],\n * // vegetable: [\n * // { category: 'vegetable', name: 'carrot' }\n * // ]\n * // }\n */\nexport function groupBy<T, K extends PropertyKey>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T[]> {\n const result = {} as Record<K, T[]>;\n\n for (const item of arr) {\n const key = getKeyFromItem(item);\n\n if (result[key] == null) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCO,SAAS,QAAkC,KAAmB,gBAAgD;AACnH,QAAM,SAAS,CAAC;AAEhB,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,eAAe,IAAI;AAE/B,QAAI,OAAO,GAAG,KAAK,MAAM;AACvB,aAAO,GAAG,IAAI,CAAC;AAAA,IACjB;AAEA,WAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EACvB;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  groupBy
3
- } from "../chunk-H5YR3ZV4.mjs";
3
+ } from "../chunk-E6E4RZLN.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  groupBy
@@ -34,3 +34,4 @@ export { xorWith } from './xorWith.mjs';
34
34
  export { zip } from './zip.mjs';
35
35
  export { zipWith } from './zipWith.mjs';
36
36
  export { zipObject } from './zipObject.mjs';
37
+ export { fill } from './fill.mjs';
@@ -34,3 +34,4 @@ export { xorWith } from './xorWith.js';
34
34
  export { zip } from './zip.js';
35
35
  export { zipWith } from './zipWith.js';
36
36
  export { zipObject } from './zipObject.js';
37
+ export { fill } from './fill.js';
@@ -29,6 +29,7 @@ __export(array_exports, {
29
29
  dropRight: () => dropRight,
30
30
  dropRightWhile: () => dropRightWhile,
31
31
  dropWhile: () => dropWhile,
32
+ fill: () => fill,
32
33
  groupBy: () => groupBy,
33
34
  intersection: () => intersection,
34
35
  intersectionBy: () => intersectionBy,
@@ -413,6 +414,16 @@ function zipObject(keys, values) {
413
414
  }
414
415
  return result;
415
416
  }
417
+
418
+ // src/array/fill.ts
419
+ function fill(arr, value, start = 0, end = arr.length) {
420
+ start = Math.max(start, 0);
421
+ end = Math.min(end, arr.length);
422
+ for (let i = start; i < end; i++) {
423
+ arr[i] = value;
424
+ }
425
+ return arr;
426
+ }
416
427
  // Annotate the CommonJS export names for ESM import in node:
417
428
  0 && (module.exports = {
418
429
  chunk,
@@ -424,6 +435,7 @@ function zipObject(keys, values) {
424
435
  dropRight,
425
436
  dropRightWhile,
426
437
  dropWhile,
438
+ fill,
427
439
  groupBy,
428
440
  intersection,
429
441
  intersectionBy,