es-toolkit 1.9.0 → 1.10.0

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 (245) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/README.md +1 -1
  3. package/dist/array/chunk.mjs +1 -1
  4. package/dist/array/compact.mjs +1 -1
  5. package/dist/array/countBy.mjs +1 -1
  6. package/dist/array/difference.mjs +1 -1
  7. package/dist/array/differenceBy.mjs +1 -1
  8. package/dist/array/differenceWith.mjs +1 -1
  9. package/dist/array/drop.mjs +1 -1
  10. package/dist/array/dropRight.mjs +1 -1
  11. package/dist/array/dropRightWhile.mjs +1 -1
  12. package/dist/array/dropWhile.mjs +1 -1
  13. package/dist/array/fill.mjs +1 -1
  14. package/dist/array/flatten.mjs +1 -1
  15. package/dist/array/flattenDeep.d.mts +25 -0
  16. package/dist/array/flattenDeep.d.ts +25 -0
  17. package/dist/array/flattenDeep.js +52 -0
  18. package/dist/array/flattenDeep.js.map +1 -0
  19. package/dist/array/flattenDeep.mjs +9 -0
  20. package/dist/array/forEachRight.mjs +1 -1
  21. package/dist/array/groupBy.mjs +1 -1
  22. package/dist/array/head.mjs +1 -1
  23. package/dist/array/index.d.mts +4 -0
  24. package/dist/array/index.d.ts +4 -0
  25. package/dist/array/index.js +38 -0
  26. package/dist/array/index.js.map +1 -1
  27. package/dist/array/index.mjs +58 -42
  28. package/dist/array/initial.d.mts +26 -0
  29. package/dist/array/initial.d.ts +26 -0
  30. package/dist/array/initial.js +36 -0
  31. package/dist/array/initial.js.map +1 -0
  32. package/dist/array/initial.mjs +8 -0
  33. package/dist/array/intersection.mjs +1 -1
  34. package/dist/array/intersectionBy.mjs +1 -1
  35. package/dist/array/intersectionWith.mjs +1 -1
  36. package/dist/array/keyBy.mjs +1 -1
  37. package/dist/array/last.d.mts +25 -0
  38. package/dist/array/last.d.ts +25 -0
  39. package/dist/array/last.js +33 -0
  40. package/dist/array/last.js.map +1 -0
  41. package/dist/array/last.mjs +8 -0
  42. package/dist/array/maxBy.mjs +1 -1
  43. package/dist/array/minBy.mjs +1 -1
  44. package/dist/array/orderBy.mjs +1 -1
  45. package/dist/array/partition.mjs +1 -1
  46. package/dist/array/sample.mjs +1 -1
  47. package/dist/array/sampleSize.mjs +1 -1
  48. package/dist/array/shuffle.mjs +1 -1
  49. package/dist/array/tail.mjs +1 -1
  50. package/dist/array/take.mjs +1 -1
  51. package/dist/array/takeRight.mjs +1 -1
  52. package/dist/array/takeRightWhile.mjs +1 -1
  53. package/dist/array/takeWhile.mjs +1 -1
  54. package/dist/array/toFilled.d.mts +33 -0
  55. package/dist/array/toFilled.d.ts +33 -0
  56. package/dist/array/toFilled.js +40 -0
  57. package/dist/array/toFilled.js.map +1 -0
  58. package/dist/array/toFilled.mjs +8 -0
  59. package/dist/array/union.mjs +1 -1
  60. package/dist/array/unionBy.mjs +1 -1
  61. package/dist/array/unionWith.mjs +1 -1
  62. package/dist/array/uniq.mjs +1 -1
  63. package/dist/array/uniqBy.mjs +1 -1
  64. package/dist/array/uniqWith.mjs +1 -1
  65. package/dist/array/unzip.mjs +1 -1
  66. package/dist/array/unzipWith.mjs +1 -1
  67. package/dist/array/without.mjs +1 -1
  68. package/dist/array/xor.mjs +1 -1
  69. package/dist/array/xorBy.mjs +1 -1
  70. package/dist/array/xorWith.mjs +1 -1
  71. package/dist/array/zip.mjs +1 -1
  72. package/dist/array/zipObject.mjs +1 -1
  73. package/dist/array/zipWith.mjs +1 -1
  74. package/dist/chunk-236H5JZJ.mjs +1 -0
  75. package/dist/chunk-2HIMLZE3.mjs +46 -0
  76. package/dist/chunk-2HIMLZE3.mjs.map +1 -0
  77. package/dist/chunk-2MRZANXZ.mjs +1 -0
  78. package/dist/chunk-2MRZANXZ.mjs.map +1 -0
  79. package/dist/chunk-2SLTL4KL.mjs +13 -0
  80. package/dist/{chunk-NOFHNJ5C.mjs.map → chunk-2SLTL4KL.mjs.map} +1 -1
  81. package/dist/{chunk-QZITBKWX.mjs → chunk-4E4D3BMI.mjs} +2 -2
  82. package/dist/chunk-5IKVJGHO.mjs +14 -0
  83. package/dist/chunk-5IKVJGHO.mjs.map +1 -0
  84. package/dist/chunk-ASJF5D6C.mjs +1 -0
  85. package/dist/chunk-ASJF5D6C.mjs.map +1 -0
  86. package/dist/chunk-BOOQBJN2.mjs +9 -0
  87. package/dist/chunk-BOOQBJN2.mjs.map +1 -0
  88. package/dist/chunk-EYYZQFOP.mjs +14 -0
  89. package/dist/chunk-EYYZQFOP.mjs.map +1 -0
  90. package/dist/chunk-F3WCQQET.mjs +14 -0
  91. package/dist/chunk-F3WCQQET.mjs.map +1 -0
  92. package/dist/{chunk-LT6E4Y4Z.mjs → chunk-GDC64SYJ.mjs} +2 -2
  93. package/dist/{chunk-SDIMTYZW.mjs → chunk-IZAD2S7R.mjs} +2 -2
  94. package/dist/chunk-JYSV56US.mjs +41 -0
  95. package/dist/chunk-JYSV56US.mjs.map +1 -0
  96. package/dist/chunk-KPBQ7OUY.mjs +9 -0
  97. package/dist/chunk-KPBQ7OUY.mjs.map +1 -0
  98. package/dist/chunk-ML727RRJ.mjs +13 -0
  99. package/dist/chunk-ML727RRJ.mjs.map +1 -0
  100. package/dist/chunk-OP4OAKQJ.mjs +16 -0
  101. package/dist/chunk-OP4OAKQJ.mjs.map +1 -0
  102. package/dist/chunk-OSOLEQLZ.mjs +1 -0
  103. package/dist/chunk-OSOLEQLZ.mjs.map +1 -0
  104. package/dist/chunk-QKYYOLJ6.mjs +1 -0
  105. package/dist/chunk-QKYYOLJ6.mjs.map +1 -0
  106. package/dist/chunk-U4JGKZ56.mjs +41 -0
  107. package/dist/chunk-U4JGKZ56.mjs.map +1 -0
  108. package/dist/chunk-U56ZOM7L.mjs +9 -0
  109. package/dist/chunk-U56ZOM7L.mjs.map +1 -0
  110. package/dist/chunk-WMM7TZLG.mjs +9 -0
  111. package/dist/{chunk-OHQAR5AU.mjs.map → chunk-WMM7TZLG.mjs.map} +1 -1
  112. package/dist/chunk-WVQ7YVRK.mjs +11 -0
  113. package/dist/chunk-WVQ7YVRK.mjs.map +1 -0
  114. package/dist/chunk-XGCYC4YA.mjs +5516 -0
  115. package/dist/chunk-XGCYC4YA.mjs.map +1 -0
  116. package/dist/chunk-XPSOKBRZ.mjs +12 -0
  117. package/dist/chunk-XPSOKBRZ.mjs.map +1 -0
  118. package/dist/error/AbortError.mjs +1 -1
  119. package/dist/error/index.mjs +1 -1
  120. package/dist/function/debounce.mjs +1 -1
  121. package/dist/function/index.d.mts +1 -0
  122. package/dist/function/index.d.ts +1 -0
  123. package/dist/function/index.js +7 -0
  124. package/dist/function/index.js.map +1 -1
  125. package/dist/function/index.mjs +6 -2
  126. package/dist/function/negate.d.mts +10 -0
  127. package/dist/function/negate.d.ts +10 -0
  128. package/dist/function/negate.js +33 -0
  129. package/dist/function/negate.js.map +1 -0
  130. package/dist/function/negate.mjs +8 -0
  131. package/dist/function/negate.mjs.map +1 -0
  132. package/dist/function/noop.mjs +1 -1
  133. package/dist/function/once.mjs +1 -1
  134. package/dist/function/throttle.mjs +1 -1
  135. package/dist/index.d.mts +12 -0
  136. package/dist/index.d.ts +12 -0
  137. package/dist/index.js +5681 -3
  138. package/dist/index.js.map +1 -1
  139. package/dist/index.mjs +125 -75
  140. package/dist/math/clamp.mjs +1 -1
  141. package/dist/math/inRange.mjs +1 -1
  142. package/dist/math/index.js +2 -2
  143. package/dist/math/index.js.map +1 -1
  144. package/dist/math/index.mjs +10 -10
  145. package/dist/math/mean.js +2 -2
  146. package/dist/math/mean.js.map +1 -1
  147. package/dist/math/mean.mjs +3 -3
  148. package/dist/math/meanBy.js +2 -2
  149. package/dist/math/meanBy.js.map +1 -1
  150. package/dist/math/meanBy.mjs +4 -4
  151. package/dist/math/random.mjs +1 -1
  152. package/dist/math/randomInt.mjs +1 -1
  153. package/dist/math/range.mjs +1 -1
  154. package/dist/math/round.mjs +1 -1
  155. package/dist/math/sum.js +2 -2
  156. package/dist/math/sum.js.map +1 -1
  157. package/dist/math/sum.mjs +2 -2
  158. package/dist/object/clone.d.mts +31 -0
  159. package/dist/object/clone.d.ts +31 -0
  160. package/dist/object/clone.js +65 -0
  161. package/dist/object/clone.js.map +1 -0
  162. package/dist/object/clone.mjs +8 -0
  163. package/dist/object/clone.mjs.map +1 -0
  164. package/dist/object/index.d.mts +1 -0
  165. package/dist/object/index.d.ts +1 -0
  166. package/dist/object/index.js +39 -0
  167. package/dist/object/index.js.map +1 -1
  168. package/dist/object/index.mjs +7 -3
  169. package/dist/object/invert.mjs +1 -1
  170. package/dist/object/omit.mjs +2 -2
  171. package/dist/object/omitBy.mjs +1 -1
  172. package/dist/object/pick.mjs +1 -1
  173. package/dist/object/pickBy.mjs +1 -1
  174. package/dist/predicate/index.d.mts +1 -0
  175. package/dist/predicate/index.d.ts +1 -0
  176. package/dist/predicate/index.js +46 -1
  177. package/dist/predicate/index.js.map +1 -1
  178. package/dist/predicate/index.mjs +11 -5
  179. package/dist/predicate/isEqual.d.mts +17 -0
  180. package/dist/predicate/isEqual.d.ts +17 -0
  181. package/dist/predicate/isEqual.js +73 -0
  182. package/dist/predicate/isEqual.js.map +1 -0
  183. package/dist/predicate/isEqual.mjs +10 -0
  184. package/dist/predicate/isEqual.mjs.map +1 -0
  185. package/dist/predicate/isNil.js +1 -1
  186. package/dist/predicate/isNil.js.map +1 -1
  187. package/dist/predicate/isNil.mjs +2 -2
  188. package/dist/predicate/isNotNil.mjs +1 -1
  189. package/dist/predicate/isNull.mjs +1 -1
  190. package/dist/predicate/isUndefined.mjs +1 -1
  191. package/dist/promise/delay.mjs +1 -1
  192. package/dist/promise/index.mjs +1 -1
  193. package/dist/string/camelCase.d.mts +17 -0
  194. package/dist/string/camelCase.d.ts +17 -0
  195. package/dist/string/camelCase.js +5554 -0
  196. package/dist/string/camelCase.js.map +1 -0
  197. package/dist/string/camelCase.mjs +9 -0
  198. package/dist/string/camelCase.mjs.map +1 -0
  199. package/dist/string/capitalize.d.mts +14 -0
  200. package/dist/string/capitalize.d.ts +14 -0
  201. package/dist/string/capitalize.js +33 -0
  202. package/dist/string/capitalize.js.map +1 -0
  203. package/dist/string/capitalize.mjs +8 -0
  204. package/dist/string/capitalize.mjs.map +1 -0
  205. package/dist/string/index.d.mts +5 -0
  206. package/dist/string/index.d.ts +5 -0
  207. package/dist/string/index.js +5587 -0
  208. package/dist/string/index.js.map +1 -0
  209. package/dist/string/index.mjs +26 -0
  210. package/dist/string/index.mjs.map +1 -0
  211. package/dist/string/kebabCase.d.mts +17 -0
  212. package/dist/string/kebabCase.d.ts +17 -0
  213. package/dist/string/kebabCase.js +43 -0
  214. package/dist/string/kebabCase.js.map +1 -0
  215. package/dist/string/kebabCase.mjs +9 -0
  216. package/dist/string/kebabCase.mjs.map +1 -0
  217. package/dist/string/lowerCase.d.mts +17 -0
  218. package/dist/string/lowerCase.d.ts +17 -0
  219. package/dist/string/lowerCase.js +43 -0
  220. package/dist/string/lowerCase.js.map +1 -0
  221. package/dist/string/lowerCase.mjs +9 -0
  222. package/dist/string/lowerCase.mjs.map +1 -0
  223. package/dist/string/snakeCase.d.mts +17 -0
  224. package/dist/string/snakeCase.d.ts +17 -0
  225. package/dist/string/snakeCase.js +43 -0
  226. package/dist/string/snakeCase.js.map +1 -0
  227. package/dist/string/snakeCase.mjs +9 -0
  228. package/dist/string/snakeCase.mjs.map +1 -0
  229. package/package.json +21 -1
  230. package/string.d.ts +1 -0
  231. package/dist/chunk-2MM5EJJX.mjs +0 -21
  232. package/dist/chunk-LOY6PATI.mjs +0 -1
  233. package/dist/chunk-MAJSPFA6.mjs +0 -1
  234. package/dist/chunk-N6EM6ETS.mjs +0 -1
  235. package/dist/chunk-NOFHNJ5C.mjs +0 -13
  236. package/dist/chunk-OHQAR5AU.mjs +0 -9
  237. package/dist/chunk-PMHULJNL.mjs +0 -1
  238. /package/dist/{chunk-2MM5EJJX.mjs.map → array/flattenDeep.mjs.map} +0 -0
  239. /package/dist/{chunk-LOY6PATI.mjs.map → array/initial.mjs.map} +0 -0
  240. /package/dist/{chunk-MAJSPFA6.mjs.map → array/last.mjs.map} +0 -0
  241. /package/dist/{chunk-N6EM6ETS.mjs.map → array/toFilled.mjs.map} +0 -0
  242. /package/dist/{chunk-PMHULJNL.mjs.map → chunk-236H5JZJ.mjs.map} +0 -0
  243. /package/dist/{chunk-QZITBKWX.mjs.map → chunk-4E4D3BMI.mjs.map} +0 -0
  244. /package/dist/{chunk-LT6E4Y4Z.mjs.map → chunk-GDC64SYJ.mjs.map} +0 -0
  245. /package/dist/{chunk-SDIMTYZW.mjs.map → chunk-IZAD2S7R.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -2,26 +2,24 @@ import "./chunk-ARZ5BDR6.mjs";
2
2
  import {
3
3
  delay
4
4
  } from "./chunk-O64NE2P4.mjs";
5
- import "./chunk-PMHULJNL.mjs";
5
+ import "./chunk-QKYYOLJ6.mjs";
6
6
  import {
7
- invert
8
- } from "./chunk-74WWMNZS.mjs";
7
+ kebabCase
8
+ } from "./chunk-EYYZQFOP.mjs";
9
9
  import {
10
- omit
11
- } from "./chunk-QZITBKWX.mjs";
10
+ lowerCase
11
+ } from "./chunk-5IKVJGHO.mjs";
12
12
  import {
13
- omitBy
14
- } from "./chunk-BCTYOXT7.mjs";
13
+ snakeCase
14
+ } from "./chunk-F3WCQQET.mjs";
15
15
  import {
16
- pick
17
- } from "./chunk-HPFDYUGP.mjs";
18
- import {
19
- pickBy
20
- } from "./chunk-6CLH5YZ2.mjs";
21
- import "./chunk-MAJSPFA6.mjs";
16
+ camelCase
17
+ } from "./chunk-XGCYC4YA.mjs";
18
+ import "./chunk-WVQ7YVRK.mjs";
22
19
  import {
23
- isNil
24
- } from "./chunk-OHQAR5AU.mjs";
20
+ capitalize
21
+ } from "./chunk-U56ZOM7L.mjs";
22
+ import "./chunk-ASJF5D6C.mjs";
25
23
  import {
26
24
  isNotNil
27
25
  } from "./chunk-BMRTZMRE.mjs";
