es-toolkit 1.9.0 → 1.10.0-dev.202

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 +62 -46
  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 +9 -5
  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 +11 -11
  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,19 +29,35 @@ 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";
45
+ import {
46
+ omitBy
47
+ } from "./chunk-BCTYOXT7.mjs";
48
+ import {
49
+ pick
50
+ } from "./chunk-HPFDYUGP.mjs";
51
+ import {
52
+ pickBy
53
+ } from "./chunk-6CLH5YZ2.mjs";
54
+ import {
55
+ clone
56
+ } from "./chunk-U4JGKZ56.mjs";
57
+ import "./chunk-TLVQSNOE.mjs";
58
+ import {
59
+ meanBy
60
+ } from "./chunk-IZAD2S7R.mjs";
47
61
  import {
48
62
  range
49
63
  } from "./chunk-DPH2KE6O.mjs";
@@ -53,16 +67,16 @@ import {
53
67
  import {
54
68
  clamp
55
69
  } from "./chunk-MLCL773E.mjs";
56
- import "./chunk-LOY6PATI.mjs";
57
70
  import {
58
- without
59
- } from "./chunk-PYEYV7BY.mjs";
71
+ inRange
72
+ } from "./chunk-BH6HLGBA.mjs";
60
73
  import {
61
- xor
62
- } from "./chunk-L7FQX5MN.mjs";
74
+ mean
75
+ } from "./chunk-GDC64SYJ.mjs";
63
76
  import {
64
- xorBy
65
- } from "./chunk-Q47NGNXT.mjs";
77
+ sum
78
+ } from "./chunk-2SLTL4KL.mjs";
79
+ import "./chunk-2MRZANXZ.mjs";
66
80
  import {
67
81
  xorWith
68
82
  } from "./chunk-QRSJBBFY.mjs";
@@ -75,30 +89,66 @@ import {
75
89
  import {
76
90
  zipWith
77
91
  } from "./chunk-4KYXHZ4R.mjs";
92
+ import {
93
+ uniqBy
94
+ } from "./chunk-OXAZEEGP.mjs";
95
+ import {
96
+ unzip
97
+ } from "./chunk-UYZKMBDO.mjs";
98
+ import {
99
+ unzipWith
100
+ } from "./chunk-IFNXROZR.mjs";
101
+ import {
102
+ without
103
+ } from "./chunk-PYEYV7BY.mjs";
104
+ import {
105
+ xor
106
+ } from "./chunk-L7FQX5MN.mjs";
107
+ import {
108
+ xorBy
109
+ } from "./chunk-Q47NGNXT.mjs";
110
+ import {
111
+ take
112
+ } from "./chunk-ME352XO7.mjs";
113
+ import {
114
+ takeRight
115
+ } from "./chunk-IQLKIDXF.mjs";
116
+ import {
117
+ takeRightWhile
118
+ } from "./chunk-NTLX2MPV.mjs";
119
+ import {
120
+ takeWhile
121
+ } from "./chunk-2IXFGSUA.mjs";
122
+ import {
123
+ toFilled
124
+ } from "./chunk-OP4OAKQJ.mjs";
78
125
  import {
79
126
  union
80
127
  } from "./chunk-R6QA7PLZ.mjs";
128
+ import {
129
+ uniq
130
+ } from "./chunk-DVK2N4KC.mjs";
81
131
  import {
82
132
  unionBy
83
133
  } from "./chunk-NFS7RWWE.mjs";
84
134
  import {
85
135
  unionWith
86
136
  } from "./chunk-2ZCITDMK.mjs";
87
- import {
88
- uniq
89
- } from "./chunk-DVK2N4KC.mjs";
90
- import {
91
- uniqBy
92
- } from "./chunk-OXAZEEGP.mjs";
93
137
  import {
94
138
  uniqWith
95
139
  } from "./chunk-237HGSZS.mjs";
96
140
  import {
97
- unzip
98
- } from "./chunk-UYZKMBDO.mjs";
141
+ maxBy
142
+ } from "./chunk-OOKNBU4V.mjs";
99
143
  import {
100
- unzipWith
101
- } from "./chunk-IFNXROZR.mjs";
144
+ minBy
145
+ } from "./chunk-IJD7FE2Z.mjs";
146
+ import {
147
+ orderBy
148
+ } from "./chunk-7B7W36UP.mjs";
149
+ import {
150
+ partition
151
+ } from "./chunk-DN3NOZ3H.mjs";
102
152
  import {
103
153
  sample
104
154
  } from "./chunk-2KNLZB7V.mjs";
@@ -118,17 +168,11 @@ import {
118
168
  tail
119
169
  } from "./chunk-OF6NM4G7.mjs";
