ts-data-forge 10.0.0 → 11.0.1

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 (249) hide show
  1. package/dist/array/impl/array-utils-creation.d.mts +3 -3
  2. package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-creation.mjs.map +1 -1
  4. package/dist/array/impl/array-utils-element-access.d.mts +4 -4
  5. package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
  6. package/dist/{guard/as-length-bounded-array.d.mts → array/impl/array-utils-length-bounded-array-cast.d.mts} +9 -9
  7. package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts.map +1 -0
  8. package/dist/{guard/as-length-bounded-array.mjs → array/impl/array-utils-length-bounded-array-cast.mjs} +2 -2
  9. package/dist/array/impl/array-utils-length-bounded-array-cast.mjs.map +1 -0
  10. package/dist/{guard/is-length-bounded-array.d.mts → array/impl/array-utils-length-bounded-array-guard.d.mts} +13 -13
  11. package/dist/array/impl/array-utils-length-bounded-array-guard.d.mts.map +1 -0
  12. package/dist/{guard/is-length-bounded-array.mjs → array/impl/array-utils-length-bounded-array-guard.mjs} +1 -1
  13. package/dist/array/impl/array-utils-length-bounded-array-guard.mjs.map +1 -0
  14. package/dist/array/impl/array-utils-modification.d.mts +9 -9
  15. package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
  16. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  17. package/dist/array/impl/array-utils-reducing-value.d.mts +9 -9
  18. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  19. package/dist/array/impl/array-utils-size.d.mts +3 -3
  20. package/dist/array/impl/array-utils-size.mjs.map +1 -1
  21. package/dist/array/impl/array-utils-slicing.d.mts +9 -9
  22. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
  23. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  24. package/dist/array/impl/array-utils-transformation.d.mts +16 -10
  25. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
  26. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  27. package/dist/array/impl/index.d.mts +2 -0
  28. package/dist/array/impl/index.d.mts.map +1 -1
  29. package/dist/array/impl/index.mjs +2 -0
  30. package/dist/array/impl/index.mjs.map +1 -1
  31. package/dist/entry-point.mjs +1 -3
  32. package/dist/entry-point.mjs.map +1 -1
  33. package/dist/guard/index.d.mts +0 -3
  34. package/dist/guard/index.d.mts.map +1 -1
  35. package/dist/guard/index.mjs +0 -3
  36. package/dist/guard/index.mjs.map +1 -1
  37. package/dist/index.d.mts +1 -0
  38. package/dist/index.d.mts.map +1 -1
  39. package/dist/index.mjs +1 -3
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/number/branded-types/finite-number.d.mts +47 -61
  42. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  43. package/dist/number/branded-types/finite-number.mjs +37 -41
  44. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  45. package/dist/number/branded-types/int.d.mts +40 -46
  46. package/dist/number/branded-types/int.d.mts.map +1 -1
  47. package/dist/number/branded-types/int.mjs +29 -31
  48. package/dist/number/branded-types/int.mjs.map +1 -1
  49. package/dist/number/branded-types/int16.d.mts +65 -58
  50. package/dist/number/branded-types/int16.d.mts.map +1 -1
  51. package/dist/number/branded-types/int16.mjs +49 -45
  52. package/dist/number/branded-types/int16.mjs.map +1 -1
  53. package/dist/number/branded-types/int32.d.mts +65 -58
  54. package/dist/number/branded-types/int32.d.mts.map +1 -1
  55. package/dist/number/branded-types/int32.mjs +49 -45
  56. package/dist/number/branded-types/int32.mjs.map +1 -1
  57. package/dist/number/branded-types/negative-finite-number.d.mts +68 -59
  58. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  59. package/dist/number/branded-types/negative-finite-number.mjs +52 -46
  60. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  61. package/dist/number/branded-types/negative-int.d.mts +60 -48
  62. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  63. package/dist/number/branded-types/negative-int.mjs +40 -36
  64. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  65. package/dist/number/branded-types/negative-safe-int.d.mts +57 -56
  66. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  67. package/dist/number/branded-types/negative-safe-int.mjs +40 -41
  68. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  69. package/dist/number/branded-types/non-negative-finite-number.d.mts +74 -64
  70. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  71. package/dist/number/branded-types/non-negative-finite-number.mjs +58 -51
  72. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  73. package/dist/number/branded-types/non-negative-int16.d.mts +64 -57
  74. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  75. package/dist/number/branded-types/non-negative-int16.mjs +47 -43
  76. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  77. package/dist/number/branded-types/non-negative-int32.d.mts +64 -58
  78. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  79. package/dist/number/branded-types/non-negative-int32.mjs +47 -44
  80. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  81. package/dist/number/branded-types/non-positive-finite-number.d.mts +64 -54
  82. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  83. package/dist/number/branded-types/non-positive-finite-number.mjs +48 -41
  84. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  85. package/dist/number/branded-types/non-positive-int.d.mts +41 -146
  86. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  87. package/dist/number/branded-types/non-positive-int.mjs +27 -107
  88. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  89. package/dist/number/branded-types/non-positive-safe-int.d.mts +54 -53
  90. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  91. package/dist/number/branded-types/non-positive-safe-int.mjs +37 -39
  92. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  93. package/dist/number/branded-types/non-zero-finite-number.d.mts +62 -49
  94. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  95. package/dist/number/branded-types/non-zero-finite-number.mjs +46 -37
  96. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  97. package/dist/number/branded-types/non-zero-int.d.mts +51 -38
  98. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  99. package/dist/number/branded-types/non-zero-int.mjs +31 -27
  100. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  101. package/dist/number/branded-types/non-zero-int16.d.mts +52 -53
  102. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  103. package/dist/number/branded-types/non-zero-int16.mjs +36 -39
  104. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  105. package/dist/number/branded-types/non-zero-int32.d.mts +52 -54
  106. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  107. package/dist/number/branded-types/non-zero-int32.mjs +36 -40
  108. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  109. package/dist/number/branded-types/non-zero-safe-int.d.mts +53 -54
  110. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  111. package/dist/number/branded-types/non-zero-safe-int.mjs +36 -40
  112. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  113. package/dist/number/branded-types/non-zero-uint16.d.mts +52 -53
  114. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  115. package/dist/number/branded-types/non-zero-uint16.mjs +35 -39
  116. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  117. package/dist/number/branded-types/non-zero-uint32.d.mts +52 -53
  118. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  119. package/dist/number/branded-types/non-zero-uint32.mjs +35 -39
  120. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  121. package/dist/number/branded-types/positive-finite-number.d.mts +74 -63
  122. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  123. package/dist/number/branded-types/positive-finite-number.mjs +58 -50
  124. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  125. package/dist/number/branded-types/positive-int.d.mts +46 -68
  126. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  127. package/dist/number/branded-types/positive-int.mjs +34 -49
  128. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  129. package/dist/number/branded-types/positive-int16.d.mts +61 -57
  130. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  131. package/dist/number/branded-types/positive-int16.mjs +44 -43
  132. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  133. package/dist/number/branded-types/positive-int32.d.mts +61 -57
  134. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  135. package/dist/number/branded-types/positive-int32.mjs +44 -43
  136. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  137. package/dist/number/branded-types/positive-safe-int.d.mts +62 -57
  138. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  139. package/dist/number/branded-types/positive-safe-int.mjs +45 -43
  140. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  141. package/dist/number/branded-types/positive-uint16.d.mts +61 -57
  142. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  143. package/dist/number/branded-types/positive-uint16.mjs +44 -43
  144. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  145. package/dist/number/branded-types/positive-uint32.d.mts +61 -58
  146. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  147. package/dist/number/branded-types/positive-uint32.mjs +44 -44
  148. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  149. package/dist/number/branded-types/safe-int.d.mts +43 -62
  150. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  151. package/dist/number/branded-types/safe-int.mjs +35 -42
  152. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  153. package/dist/number/branded-types/safe-uint.d.mts +62 -57
  154. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  155. package/dist/number/branded-types/safe-uint.mjs +46 -44
  156. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  157. package/dist/number/branded-types/uint.d.mts +63 -50
  158. package/dist/number/branded-types/uint.d.mts.map +1 -1
  159. package/dist/number/branded-types/uint.mjs +42 -39
  160. package/dist/number/branded-types/uint.mjs.map +1 -1
  161. package/dist/number/branded-types/uint16.d.mts +60 -58
  162. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  163. package/dist/number/branded-types/uint16.mjs +44 -43
  164. package/dist/number/branded-types/uint16.mjs.map +1 -1
  165. package/dist/number/branded-types/uint32.d.mts +59 -55
  166. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  167. package/dist/number/branded-types/uint32.mjs +42 -42
  168. package/dist/number/branded-types/uint32.mjs.map +1 -1
  169. package/dist/number/enum/int8.d.mts +56 -65
  170. package/dist/number/enum/int8.d.mts.map +1 -1
  171. package/dist/number/enum/int8.mjs +44 -43
  172. package/dist/number/enum/int8.mjs.map +1 -1
  173. package/dist/number/enum/uint8.d.mts +60 -58
  174. package/dist/number/enum/uint8.d.mts.map +1 -1
  175. package/dist/number/enum/uint8.mjs +44 -43
  176. package/dist/number/enum/uint8.mjs.map +1 -1
  177. package/dist/string/index.d.mts +2 -0
  178. package/dist/string/index.d.mts.map +1 -0
  179. package/dist/string/index.mjs +2 -0
  180. package/dist/string/index.mjs.map +1 -0
  181. package/dist/string/str.d.mts +273 -0
  182. package/dist/string/str.d.mts.map +1 -0
  183. package/dist/string/str.mjs +42 -0
  184. package/dist/string/str.mjs.map +1 -0
  185. package/package.json +31 -92
  186. package/src/array/impl/array-utils-creation.mts +2 -1
  187. package/src/array/impl/array-utils-element-access.mts +3 -3
  188. package/src/array/impl/array-utils-element-access.test.mts +3 -3
  189. package/src/{guard/as-length-bounded-array.mts → array/impl/array-utils-length-bounded-array-cast.mts} +9 -9
  190. package/src/{guard/as-length-bounded-array.test.mts → array/impl/array-utils-length-bounded-array-cast.test.mts} +2 -2
  191. package/src/{guard/is-length-bounded-array.mts → array/impl/array-utils-length-bounded-array-guard.mts} +12 -12
  192. package/src/{guard/is-length-bounded-array.test.mts → array/impl/array-utils-length-bounded-array-guard.test.mts} +2 -2
  193. package/src/array/impl/array-utils-modification.mts +9 -8
  194. package/src/array/impl/array-utils-modification.test.mts +6 -1
  195. package/src/array/impl/array-utils-reducing-value.mts +9 -9
  196. package/src/array/impl/array-utils-size.mts +2 -2
  197. package/src/array/impl/array-utils-slicing.mts +24 -13
  198. package/src/array/impl/array-utils-transformation.mts +18 -12
  199. package/src/array/impl/array-utils-transformation.test.mts +12 -12
  200. package/src/array/impl/index.mts +2 -0
  201. package/src/guard/index.mts +0 -3
  202. package/src/index.mts +1 -0
  203. package/src/number/branded-types/finite-number.mts +47 -61
  204. package/src/number/branded-types/int.mts +40 -46
  205. package/src/number/branded-types/int16.mts +65 -58
  206. package/src/number/branded-types/int32.mts +65 -58
  207. package/src/number/branded-types/negative-finite-number.mts +68 -68
  208. package/src/number/branded-types/negative-int.mts +60 -57
  209. package/src/number/branded-types/negative-safe-int.mts +57 -65
  210. package/src/number/branded-types/non-negative-finite-number.mts +74 -64
  211. package/src/number/branded-types/non-negative-int16.mts +64 -57
  212. package/src/number/branded-types/non-negative-int32.mts +64 -58
  213. package/src/number/branded-types/non-positive-finite-number.mts +64 -54
  214. package/src/number/branded-types/non-positive-int.mts +41 -146
  215. package/src/number/branded-types/non-positive-safe-int.mts +54 -53
  216. package/src/number/branded-types/non-zero-finite-number.mts +62 -51
  217. package/src/number/branded-types/non-zero-int.mts +51 -38
  218. package/src/number/branded-types/non-zero-int16.mts +52 -53
  219. package/src/number/branded-types/non-zero-int32.mts +52 -54
  220. package/src/number/branded-types/non-zero-safe-int.mts +53 -54
  221. package/src/number/branded-types/non-zero-uint16.mts +52 -53
  222. package/src/number/branded-types/non-zero-uint32.mts +52 -53
  223. package/src/number/branded-types/positive-finite-number.mts +74 -63
  224. package/src/number/branded-types/positive-int.mts +46 -68
  225. package/src/number/branded-types/positive-int16.mts +61 -57
  226. package/src/number/branded-types/positive-int32.mts +61 -57
  227. package/src/number/branded-types/positive-safe-int.mts +62 -57
  228. package/src/number/branded-types/positive-uint16.mts +61 -57
  229. package/src/number/branded-types/positive-uint32.mts +61 -58
  230. package/src/number/branded-types/safe-int.mts +43 -62
  231. package/src/number/branded-types/safe-uint.mts +62 -57
  232. package/src/number/branded-types/uint.mts +63 -50
  233. package/src/number/branded-types/uint16.mts +60 -58
  234. package/src/number/branded-types/uint32.mts +59 -55
  235. package/src/number/enum/int8.mts +56 -65
  236. package/src/number/enum/uint8.mts +60 -58
  237. package/src/string/index.mts +1 -0
  238. package/src/string/str.mts +371 -0
  239. package/src/string/str.test.mts +215 -0
  240. package/dist/guard/as-length-bounded-array.d.mts.map +0 -1
  241. package/dist/guard/as-length-bounded-array.mjs.map +0 -1
  242. package/dist/guard/is-length-bounded-array.d.mts.map +0 -1
  243. package/dist/guard/is-length-bounded-array.mjs.map +0 -1
  244. package/dist/guard/is-length-bounded-string.d.mts +0 -163
  245. package/dist/guard/is-length-bounded-string.d.mts.map +0 -1
  246. package/dist/guard/is-length-bounded-string.mjs +0 -7
  247. package/dist/guard/is-length-bounded-string.mjs.map +0 -1
  248. package/src/guard/is-length-bounded-string.mts +0 -199
  249. package/src/guard/is-length-bounded-string.test.mts +0 -170