@@ -31,32 +29,32 @@ import {
31
29
  import {
32
30
  isUndefined
33
31
  } from "./chunk-VH2PV426.mjs";
34
- import "./chunk-TLVQSNOE.mjs";
35
32
  import {
36
- inRange
37
- } from "./chunk-BH6HLGBA.mjs";
33
+ isEqual
34
+ } from "./chunk-JYSV56US.mjs";
38
35
  import {
39
- meanBy
40
- } from "./chunk-SDIMTYZW.mjs";
36
+ isNil
37
+ } from "./chunk-WMM7TZLG.mjs";
38
+ import "./chunk-OSOLEQLZ.mjs";
41
39
  import {
42
- mean
43
- } from "./chunk-LT6E4Y4Z.mjs";
40
+ invert
41
+ } from "./chunk-74WWMNZS.mjs";
44
42
  import {
45
- sum
46
- } from "./chunk-NOFHNJ5C.mjs";
43
+ omit
44
+ } from "./chunk-4E4D3BMI.mjs";
47
45
  import {
48
- range
49
- } from "./chunk-DPH2KE6O.mjs";
46
+ omitBy
47
+ } from "./chunk-BCTYOXT7.mjs";
50
48
  import {
51
- round
52
- } from "./chunk-5PMKOZ2F.mjs";
49
+ pick
50
+ } from "./chunk-HPFDYUGP.mjs";
53
51
  import {
54
- clamp
55
- } from "./chunk-MLCL773E.mjs";
56
- import "./chunk-LOY6PATI.mjs";
52
+ pickBy
53
+ } from "./chunk-6CLH5YZ2.mjs";
57
54
  import {
58
- without
59
- } from "./chunk-PYEYV7BY.mjs";
55
+ clone
56
+ } from "./chunk-U4JGKZ56.mjs";
57
+ import "./chunk-2MRZANXZ.mjs";
60
58
  import {
61
59
  xor
62
60
  } from "./chunk-L7FQX5MN.mjs";