120
170
  import {
121
- take
122
- } from "./chunk-ME352XO7.mjs";
123
- import {
124
- takeRight
125
- } from "./chunk-IQLKIDXF.mjs";
126
- import {
127
- takeRightWhile
128
- } from "./chunk-NTLX2MPV.mjs";
171
+ head
172
+ } from "./chunk-HM2JT2RX.mjs";
129
173
  import {
130
- takeWhile
131
- } from "./chunk-2IXFGSUA.mjs";
174
+ initial
175
+ } from "./chunk-XPSOKBRZ.mjs";
132
176
  import {
133
177
  intersection
134
178
  } from "./chunk-FVVSE2F2.mjs";
@@ -142,17 +186,11 @@ import {
142
186
  keyBy
143
187
  } from "./chunk-AJKZMN2V.mjs";
144
188
  import {
145
- maxBy
146
- } from "./chunk-OOKNBU4V.mjs";
147
- import {
148
- minBy
149
- } from "./chunk-IJD7FE2Z.mjs";
150
- import {
151
- orderBy
152
- } from "./chunk-7B7W36UP.mjs";
189
+ last
190
+ } from "./chunk-KPBQ7OUY.mjs";
153
191
  import {
154
- partition
155
- } from "./chunk-DN3NOZ3H.mjs";
192
+ dropRight
193
+ } from "./chunk-JEKUA56R.mjs";
156
194
  import {
157
195
  dropRightWhile
158
196
  } from "./chunk-JE6JKZU3.mjs";
@@ -162,6 +200,9 @@ import {
162
200
  import {
163
201
  fill
164
202
  } from "./chunk-C4WE4GLC.mjs";
203
+ import {
204
+ flattenDeep
205
+ } from "./chunk-ML727RRJ.mjs";
165
206
  import {
166
207
  flatten
167
208
  } from "./chunk-33MSBDC6.mjs";
@@ -171,9 +212,6 @@ import {
171
212
  import {
172
213
  groupBy
173
214
  } from "./chunk-E6E4RZLN.mjs";
174
- import {
175
- head
176
- } from "./chunk-HM2JT2RX.mjs";
177
215
  import {
178
216
  chunk
179
217
  } from "./chunk-E6C5EZQA.mjs";
@@ -195,31 +233,34 @@ import {
195
233
  import {
196
234
  drop
197
235
  } from "./chunk-S3CORED5.mjs";
236
+ import "./chunk-FZEZH22H.mjs";
198
237
  import {
199
- dropRight
200
- } from "./chunk-JEKUA56R.mjs";
201
- import "./chunk-N6EM6ETS.mjs";
238
+ AbortError
239
+ } from "./chunk-DXB7EZUQ.mjs";
240
+ import "./chunk-236H5JZJ.mjs";
241
+ import {
242
+ throttle
243
+ } from "./chunk-QOJGMVVR.mjs";
202
244
  import {
203
245
  debounce
204
246
  } from "./chunk-3IP4JVLL.mjs";
247
+ import {
248
+ negate
249
+ } from "./chunk-BOOQBJN2.mjs";
205
250
  import {
206
251
  noop
207
252
  } from "./chunk-LKXCOLNY.mjs";
208
253
  import {
209
254
  once
210
255
  } from "./chunk-CMBC4MXG.mjs";
211
- import {
212
- throttle
213
- } from "./chunk-QOJGMVVR.mjs";
214
- import "./chunk-FZEZH22H.mjs";
215
- import {
216
- AbortError
217
- } from "./chunk-DXB7EZUQ.mjs";
218
- import "./chunk-2MM5EJJX.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":[]}
@@ -1,16 +1,7 @@
1
1
  import "../chunk-TLVQSNOE.mjs";
2
- import {
3
- inRange
4
- } from "../chunk-BH6HLGBA.mjs";
5
2
  import {
6
3
  meanBy
7
- } from "../chunk-SDIMTYZW.mjs";
8
- import {
9
- mean
10
- } from "../chunk-LT6E4Y4Z.mjs";
11
- import {
12
- sum
13
- } from "../chunk-NOFHNJ5C.mjs";
4
+ } from "../chunk-IZAD2S7R.mjs";
14
5
  import {
15
6
  range
16
7
  } from "../chunk-DPH2KE6O.mjs";
@@ -20,13 +11,22 @@ import {
20
11
  import {
21
12
  clamp
22
13
  } from "../chunk-MLCL773E.mjs";
14
+ import {
15
+ inRange
16
+ } from "../chunk-BH6HLGBA.mjs";
17
+ import {
18
+ mean
19
+ } from "../chunk-GDC64SYJ.mjs";
20
+ import {
21
+ sum
22
+ } from "../chunk-2SLTL4KL.mjs";
23
23
  import {
24
24
  randomInt
25
25
  } from "../chunk-GIWAOOFY.mjs";
26
26
  import {
27
27
  random
28
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 };