@@ -1,119 +1,121 @@
1
1
  import { type Uint8 as TtfImported_Uint8 } from 'ts-type-forge';
2
2
  export type Uint8 = TtfImported_Uint8;
3
3
  /**
4
- * Checks if a number is a Uint8 (8-bit unsigned integer in the range [0, 255]).
4
+ * Type guard that checks if a value is an non-negative integer less than 256.
5
5
  *
6
- * @param value The value to check.
7
- * @returns `true` if the value is a Uint8, `false` otherwise.
6
+ * Returns `true` for an non-negative integer less than 256 — a value with no
7
+ * fractional component.
8
+ *
9
+ * @param value - The value to check
10
+ * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise
8
11
  */
9
12
  export declare const isUint8: (x: number) => x is Uint8;
10
13
  /**
11
- * Casts a number to a Uint8 type. This function validates that the input is
12
- * within the Uint8 range [0, 255] and is an integer, then returns it with the
13
- * Uint8 brand.
14
+ * Casts a `number` to the `Uint8` branded type.
15
+ *
16
+ * Validates that the value is an non-negative integer less than 256 and returns
17
+ * it with the `Uint8` brand. Throws a `TypeError` otherwise.
14
18
  *
15
- * @param value The value to cast.
16
- * @returns The value as a Uint8 type.
17
- * @throws {TypeError} If the value is not a valid 8-bit unsigned integer.
19
+ * @param value - The value to cast
20
+ * @returns The value as an `Uint8`
21
+ * @throws {TypeError} If the value is not an non-negative integer less than 256
18
22
  */