@@ -75,18 +73,12 @@ import {
75
73
  import {
76
74
  zipWith
77
75
  } from "./chunk-4KYXHZ4R.mjs";
78
- import {
79
- union
80
- } from "./chunk-R6QA7PLZ.mjs";
81
76
  import {
82
77
  unionBy
83
78
  } from "./chunk-NFS7RWWE.mjs";
84
79
  import {
85
80
  unionWith
86
81
  } from "./chunk-2ZCITDMK.mjs";
87
- import {
88
- uniq
89
- } from "./chunk-DVK2N4KC.mjs";
90
82
  import {
91
83
  uniqBy
92
84
  } from "./chunk-OXAZEEGP.mjs";
@@ -100,17 +92,8 @@ import {
100
92
  unzipWith
101
93
  } from "./chunk-IFNXROZR.mjs";
102
94
  import {
103
- sample
104
- } from "./chunk-2KNLZB7V.mjs";
105
- import {
106
- sampleSize
107
- } from "./chunk-EHSKB6DF.mjs";
108
- import {
109
- randomInt
110
- } from "./chunk-GIWAOOFY.mjs";
111
- import {
112
- random
113
- } from "./chunk-SYWMYQYJ.mjs";
95
+ without
96
+ } from "./chunk-PYEYV7BY.mjs";
114
97
  import {
115
98
  shuffle
116
99
  } from "./chunk-G7UQ5PUR.mjs";