19
23
  export declare const asUint8: (x: number) => Uint8;
20
24
  /**
21
- * Namespace providing type-safe arithmetic operations for 8-bit unsigned
22
- * integers.
25
+ * Namespace providing type-safe operations for the `Uint8` branded type.
23
26
  *
24
- * All operations automatically clamp results to the valid Uint8 range [0, 255].
25
- * This ensures that all arithmetic maintains the 8-bit unsigned integer
26
- * constraint, with negative results clamped to 0 and overflow results clamped
27
- * to MAX_VALUE.
27
+ * The `Uint8` type represents an non-negative integer less than 256. Division
28
+ * (`div`) uses floor division.
28
29
  */
29
30
  export declare const Uint8: {
30
31
  /**
31
- * Type guard that checks if a value is an 8-bit unsigned integer.
32
+ * Type guard that checks if a value is an non-negative integer less than 256.
32
33
  *
33
- * @param value The value to check.
34
- * @returns `true` if the value is an 8-bit unsigned integer, `false`
35
- * otherwise.
34
+ * @param value - The value to check
35
+ * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise
36
+ * @see {@link isUint8} for usage examples
36
37
  */
37
38
  readonly is: (x: number) => x is Uint8;
38
39
  /**
39
- * The minimum value for an 8-bit unsigned integer.
40
- *
41
- * @readonly
40
+ * The smallest value representable as `Uint8`.
42
41
  */
43
42
  readonly MIN_VALUE: 0;
44
43
  /**
45
- * The maximum value for an 8-bit unsigned integer.
46
- *
47
- * @readonly
44
+ * The largest value representable as `Uint8`.
48
45
  */
49
46
  readonly MAX_VALUE: 255;
50
47
  /**
51
- * Returns the larger of the given Uint8 values.
48
+ * Returns the largest of the given non-negative integers.
52
49
  *
53
- * @param values The Uint8 values to compare.
54
- * @returns The maximum value as a Uint8.
50
+ * @param values - The non-negative integers to compare (at least one required)
51
+ * @returns The largest value as an `Uint8`
55
52
  */
56
53
  readonly max: (...values: readonly Uint8[]) => Uint8;
57
54
  /**
58
- * Returns the smaller of the given Uint8 values.
55
+ * Returns the smallest of the given non-negative integers.
59
56
  *
60
- * @param values The Uint8 values to compare.
61
- * @returns The minimum value as a Uint8.
57
+ * @param values - The non-negative integers to compare (at least one required)
58
+ * @returns The smallest value as an `Uint8`
62
59
  */
63
60
  readonly min: (...values: readonly Uint8[]) => Uint8;
64
61
  /**
65
- * Clamps a number to the Uint8 range.
62
+ * Clamps a `number` into the `Uint8` range, rounding to the nearest integer
63
+ * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
66
64
  *
67
- * @param value The number to clamp.
68
- * @returns The value clamped to [0, 255] as a Uint8.
65
+ * @param value - The value to clamp
66
+ * @returns The clamped value as an `Uint8`
69
67
  */
70
68
  readonly clamp: (a: number) => Uint8;
71
69
  /**
72
- * Generates a random Uint8 value within the specified range.
70
+ * Generates a random `Uint8` within the given range.
71
+ *
72
+ * The range is inclusive on both ends.
73
73
  *
74
- * @param min The minimum value (inclusive).
75
- * @param max The maximum value (inclusive).
76
- * @returns A random Uint8 between min and max.
74
+ * @param min - The minimum value (inclusive)
75
+ * @param max - The maximum value (inclusive)
76
+ * @returns A random `Uint8` in `[min, max]`
77
77
  */
78
78
  readonly random: (min: Uint8, max: Uint8) => Uint8;
79
79
  /**
80
- * Raises x to the power of y, clamped to Uint8 range.
80
+ * Raises `a` to the power `b`, returning `a ** b` as an `Uint8` (floored to
81
+ * an integer).
81
82
  *
82
- * @param x - The base
83
- * @param y - The exponent
84
- * @returns `x ** y` clamped to [0, 255]
83
+ * @param a - The base non-negative integer
84
+ * @param b - The exponent non-negative integer
85
+ * @returns `a ** b` as an `Uint8`
85
86
  */
86
87
  readonly pow: (x: Uint8, y: Uint8) => Uint8;
87
88
  /**
88
- * Adds two Uint8 values, clamped to Uint8 range.
89
+ * Adds two non-negative integers, returning `a + b` as an `Uint8`.
89
90
  *
90
- * @param x - First operand
91
- * @param y - Second operand
92
- * @returns `x + y` clamped to [0, 255]
91
+ * @param a - The first non-negative integer
92
+ * @param b - The second non-negative integer
93
+ * @returns The sum of `a` and `b` as an `Uint8`
93
94
  */
94
95
  readonly add: (x: Uint8, y: Uint8) => Uint8;
95
96
  /**
96
- * Subtracts two Uint8 values, clamped to Uint8 range.
97
+ * Subtracts two non-negative integers, returning `a - b` as an `Uint8`.
97
98
  *
98
- * @param x - First operand
99
- * @param y - Second operand
100
- * @returns `x - y` clamped to [0, 255]
99
+ * @param a - The first non-negative integer
100
+ * @param b - The second non-negative integer
101
+ * @returns The difference of `a` and `b` as an `Uint8`
101
102
  */
102
103
  readonly sub: (x: Uint8, y: Uint8) => Uint8;
103
104
  /**
104
- * Multiplies two Uint8 values, clamped to Uint8 range.
105
+ * Multiplies two non-negative integers, returning `a * b` as an `Uint8`.
105
106
  *
106
- * @param x - First operand
107
- * @param y - Second operand
108
- * @returns `x * y` clamped to [0, 255]
107
+ * @param a - The first non-negative integer
108
+ * @param b - The second non-negative integer
109
+ * @returns The product of `a` and `b` as an `Uint8`
109
110
  */
110
111
  readonly mul: (x: Uint8, y: Uint8) => Uint8;
111
112
  /**
112
- * Divides two Uint8 values, clamped to Uint8 range.
113
+ * Divides two non-negative integers using floor division (`⌊a / b⌋`): the
114
+ * result is `a / b` rounded toward negative infinity, as an `Uint8`.
113
115
  *
114
- * @param x - The dividend
115
- * @param y - The divisor (cannot be 0)
116
- * @returns `⌊x / y⌋` clamped to [0, 255]
116
+ * @param a - The dividend
117
+ * @param b - The divisor (must be non-zero)
118
+ * @returns The floored quotient as an `Uint8`
117
119
  */
118
120
  readonly div: (x: Uint8, y: Exclude<Uint8, 0>) => Uint8;
119
121
  };