@@ -130,17 +113,20 @@ import {
130
113
  takeWhile
131
114
  } from "./chunk-2IXFGSUA.mjs";
132
115
  import {
133
- intersection
134
- } from "./chunk-FVVSE2F2.mjs";
116
+ toFilled
117
+ } from "./chunk-OP4OAKQJ.mjs";
135
118
  import {
136
- intersectionBy
137
- } from "./chunk-O6UXZR3U.mjs";
119
+ union
120
+ } from "./chunk-R6QA7PLZ.mjs";
138
121
  import {
139
- intersectionWith
140
- } from "./chunk-XI7KRD2C.mjs";
122
+ uniq
123
+ } from "./chunk-DVK2N4KC.mjs";
141
124
  import {
142
125
  keyBy
143
126
  } from "./chunk-AJKZMN2V.mjs";
127
+ import {
128
+ last
129
+ } from "./chunk-KPBQ7OUY.mjs";
144
130
  import {
145
131
  maxBy
146
132
  } from "./chunk-OOKNBU4V.mjs";
@@ -153,6 +139,42 @@ import {
153
139
  import {
154
140
  partition
155
141
  } from "./chunk-DN3NOZ3H.mjs";
142
+ import {
143
+ sample
144
+ } from "./chunk-2KNLZB7V.mjs";
145
+ import {
146
+ sampleSize
147
+ } from "./chunk-EHSKB6DF.mjs";
148
+ import {
149
+ forEachRight
150
+ } from "./chunk-IEA53J7P.mjs";
151
+ import {
152
+ groupBy
153
+ } from "./chunk-E6E4RZLN.mjs";
154
+ import {
155
+ head
156
+ } from "./chunk-HM2JT2RX.mjs";
157
+ import {
158
+ initial
159
+ } from "./chunk-XPSOKBRZ.mjs";
160
+ import {
161
+ intersection
162
+ } from "./chunk-FVVSE2F2.mjs";
163
+ import {
164
+ intersectionBy
165
+ } from "./chunk-O6UXZR3U.mjs";
166
+ import {
167
+ intersectionWith
168
+ } from "./chunk-XI7KRD2C.mjs";
169
+ import {
170
+ differenceWith
171
+ } from "./chunk-6NVQAHXP.mjs";
172
+ import {
173
+ drop
174
+ } from "./chunk-S3CORED5.mjs";
175
+ import {
176
+ dropRight
177
+ } from "./chunk-JEKUA56R.mjs";
156
178
  import {
157
179
  dropRightWhile
158
180
  } from "./chunk-JE6JKZU3.mjs";
@@ -162,18 +184,16 @@ import {
162
184
  import {
163
185
  fill
164
186
  } from "./chunk-C4WE4GLC.mjs";
187
+ import {
188
+ flattenDeep
189
+ } from "./chunk-ML727RRJ.mjs";
165
190
  import {
166
191
  flatten
167
192
  } from "./chunk-33MSBDC6.mjs";
193
+ import "./chunk-FZEZH22H.mjs";
168
194
  import {
169
- forEachRight
170
- } from "./chunk-IEA53J7P.mjs";
171
- import {
172
- groupBy
173
- } from "./chunk-E6E4RZLN.mjs";
174
- import {
175
- head
176
- } from "./chunk-HM2JT2RX.mjs";
195
+ AbortError
196
+ } from "./chunk-DXB7EZUQ.mjs";
177
197
  import {
178
198
  chunk
179
199
  } from "./chunk-E6C5EZQA.mjs";
@@ -189,19 +209,38 @@ import {
189
209
  import {
190
210
  differenceBy
191
211
  } from "./chunk-LVWX5B43.mjs";
212
+ import "./chunk-TLVQSNOE.mjs";
192
213
  import {
193
- differenceWith
194
- } from "./chunk-6NVQAHXP.mjs";
214
+ inRange
215
+ } from "./chunk-BH6HLGBA.mjs";
195
216
  import {
196
- drop
197
- } from "./chunk-S3CORED5.mjs";
217
+ meanBy
218
+ } from "./chunk-IZAD2S7R.mjs";
198
219
  import {
199
- dropRight
200
- } from "./chunk-JEKUA56R.mjs";
201
- import "./chunk-N6EM6ETS.mjs";
220
+ mean
221
+ } from "./chunk-GDC64SYJ.mjs";
222
+ import {
223
+ sum
224
+ } from "./chunk-2SLTL4KL.mjs";
225
+ import {
226
+ randomInt
227
+ } from "./chunk-GIWAOOFY.mjs";
228
+ import {
229
+ random
230
+ } from "./chunk-SYWMYQYJ.mjs";
231
+ import {
232
+ range
233
+ } from "./chunk-DPH2KE6O.mjs";
234
+ import {
235
+ round
236
+ } from "./chunk-5PMKOZ2F.mjs";
237
+ import "./chunk-236H5JZJ.mjs";
202
238
  import {
203
239
  debounce
204
240
  } from "./chunk-3IP4JVLL.mjs";