@@ -1 +1 @@
1
- {"version":3,"file":"uint8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/uint8.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAe,MAAM,eAAe,CAAC;AAI7E,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AA+CtC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,MAjCL,MAAM,KAAG,CAAC,IAAI,KAiCJ,CAAC;AAE1B;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,MA1CC,MAAM,KAAG,KA0CC,CAAC;AAEhC;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;qBA9DU,MAAM,KAAG,CAAC,IAAI,KAAK;IAiEhC;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;8BAzEoB,SAAS,KAAK,EAAE,KAAG,KAAK;IA4E/C;;;;;OAKG;8BApFoB,SAAS,KAAK,EAAE,KAAG,KAAK;IAuF/C;;;;;OAKG;wBA9Fa,MAAM,KAAG,KAAK;IAiG9B;;;;;;OAMG;2BArFgB,KAAK,OAAO,KAAK,KAAG,KAAK;IAwF5C;;;;;;OAMG;sBAxGW,KAAK,KAAK,KAAK,KAAG,KAAK;IA2GrC;;;;;;OAMG;sBA/GW,KAAK,KAAK,KAAK,KAAG,KAAK;IAkHrC;;;;;;OAMG;sBAtHW,KAAK,KAAK,KAAK,KAAG,KAAK;IAyHrC;;;;;;OAMG;sBA7HW,KAAK,KAAK,KAAK,KAAG,KAAK;IAgIrC;;;;;;OAMG;sBApIW,KAAK,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAG,KAAK;CAsIzC,CAAC"}
1
+ {"version":3,"file":"uint8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/uint8.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAe,MAAM,eAAe,CAAC;AAI7E,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AA+CtC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,MApCL,MAAM,KAAG,CAAC,IAAI,KAoCJ,CAAC;AAE1B;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,MA9CC,MAAM,KAAG,KA8CC,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;qBA/DU,MAAM,KAAG,CAAC,IAAI,KAAK;IAkEhC;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;8BAtEoB,SAAS,KAAK,EAAE,KAAG,KAAK;IAyE/C;;;;;OAKG;8BAjFoB,SAAS,KAAK,EAAE,KAAG,KAAK;IAoF/C;;;;;;OAMG;wBA5Fa,MAAM,KAAG,KAAK;IA+F9B;;;;;;;;OAQG;2BArFgB,KAAK,OAAO,KAAK,KAAG,KAAK;IAwF5C;;;;;;;OAOG;sBAzGW,KAAK,KAAK,KAAK,KAAG,KAAK;IA4GrC;;;;;;OAMG;sBAhHW,KAAK,KAAK,KAAK,KAAG,KAAK;IAmHrC;;;;;;OAMG;sBAvHW,KAAK,KAAK,KAAK,KAAG,KAAK;IA0HrC;;;;;;OAMG;sBA9HW,KAAK,KAAK,KAAK,KAAG,KAAK;IAiIrC;;;;;;;OAOG;sBAtIW,KAAK,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAG,KAAK;CAwIzC,CAAC"}
@@ -34,92 +34,93 @@ const isUint8 = is;
34
34
  const asUint8 = castType;
35
35
  const Uint8 = {
36
36
  /**
37
- * Type guard that checks if a value is an 8-bit unsigned integer.
37
+ * Type guard that checks if a value is an non-negative integer less than 256.
38
38
  *
39
- * @param value The value to check.
40
- * @returns `true` if the value is an 8-bit unsigned integer, `false`
41
- * otherwise.
39
+ * @param value - The value to check
40
+ * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise
41
+ * @see {@link isUint8} for usage examples
42
42
  */
43
43
  is,
44
44
  /**
45
- * The minimum value for an 8-bit unsigned integer.
46
- *
47
- * @readonly
45
+ * The smallest value representable as `Uint8`.
48
46
  */
49
47
  MIN_VALUE,
50
48
  /**
51
- * The maximum value for an 8-bit unsigned integer.
52
- *
53
- * @readonly
49
+ * The largest value representable as `Uint8`.
54
50
  */
55
51
  MAX_VALUE,
56
52
  /**
57
- * Returns the larger of the given Uint8 values.
53
+ * Returns the largest of the given non-negative integers.
58
54
  *
59
- * @param values The Uint8 values to compare.
60
- * @returns The maximum value as a Uint8.
55
+ * @param values - The non-negative integers to compare (at least one required)
56
+ * @returns The largest value as an `Uint8`
61
57
  */
62
58
  max: max_,
63
59
  /**
64
- * Returns the smaller of the given Uint8 values.
60
+ * Returns the smallest of the given non-negative integers.
65
61
  *
66
- * @param values The Uint8 values to compare.
67
- * @returns The minimum value as a Uint8.
62
+ * @param values - The non-negative integers to compare (at least one required)
63
+ * @returns The smallest value as an `Uint8`
68
64
  */
69
65
  min: min_,
70
66
  /**
71
- * Clamps a number to the Uint8 range.
67
+ * Clamps a `number` into the `Uint8` range, rounding to the nearest integer
68
+ * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
72
69
  *
73
- * @param value The number to clamp.
74
- * @returns The value clamped to [0, 255] as a Uint8.
70
+ * @param value - The value to clamp
71
+ * @returns The clamped value as an `Uint8`
75
72
  */
76
73
  clamp,
77
74
  /**
78
- * Generates a random Uint8 value within the specified range.
75
+ * Generates a random `Uint8` within the given range.
76
+ *
77
+ * The range is inclusive on both ends.
79
78
  *
80
- * @param min The minimum value (inclusive).
81
- * @param max The maximum value (inclusive).
82
- * @returns A random Uint8 between min and max.
79
+ * @param min - The minimum value (inclusive)
80
+ * @param max - The maximum value (inclusive)
81
+ * @returns A random `Uint8` in `[min, max]`
83
82
  */
84
83
  random,
85
84
  /**
86
- * Raises x to the power of y, clamped to Uint8 range.
85
+ * Raises `a` to the power `b`, returning `a ** b` as an `Uint8` (floored to
86
+ * an integer).
87
87
  *
88
- * @param x - The base
89
- * @param y - The exponent
90
- * @returns `x ** y` clamped to [0, 255]
88
+ * @param a - The base non-negative integer
89
+ * @param b - The exponent non-negative integer
90
+ * @returns `a ** b` as an `Uint8`
91
91
  */
92
92
  pow,
93
93
  /**
94
- * Adds two Uint8 values, clamped to Uint8 range.
94
+ * Adds two non-negative integers, returning `a + b` as an `Uint8`.
95
95
  *
96
- * @param x - First operand
97
- * @param y - Second operand
98
- * @returns `x + y` clamped to [0, 255]
96
+ * @param a - The first non-negative integer
97
+ * @param b - The second non-negative integer
98
+ * @returns The sum of `a` and `b` as an `Uint8`
99
99
  */
100
100
  add,
101
101
  /**
102
- * Subtracts two Uint8 values, clamped to Uint8 range.
102
+ * Subtracts two non-negative integers, returning `a - b` as an `Uint8`.
103
103
  *
104
- * @param x - First operand
105
- * @param y - Second operand
106
- * @returns `x - y` clamped to [0, 255]
104
+ * @param a - The first non-negative integer
105
+ * @param b - The second non-negative integer
106
+ * @returns The difference of `a` and `b` as an `Uint8`
107
107
  */
108
108
  sub,
109
109
  /**
110
- * Multiplies two Uint8 values, clamped to Uint8 range.
110
+ * Multiplies two non-negative integers, returning `a * b` as an `Uint8`.
111
111
  *
112
- * @param x - First operand
113
- * @param y - Second operand
114
- * @returns `x * y` clamped to [0, 255]
112
+ * @param a - The first non-negative integer
113
+ * @param b - The second non-negative integer
114
+ * @returns The product of `a` and `b` as an `Uint8`
115
115
  */
116
116
  mul,
117
117
  /**
118
- * Divides two Uint8 values, clamped to Uint8 range.
118
+ * Divides two non-negative integers using floor division (`⌊a / b⌋`): the
119
+ * result is `a / b` rounded toward negative infinity, as an `Uint8`.
119
120
  *
120
- * @param x - The dividend
121
- * @param y - The divisor (cannot be 0)
122
- * @returns `⌊x / y⌋` clamped to [0, 255]
121
+ * @param a - The dividend
122
+ * @param b - The divisor (must be non-zero)
123
+ * @returns The floored quotient as an `Uint8`
123
124
  */
124
125
  div
125
126
  };