241
+ import {
242
+ negate
243
+ } from "./chunk-BOOQBJN2.mjs";
205
244
  import {
206
245
  noop
207
246
  } from "./chunk-LKXCOLNY.mjs";
@@ -211,15 +250,17 @@ import {
211
250
  import {
212
251
  throttle
213
252
  } from "./chunk-QOJGMVVR.mjs";
214
- import "./chunk-FZEZH22H.mjs";
215
253
  import {
216
- AbortError
217
- } from "./chunk-DXB7EZUQ.mjs";
218
- import "./chunk-2MM5EJJX.mjs";
254
+ clamp
255
+ } from "./chunk-MLCL773E.mjs";
256
+ import "./chunk-2HIMLZE3.mjs";
219
257
  export {
220
258
  AbortError,
259
+ camelCase,
260
+ capitalize,
221
261
  chunk,
222
262
  clamp,
263
+ clone,
223
264
  compact,
224
265
  countBy,
225
266
  debounce,
@@ -233,23 +274,30 @@ export {
233
274
  dropWhile,
234
275
  fill,
235
276
  flatten,
277
+ flattenDeep,
236
278
  forEachRight,
237
279
  groupBy,
238
280
  head,
239
281
  inRange,
282
+ initial,
240
283
  intersection,
241
284
  intersectionBy,
242
285
  intersectionWith,
243
286
  invert,
287
+ isEqual,
244
288
  isNil,
245
289
  isNotNil,
246
290
  isNull,
247
291
  isUndefined,
292
+ kebabCase,
248
293
  keyBy,
294
+ last,
295
+ lowerCase,
249
296
  maxBy,
250
297
  mean,
251
298
  meanBy,
252
299
  minBy,
300
+ negate,
253
301
  noop,
254
302
  omit,
255
303
  omitBy,
@@ -265,6 +313,7 @@ export {
265
313
  sample,
266
314
  sampleSize,
267
315
  shuffle,
316
+ snakeCase,
268
317
  sum,
269
318
  tail,
270
319
  take,
@@ -272,6 +321,7 @@ export {
272
321
  takeRightWhile,
273
322
  takeWhile,
274
323
  throttle,
324
+ toFilled,
275
325
  union,
276
326
  unionBy,
277
327
  unionWith,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  clamp
3
3
  } from "../chunk-MLCL773E.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  clamp
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  inRange
3
3
  } from "../chunk-BH6HLGBA.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  inRange
7
7
  };
@@ -55,8 +55,8 @@ function inRange(value, minimum, maximum) {
55
55
  // src/math/sum.ts
56
56
  function sum(nums) {
57
57
  let result = 0;
58
- for (const num of nums) {
59
- result += num;
58
+ for (let i = 0; i < nums.length; i++) {
59
+ result += nums[i];
60
60
  }
61
61
  return result;
62
62
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/math/index.ts","../../src/math/clamp.ts","../../src/math/inRange.ts","../../src/math/sum.ts","../../src/math/mean.ts","../../src/math/meanBy.ts","../../src/math/random.ts","../../src/math/randomInt.ts","../../src/math/round.ts","../../src/math/range.ts"],"sourcesContent":["export { clamp } from './clamp.ts';\nexport { inRange } from './inRange.ts';\nexport { mean } from './mean.ts';\nexport { meanBy } from './meanBy.ts';\nexport { random } from './random.ts';\nexport { randomInt } from './randomInt.ts';\nexport { round } from './round.ts';\nexport { sum } from './sum.ts';\nexport { range } from './range.ts';\n","/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n","export function inRange(value: number, maximum: number): boolean;\nexport function inRange(value: number, minimum: number, maximum: number): boolean;\n/**\n * Checks if the value is within a specified range.\n *\n * @param {number} value The value to check.\n * @param {number} minimum The lower bound of the range (inclusive).\n * @param {number} maximum The upper bound of the range (exclusive).\n * @returns {boolean} `true` if the value is within the specified range, otherwise `false`.\n * @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.\n *\n * @example\n * const result1 = inRange(3, 5); // result1 will be true.\n * const result2 = inRange(1, 2, 5); // result2 will be false.\n * const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.\n */\nexport function inRange(value: number, minimum: number, maximum?: number): boolean {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('The maximum value must be greater than the minimum value.');\n }\n\n return minimum <= value && value < maximum;\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Generate a random number within the given range.\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result1 = random(0, 5); // Returns a random number between 0 and 5.\n * const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown\n * const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.\n */\nexport function random(maximum: number): number;\nexport function random(minimum: number, maximum: number): number;\nexport function random(minimum: number, maximum?: number): number {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n","import { random } from './random.ts';\n\n/**\n * Generates a random integer between minimum (inclusive) and maximum (exclusive).\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)\n * const result2 = randomInt(5, 0); // This will throw an error\n */\nexport function randomInt(maximum: number): number;\nexport function randomInt(minimum: number, maximum: number): number;\nexport function randomInt(minimum: number, maximum?: number): number {\n return Math.floor(random(minimum, maximum!));\n}\n","/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n","/**\n * Returns an array of numbers from `start` to `end`, incrementing by `step`.\n *\n * If `step` is not provided, it defaults to `1`.\n *\n * @param {number} start - The starting number of the range (inclusive).\n * @param {number} [end] - The end number of the range (exclusive).\n * @param {number} [step] - The step value for the range. (default: 1)\n * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.\n *\n * @example\n * // Returns [0, 1, 2, 3]\n * range(4);\n *\n * @example\n * // Returns [0, 5, 10, 15]\n * range(0, 20, 5);\n *\n * @example\n * // Returns [0, -1, -2, -3]\n * range(0, -4, -1);\n *\n * @example\n * // Throws an error: The step value must be a non-zero integer.\n * range(1, 4, 0);\n */\nexport function range(end: number): number[];\nexport function range(start: number, end: number): number[];\nexport function range(start: number, end: number, step: number): number[];\nexport function range(start: number, end?: number, step?: number): number[] {\n if (end == null) {\n end = start;\n start = 0;\n }\n\n if (step == null) {\n step = 1;\n }\n\n if (!Number.isInteger(step) || step === 0) {\n throw new Error(`The step value must be a non-zero integer.`);\n }\n\n const length = Math.max(Math.ceil((end - start) / step), 0);\n const result = new Array(length);\n\n for (let i = 0; i < length; i++) {\n result[i] = start + i * step;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,SAAS,MAAM,OAAe,QAAgB,QAAyB;AAC5E,MAAI,UAAU,MAAM;AAClB,WAAO,KAAK,IAAI,OAAO,MAAM;AAAA,EAC/B;AAEA,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,MAAM,GAAG,MAAM;AACjD;;;ACTO,SAAS,QAAQ,OAAe,SAAiB,SAA2B;AACjF,MAAI,WAAW,MAAM;AACnB,cAAU;AACV,cAAU;AAAA,EACZ;AAEA,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AAEA,SAAO,WAAW,SAAS,QAAQ;AACrC;;;ACdO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;ACAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;;;ACJO,SAAS,OAAO,SAAiB,SAA0B;AAChE,MAAI,WAAW,MAAM;AACnB,cAAU;AACV,cAAU;AAAA,EACZ;AAEA,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AAEA,SAAO,KAAK,OAAO,KAAK,UAAU,WAAW;AAC/C;;;ACVO,SAAS,UAAU,SAAiB,SAA0B;AACnE,SAAO,KAAK,MAAM,OAAO,SAAS,OAAQ,CAAC;AAC7C;;;ACHO,SAAS,MAAM,OAAe,YAAY,GAAW;AAC1D,MAAI,CAAC,OAAO,UAAU,SAAS,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;;;ACMO,SAAS,MAAM,OAAe,KAAc,MAAyB;AAC1E,MAAI,OAAO,MAAM;AACf,UAAM;AACN,YAAQ;AAAA,EACV;AAEA,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,SAAS,GAAG;AACzC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,SAAS,KAAK,IAAI,KAAK,MAAM,MAAM,SAAS,IAAI,GAAG,CAAC;AAC1D,QAAM,SAAS,IAAI,MAAM,MAAM;AAE/B,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,WAAO,CAAC,IAAI,QAAQ,IAAI;AAAA,EAC1B;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/math/index.ts","../../src/math/clamp.ts","../../src/math/inRange.ts","../../src/math/sum.ts","../../src/math/mean.ts","../../src/math/meanBy.ts","../../src/math/random.ts","../../src/math/randomInt.ts","../../src/math/round.ts","../../src/math/range.ts"],"sourcesContent":["export { clamp } from './clamp.ts';\nexport { inRange } from './inRange.ts';\nexport { mean } from './mean.ts';\nexport { meanBy } from './meanBy.ts';\nexport { random } from './random.ts';\nexport { randomInt } from './randomInt.ts';\nexport { round } from './round.ts';\nexport { sum } from './sum.ts';\nexport { range } from './range.ts';\n","/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n","export function inRange(value: number, maximum: number): boolean;\nexport function inRange(value: number, minimum: number, maximum: number): boolean;\n/**\n * Checks if the value is within a specified range.\n *\n * @param {number} value The value to check.\n * @param {number} minimum The lower bound of the range (inclusive).\n * @param {number} maximum The upper bound of the range (exclusive).\n * @returns {boolean} `true` if the value is within the specified range, otherwise `false`.\n * @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.\n *\n * @example\n * const result1 = inRange(3, 5); // result1 will be true.\n * const result2 = inRange(1, 2, 5); // result2 will be false.\n * const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.\n */\nexport function inRange(value: number, minimum: number, maximum?: number): boolean {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('The maximum value must be greater than the minimum value.');\n }\n\n return minimum <= value && value < maximum;\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (let i = 0; i < nums.length; i++) {\n result += nums[i];\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Generate a random number within the given range.\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result1 = random(0, 5); // Returns a random number between 0 and 5.\n * const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown\n * const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.\n */\nexport function random(maximum: number): number;\nexport function random(minimum: number, maximum: number): number;\nexport function random(minimum: number, maximum?: number): number {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n","import { random } from './random.ts';\n\n/**\n * Generates a random integer between minimum (inclusive) and maximum (exclusive).\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)\n * const result2 = randomInt(5, 0); // This will throw an error\n */\nexport function randomInt(maximum: number): number;\nexport function randomInt(minimum: number, maximum: number): number;\nexport function randomInt(minimum: number, maximum?: number): number {\n return Math.floor(random(minimum, maximum!));\n}\n","/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n","/**\n * Returns an array of numbers from `start` to `end`, incrementing by `step`.\n *\n * If `step` is not provided, it defaults to `1`.\n *\n * @param {number} start - The starting number of the range (inclusive).\n * @param {number} [end] - The end number of the range (exclusive).\n * @param {number} [step] - The step value for the range. (default: 1)\n * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.\n *\n * @example\n * // Returns [0, 1, 2, 3]\n * range(4);\n *\n * @example\n * // Returns [0, 5, 10, 15]\n * range(0, 20, 5);\n *\n * @example\n * // Returns [0, -1, -2, -3]\n * range(0, -4, -1);\n *\n * @example\n * // Throws an error: The step value must be a non-zero integer.\n * range(1, 4, 0);\n */\nexport function range(end: number): number[];\nexport function range(start: number, end: number): number[];\nexport function range(start: number, end: number, step: number): number[];\nexport function range(start: number, end?: number, step?: number): number[] {\n if (end == null) {\n end = start;\n start = 0;\n }\n\n if (step == null) {\n step = 1;\n }\n\n if (!Number.isInteger(step) || step === 0) {\n throw new Error(`The step value must be a non-zero integer.`);\n }\n\n const length = Math.max(Math.ceil((end - start) / step), 0);\n const result = new Array(length);\n\n for (let i = 0; i < length; i++) {\n result[i] = start + i * step;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,SAAS,MAAM,OAAe,QAAgB,QAAyB;AAC5E,MAAI,UAAU,MAAM;AAClB,WAAO,KAAK,IAAI,OAAO,MAAM;AAAA,EAC/B;AAEA,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,MAAM,GAAG,MAAM;AACjD;;;ACTO,SAAS,QAAQ,OAAe,SAAiB,SAA2B;AACjF,MAAI,WAAW,MAAM;AACnB,cAAU;AACV,cAAU;AAAA,EACZ;AAEA,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AAEA,SAAO,WAAW,SAAS,QAAQ;AACrC;;;ACdO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,cAAU,KAAK,CAAC;AAAA,EAClB;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;ACAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;;;ACJO,SAAS,OAAO,SAAiB,SAA0B;AAChE,MAAI,WAAW,MAAM;AACnB,cAAU;AACV,cAAU;AAAA,EACZ;AAEA,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AAEA,SAAO,KAAK,OAAO,KAAK,UAAU,WAAW;AAC/C;;;ACVO,SAAS,UAAU,SAAiB,SAA0B;AACnE,SAAO,KAAK,MAAM,OAAO,SAAS,OAAQ,CAAC;AAC7C;;;ACHO,SAAS,MAAM,OAAe,YAAY,GAAW;AAC1D,MAAI,CAAC,OAAO,UAAU,SAAS,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;;;ACMO,SAAS,MAAM,OAAe,KAAc,MAAyB;AAC1E,MAAI,OAAO,MAAM;AACf,UAAM;AACN,YAAQ;AAAA,EACV;AAEA,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,SAAS,GAAG;AACzC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,SAAS,KAAK,IAAI,KAAK,MAAM,MAAM,SAAS,IAAI,GAAG,CAAC;AAC1D,QAAM,SAAS,IAAI,MAAM,MAAM;AAE/B,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,WAAO,CAAC,IAAI,QAAQ,IAAI;AAAA,EAC1B;AAEA,SAAO;AACT;","names":[]}
@@ -4,13 +4,19 @@ import {
4
4
  } from "../chunk-BH6HLGBA.mjs";
5
5
  import {
6
6
  meanBy
7
- } from "../chunk-SDIMTYZW.mjs";
7
+ } from "../chunk-IZAD2S7R.mjs";
8
8
  import {
9
9
  mean
10
- } from "../chunk-LT6E4Y4Z.mjs";
10
+ } from "../chunk-GDC64SYJ.mjs";
11
11
  import {
12
12
  sum
13
- } from "../chunk-NOFHNJ5C.mjs";
13
+ } from "../chunk-2SLTL4KL.mjs";
14
+ import {
15
+ randomInt
16
+ } from "../chunk-GIWAOOFY.mjs";
17
+ import {
18
+ random
19
+ } from "../chunk-SYWMYQYJ.mjs";
14
20
  import {
15
21
  range
16
22
  } from "../chunk-DPH2KE6O.mjs";
@@ -20,13 +26,7 @@ import {
20
26
  import {
21
27
  clamp
22
28
  } from "../chunk-MLCL773E.mjs";
23
- import {
24
- randomInt
25
- } from "../chunk-GIWAOOFY.mjs";
26
- import {
27
- random
28
- } from "../chunk-SYWMYQYJ.mjs";
29
- import "../chunk-2MM5EJJX.mjs";
29
+ import "../chunk-2HIMLZE3.mjs";
30
30
  export {
31
31
  clamp,
32
32
  inRange,
package/dist/math/mean.js CHANGED
@@ -27,8 +27,8 @@ module.exports = __toCommonJS(mean_exports);
27
27
  // src/math/sum.ts
28
28
  function sum(nums) {
29
29
  let result = 0;
30
- for (const num of nums) {
31
- result += num;
30
+ for (let i = 0; i < nums.length; i++) {
31
+ result += nums[i];
32
32
  }
33
33
  return result;
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/math/mean.ts","../../src/math/sum.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ADNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;","names":[]}
1
+ {"version":3,"sources":["../../src/math/mean.ts","../../src/math/sum.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (let i = 0; i < nums.length; i++) {\n result += nums[i];\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,cAAU,KAAK,CAAC;AAAA,EAClB;AAEA,SAAO;AACT;;;ADNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;","names":[]}
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  mean
3
- } from "../chunk-LT6E4Y4Z.mjs";
4
- import "../chunk-NOFHNJ5C.mjs";
5
- import "../chunk-2MM5EJJX.mjs";
3
+ } from "../chunk-GDC64SYJ.mjs";
4
+ import "../chunk-2SLTL4KL.mjs";
5
+ import "../chunk-2HIMLZE3.mjs";
6
6
  export {
7
7
  mean
8
8
  };
@@ -27,8 +27,8 @@ module.exports = __toCommonJS(meanBy_exports);
27
27
  // src/math/sum.ts
28
28
  function sum(nums) {
29
29
  let result = 0;
30
- for (const num of nums) {
31
- result += num;
30
+ for (let i = 0; i < nums.length; i++) {
31
+ result += nums[i];
32
32
  }
33
33
  return result;
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/math/meanBy.ts","../../src/math/sum.ts","../../src/math/mean.ts"],"sourcesContent":["import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;AFAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;","names":[]}
1
+ {"version":3,"sources":["../../src/math/meanBy.ts","../../src/math/sum.ts","../../src/math/mean.ts"],"sourcesContent":["import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (let i = 0; i < nums.length; i++) {\n result += nums[i];\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,cAAU,KAAK,CAAC;AAAA,EAClB;AAEA,SAAO;AACT;;;ACNO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;;;AFAO,SAAS,OAAU,OAAqB,UAA0C;AACvF,QAAM,OAAO,MAAM,IAAI,OAAK,SAAS,CAAC,CAAC;AAEvC,SAAO,KAAK,IAAI;AAClB;","names":[]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  meanBy
3
- } from "../chunk-SDIMTYZW.mjs";
4
- import "../chunk-LT6E4Y4Z.mjs";
5
- import "../chunk-NOFHNJ5C.mjs";
6
- import "../chunk-2MM5EJJX.mjs";
3
+ } from "../chunk-IZAD2S7R.mjs";
4
+ import "../chunk-GDC64SYJ.mjs";
5
+ import "../chunk-2SLTL4KL.mjs";
6
+ import "../chunk-2HIMLZE3.mjs";
7
7
  export {
8
8
  meanBy
9
9
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  random
3
3
  } from "../chunk-SYWMYQYJ.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  random
7
7
  };
@@ -2,7 +2,7 @@ import {
2
2
  randomInt
3
3
  } from "../chunk-GIWAOOFY.mjs";
4
4
  import "../chunk-SYWMYQYJ.mjs";
5
- import "../chunk-2MM5EJJX.mjs";
5
+ import "../chunk-2HIMLZE3.mjs";
6
6
  export {
7
7
  randomInt
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  range
3
3
  } from "../chunk-DPH2KE6O.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  range
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  round
3
3
  } from "../chunk-5PMKOZ2F.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  round
7
7
  };
package/dist/math/sum.js CHANGED
@@ -25,8 +25,8 @@ __export(sum_exports, {
25
25
  module.exports = __toCommonJS(sum_exports);
26
26
  function sum(nums) {
27
27
  let result = 0;
28
- for (const num of nums) {
29
- result += num;
28
+ for (let i = 0; i < nums.length; i++) {
29
+ result += nums[i];
30
30
  }
31
31
  return result;
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (let i = 0; i < nums.length; i++) {\n result += nums[i];\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,cAAU,KAAK,CAAC;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
package/dist/math/sum.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sum
3
- } from "../chunk-NOFHNJ5C.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
3
+ } from "../chunk-2SLTL4KL.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  sum
7
7
  };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Creates a shallow clone of the given object.
3
+ *
4
+ * @template T - The type of the object.
5
+ * @param {T} obj - The object to clone.
6
+ * @returns {T} - A shallow clone of the given object.
7
+ *
8
+ * @example
9
+ * // Clone a primitive values
10
+ * const num = 29;
11
+ * const clonedNum = clone(num);
12
+ * console.log(clonedNum); // 29
13
+ * console.log(clonedNum === num) ; // true
14
+ *
15
+ * @example
16
+ * // Clone an array
17
+ * const arr = [1, 2, 3];
18
+ * const clonedArr = clone(arr);
19
+ * console.log(clonedArr); // [1, 2, 3]
20
+ * console.log(clonedArr === arr); // false
21
+ *
22
+ * @example
23
+ * // Clone an object
24
+ * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
25
+ * const clonedObj = clone(obj);
26
+ * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
27
+ * console.log(clonedObj === obj); // false
28
+ */
29
+ declare function clone<T>(obj: T): T;
30
+
31
+ export { clone };