@@ -1 +1 @@
1
- {"version":3,"file":"uint8.mjs","sources":["../../../src/number/enum/uint8.mts"],"sourcesContent":["import { type Uint8 as TtfImported_Uint8, type Uint16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint8 = TtfImported_Uint8;\n\nconst typeNameInMessage = 'an non-negative integer less than 256';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n clamp: clampImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<Uint16, 0, 255>(\n {\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 255,\n typeNameInMessage,\n } as const,\n);\n\nconst is = (x: number): x is Uint8 => isImpl(x);\n\nconst castType = (x: number): Uint8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Uint8;\n\nconst clamp = (a: number): Uint8 => castType(clampImpl(a));\n\nconst min_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Uint8, y: Uint8): Uint8 => clamp(x ** y);\n\nconst add = (x: Uint8, y: Uint8): Uint8 => clamp(x + y);\n\nconst sub = (x: Uint8, y: Uint8): Uint8 => clamp(x - y);\n\nconst mul = (x: Uint8, y: Uint8): Uint8 => clamp(x * y);\n\nconst div = (x: Uint8, y: Exclude<Uint8, 0>): Uint8 => clamp(Math.floor(x / y));\n\nconst random = (min: Uint8, max: Uint8): Uint8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Checks if a number is a Uint8 (8-bit unsigned integer in the range [0, 255]).\n *\n * @param value The value to check.\n * @returns `true` if the value is a Uint8, `false` otherwise.\n */\nexport const isUint8 = is;\n\n/**\n * Casts a number to a Uint8 type. This function validates that the input is\n * within the Uint8 range [0, 255] and is an integer, then returns it with the\n * Uint8 brand.\n *\n * @param value The value to cast.\n * @returns The value as a Uint8 type.\n * @throws {TypeError} If the value is not a valid 8-bit unsigned integer.\n */\nexport const asUint8 = castType;\n\n/**\n * Namespace providing type-safe arithmetic operations for 8-bit unsigned\n * integers.\n *\n * All operations automatically clamp results to the valid Uint8 range [0, 255].\n * This ensures that all arithmetic maintains the 8-bit unsigned integer\n * constraint, with negative results clamped to 0 and overflow results clamped\n * to MAX_VALUE.\n */\nexport const Uint8 = {\n /**\n * Type guard that checks if a value is an 8-bit unsigned integer.\n *\n * @param value The value to check.\n * @returns `true` if the value is an 8-bit unsigned integer, `false`\n * otherwise.\n */\n is,\n\n /**\n * The minimum value for an 8-bit unsigned integer.\n *\n * @readonly\n */\n MIN_VALUE,\n\n /**\n * The maximum value for an 8-bit unsigned integer.\n *\n * @readonly\n */\n MAX_VALUE,\n\n /**\n * Returns the larger of the given Uint8 values.\n *\n * @param values The Uint8 values to compare.\n * @returns The maximum value as a Uint8.\n */\n max: max_,\n\n /**\n * Returns the smaller of the given Uint8 values.\n *\n * @param values The Uint8 values to compare.\n * @returns The minimum value as a Uint8.\n */\n min: min_,\n\n /**\n * Clamps a number to the Uint8 range.\n *\n * @param value The number to clamp.\n * @returns The value clamped to [0, 255] as a Uint8.\n */\n clamp,\n\n /**\n * Generates a random Uint8 value within the specified range.\n *\n * @param min The minimum value (inclusive).\n * @param max The maximum value (inclusive).\n * @returns A random Uint8 between min and max.\n */\n random,\n\n /**\n * Raises x to the power of y, clamped to Uint8 range.\n *\n * @param x - The base\n * @param y - The exponent\n * @returns `x ** y` clamped to [0, 255]\n */\n pow,\n\n /**\n * Adds two Uint8 values, clamped to Uint8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x + y` clamped to [0, 255]\n */\n add,\n\n /**\n * Subtracts two Uint8 values, clamped to Uint8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x - y` clamped to [0, 255]\n */\n sub,\n\n /**\n * Multiplies two Uint8 values, clamped to Uint8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x * y` clamped to [0, 255]\n */\n mul,\n\n /**\n * Divides two Uint8 values, clamped to Uint8 range.\n *\n * @param x - The dividend\n * @param y - The divisor (cannot be 0)\n * @returns `⌊x / y⌋` clamped to [0, 255]\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Uint16,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAMA,MAAM,iBAAA,GAAoB,uCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,qBAAqB,kBAAA,CAAmB,mBAAA;AAAA,EAC1C;AAAA,IACE,oBAAA,EAAsB,aAAA;AAAA,IACtB,SAAA,EAAW,CAAA;AAAA,IACX,SAAA,EAAW,GAAA;AAAA,IACX;AAAA;AAEJ,CAAA;AAEA,MAAM,EAAA,GAAK,CAAC,CAAA,KAA0B,MAAA,CAAO,CAAC,CAAA;AAE9C,MAAM,WAAW,CAAC,CAAA;AAAA;AAAA,EAEhB,aAAa,CAAC;AAAA,CAAA;AAEhB,MAAM,QAAQ,CAAC,CAAA,KAAqB,QAAA,CAAS,SAAA,CAAU,CAAC,CAAC,CAAA;AAEzD,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,KAAK,CAAC,CAAA;AAEvD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,GAAA,GAAM,CAAC,CAAA,EAAU,CAAA,KAAgC,MAAM,IAAA,CAAK,KAAA,CAAM,CAAA,GAAI,CAAC,CAAC,CAAA;AAE9E,MAAM,MAAA,GAAS,CAAC,GAAA,EAAY,GAAA,KAC1B,QAAA,CAAS,UAAA,CAAW,YAAA,CAAa,GAAG,CAAA,EAAG,YAAA,CAAa,GAAG,CAAC,CAAC,CAAA;AAQpD,MAAM,OAAA,GAAU;AAWhB,MAAM,OAAA,GAAU;AAWhB,MAAM,KAAA,GAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA;AACF;;;;"}
1
+ {"version":3,"file":"uint8.mjs","sources":["../../../src/number/enum/uint8.mts"],"sourcesContent":["import { type Uint8 as TtfImported_Uint8, type Uint16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint8 = TtfImported_Uint8;\n\nconst typeNameInMessage = 'an non-negative integer less than 256';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n clamp: clampImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<Uint16, 0, 255>(\n {\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 255,\n typeNameInMessage,\n } as const,\n);\n\nconst is = (x: number): x is Uint8 => isImpl(x);\n\nconst castType = (x: number): Uint8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Uint8;\n\nconst clamp = (a: number): Uint8 => castType(clampImpl(a));\n\nconst min_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Uint8, y: Uint8): Uint8 => clamp(x ** y);\n\nconst add = (x: Uint8, y: Uint8): Uint8 => clamp(x + y);\n\nconst sub = (x: Uint8, y: Uint8): Uint8 => clamp(x - y);\n\nconst mul = (x: Uint8, y: Uint8): Uint8 => clamp(x * y);\n\nconst div = (x: Uint8, y: Exclude<Uint8, 0>): Uint8 => clamp(Math.floor(x / y));\n\nconst random = (min: Uint8, max: Uint8): Uint8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Type guard that checks if a value is an non-negative integer less than 256.\n *\n * Returns `true` for an non-negative integer less than 256 — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise\n */\nexport const isUint8 = is;\n\n/**\n * Casts a `number` to the `Uint8` branded type.\n *\n * Validates that the value is an non-negative integer less than 256 and returns\n * it with the `Uint8` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Uint8`\n * @throws {TypeError} If the value is not an non-negative integer less than 256\n */\nexport const asUint8 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint8` branded type.\n *\n * The `Uint8` type represents an non-negative integer less than 256. Division\n * (`div`) uses floor division.\n */\nexport const Uint8 = {\n /**\n * Type guard that checks if a value is an non-negative integer less than 256.\n *\n * @param value - The value to check\n * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise\n * @see {@link isUint8} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint8`.\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Uint8`.\n */\n MAX_VALUE,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint8`\n */\n max: max_,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint8`\n */\n min: min_,\n\n /**\n * Clamps a `number` into the `Uint8` range, rounding to the nearest integer\n * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as an `Uint8`\n */\n clamp,\n\n /**\n * Generates a random `Uint8` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `Uint8` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint8` (floored to\n * an integer).\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint8`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The sum of `a` and `b` as an `Uint8`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The difference of `a` and `b` as an `Uint8`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The product of `a` and `b` as an `Uint8`\n */\n mul,\n\n /**\n * Divides two non-negative integers using floor division (`⌊a / b⌋`): the\n * result is `a / b` rounded toward negative infinity, as an `Uint8`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint8`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Uint16,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAMA,MAAM,iBAAA,GAAoB,uCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,qBAAqB,kBAAA,CAAmB,mBAAA;AAAA,EAC1C;AAAA,IACE,oBAAA,EAAsB,aAAA;AAAA,IACtB,SAAA,EAAW,CAAA;AAAA,IACX,SAAA,EAAW,GAAA;AAAA,IACX;AAAA;AAEJ,CAAA;AAEA,MAAM,EAAA,GAAK,CAAC,CAAA,KAA0B,MAAA,CAAO,CAAC,CAAA;AAE9C,MAAM,WAAW,CAAC,CAAA;AAAA;AAAA,EAEhB,aAAa,CAAC;AAAA,CAAA;AAEhB,MAAM,QAAQ,CAAC,CAAA,KAAqB,QAAA,CAAS,SAAA,CAAU,CAAC,CAAC,CAAA;AAEzD,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,KAAK,CAAC,CAAA;AAEvD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,GAAA,GAAM,CAAC,CAAA,EAAU,CAAA,KAAgC,MAAM,IAAA,CAAK,KAAA,CAAM,CAAA,GAAI,CAAC,CAAC,CAAA;AAE9E,MAAM,MAAA,GAAS,CAAC,GAAA,EAAY,GAAA,KAC1B,QAAA,CAAS,UAAA,CAAW,YAAA,CAAa,GAAG,CAAA,EAAG,YAAA,CAAa,GAAG,CAAC,CAAC,CAAA;AAWpD,MAAM,OAAA,GAAU;AAYhB,MAAM,OAAA,GAAU;AAQhB,MAAM,KAAA,GAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
@@ -0,0 +1,2 @@
1
+ export * from './str.mjs';
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/string/index.mts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Str } from './str.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}