ts-data-forge 11.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 (171) hide show
  1. package/dist/number/branded-types/finite-number.d.mts +47 -61
  2. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  3. package/dist/number/branded-types/finite-number.mjs +37 -41
  4. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  5. package/dist/number/branded-types/int.d.mts +40 -46
  6. package/dist/number/branded-types/int.d.mts.map +1 -1
  7. package/dist/number/branded-types/int.mjs +29 -31
  8. package/dist/number/branded-types/int.mjs.map +1 -1
  9. package/dist/number/branded-types/int16.d.mts +65 -58
  10. package/dist/number/branded-types/int16.d.mts.map +1 -1
  11. package/dist/number/branded-types/int16.mjs +49 -45
  12. package/dist/number/branded-types/int16.mjs.map +1 -1
  13. package/dist/number/branded-types/int32.d.mts +65 -58
  14. package/dist/number/branded-types/int32.d.mts.map +1 -1
  15. package/dist/number/branded-types/int32.mjs +49 -45
  16. package/dist/number/branded-types/int32.mjs.map +1 -1
  17. package/dist/number/branded-types/negative-finite-number.d.mts +68 -59
  18. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  19. package/dist/number/branded-types/negative-finite-number.mjs +52 -46
  20. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  21. package/dist/number/branded-types/negative-int.d.mts +60 -48
  22. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  23. package/dist/number/branded-types/negative-int.mjs +40 -36
  24. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  25. package/dist/number/branded-types/negative-safe-int.d.mts +57 -56
  26. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  27. package/dist/number/branded-types/negative-safe-int.mjs +40 -41
  28. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  29. package/dist/number/branded-types/non-negative-finite-number.d.mts +74 -64
  30. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  31. package/dist/number/branded-types/non-negative-finite-number.mjs +58 -51
  32. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  33. package/dist/number/branded-types/non-negative-int16.d.mts +64 -57
  34. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  35. package/dist/number/branded-types/non-negative-int16.mjs +47 -43
  36. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  37. package/dist/number/branded-types/non-negative-int32.d.mts +64 -58
  38. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  39. package/dist/number/branded-types/non-negative-int32.mjs +47 -44
  40. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  41. package/dist/number/branded-types/non-positive-finite-number.d.mts +64 -54
  42. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  43. package/dist/number/branded-types/non-positive-finite-number.mjs +48 -41
  44. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  45. package/dist/number/branded-types/non-positive-int.d.mts +41 -146
  46. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  47. package/dist/number/branded-types/non-positive-int.mjs +27 -107
  48. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  49. package/dist/number/branded-types/non-positive-safe-int.d.mts +54 -53
  50. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  51. package/dist/number/branded-types/non-positive-safe-int.mjs +37 -39
  52. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  53. package/dist/number/branded-types/non-zero-finite-number.d.mts +62 -49
  54. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  55. package/dist/number/branded-types/non-zero-finite-number.mjs +46 -37
  56. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  57. package/dist/number/branded-types/non-zero-int.d.mts +51 -38
  58. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  59. package/dist/number/branded-types/non-zero-int.mjs +31 -27
  60. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  61. package/dist/number/branded-types/non-zero-int16.d.mts +52 -53
  62. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  63. package/dist/number/branded-types/non-zero-int16.mjs +36 -39
  64. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  65. package/dist/number/branded-types/non-zero-int32.d.mts +52 -54
  66. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  67. package/dist/number/branded-types/non-zero-int32.mjs +36 -40
  68. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  69. package/dist/number/branded-types/non-zero-safe-int.d.mts +53 -54
  70. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  71. package/dist/number/branded-types/non-zero-safe-int.mjs +36 -40
  72. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  73. package/dist/number/branded-types/non-zero-uint16.d.mts +52 -53
  74. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  75. package/dist/number/branded-types/non-zero-uint16.mjs +35 -39
  76. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  77. package/dist/number/branded-types/non-zero-uint32.d.mts +52 -53
  78. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  79. package/dist/number/branded-types/non-zero-uint32.mjs +35 -39
  80. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  81. package/dist/number/branded-types/positive-finite-number.d.mts +74 -63
  82. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  83. package/dist/number/branded-types/positive-finite-number.mjs +58 -50
  84. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  85. package/dist/number/branded-types/positive-int.d.mts +46 -68
  86. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  87. package/dist/number/branded-types/positive-int.mjs +34 -49
  88. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  89. package/dist/number/branded-types/positive-int16.d.mts +61 -57
  90. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  91. package/dist/number/branded-types/positive-int16.mjs +44 -43
  92. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  93. package/dist/number/branded-types/positive-int32.d.mts +61 -57
  94. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  95. package/dist/number/branded-types/positive-int32.mjs +44 -43
  96. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  97. package/dist/number/branded-types/positive-safe-int.d.mts +62 -57
  98. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  99. package/dist/number/branded-types/positive-safe-int.mjs +45 -43
  100. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  101. package/dist/number/branded-types/positive-uint16.d.mts +61 -57
  102. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  103. package/dist/number/branded-types/positive-uint16.mjs +44 -43
  104. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  105. package/dist/number/branded-types/positive-uint32.d.mts +61 -58
  106. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  107. package/dist/number/branded-types/positive-uint32.mjs +44 -44
  108. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  109. package/dist/number/branded-types/safe-int.d.mts +43 -62
  110. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  111. package/dist/number/branded-types/safe-int.mjs +35 -42
  112. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  113. package/dist/number/branded-types/safe-uint.d.mts +62 -57
  114. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  115. package/dist/number/branded-types/safe-uint.mjs +46 -44
  116. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  117. package/dist/number/branded-types/uint.d.mts +63 -50
  118. package/dist/number/branded-types/uint.d.mts.map +1 -1
  119. package/dist/number/branded-types/uint.mjs +42 -39
  120. package/dist/number/branded-types/uint.mjs.map +1 -1
  121. package/dist/number/branded-types/uint16.d.mts +60 -58
  122. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  123. package/dist/number/branded-types/uint16.mjs +44 -43
  124. package/dist/number/branded-types/uint16.mjs.map +1 -1
  125. package/dist/number/branded-types/uint32.d.mts +59 -55
  126. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  127. package/dist/number/branded-types/uint32.mjs +42 -42
  128. package/dist/number/branded-types/uint32.mjs.map +1 -1
  129. package/dist/number/enum/int8.d.mts +56 -65
  130. package/dist/number/enum/int8.d.mts.map +1 -1
  131. package/dist/number/enum/int8.mjs +44 -43
  132. package/dist/number/enum/int8.mjs.map +1 -1
  133. package/dist/number/enum/uint8.d.mts +60 -58
  134. package/dist/number/enum/uint8.d.mts.map +1 -1
  135. package/dist/number/enum/uint8.mjs +44 -43
  136. package/dist/number/enum/uint8.mjs.map +1 -1
  137. package/package.json +2 -1
  138. package/src/number/branded-types/finite-number.mts +47 -61
  139. package/src/number/branded-types/int.mts +40 -46
  140. package/src/number/branded-types/int16.mts +65 -58
  141. package/src/number/branded-types/int32.mts +65 -58
  142. package/src/number/branded-types/negative-finite-number.mts +68 -68
  143. package/src/number/branded-types/negative-int.mts +60 -57
  144. package/src/number/branded-types/negative-safe-int.mts +57 -65
  145. package/src/number/branded-types/non-negative-finite-number.mts +74 -64
  146. package/src/number/branded-types/non-negative-int16.mts +64 -57
  147. package/src/number/branded-types/non-negative-int32.mts +64 -58
  148. package/src/number/branded-types/non-positive-finite-number.mts +64 -54
  149. package/src/number/branded-types/non-positive-int.mts +41 -146
  150. package/src/number/branded-types/non-positive-safe-int.mts +54 -53
  151. package/src/number/branded-types/non-zero-finite-number.mts +62 -51
  152. package/src/number/branded-types/non-zero-int.mts +51 -38
  153. package/src/number/branded-types/non-zero-int16.mts +52 -53
  154. package/src/number/branded-types/non-zero-int32.mts +52 -54
  155. package/src/number/branded-types/non-zero-safe-int.mts +53 -54
  156. package/src/number/branded-types/non-zero-uint16.mts +52 -53
  157. package/src/number/branded-types/non-zero-uint32.mts +52 -53
  158. package/src/number/branded-types/positive-finite-number.mts +74 -63
  159. package/src/number/branded-types/positive-int.mts +46 -68
  160. package/src/number/branded-types/positive-int16.mts +61 -57
  161. package/src/number/branded-types/positive-int32.mts +61 -57
  162. package/src/number/branded-types/positive-safe-int.mts +62 -57
  163. package/src/number/branded-types/positive-uint16.mts +61 -57
  164. package/src/number/branded-types/positive-uint32.mts +61 -58
  165. package/src/number/branded-types/safe-int.mts +43 -62
  166. package/src/number/branded-types/safe-uint.mts +62 -57
  167. package/src/number/branded-types/uint.mts +63 -50
  168. package/src/number/branded-types/uint16.mts +60 -58
  169. package/src/number/branded-types/uint32.mts +59 -55
  170. package/src/number/enum/int8.mts +56 -65
  171. package/src/number/enum/uint8.mts +60 -58
@@ -1,7 +1,11 @@
1
1
  import { type Uint as TtfImported_Uint } from 'ts-type-forge';
2
2
  export type Uint = TtfImported_Uint;
3
3
  /**
4
- * Checks if a number is a Uint.
4
+ * Type guard that checks if a value is a non-negative integer.
5
+ *
6
+ * Returns `true` for a non-negative integer — a value with no fractional
7
+ * component, including values outside the safe integer range (unlike
8
+ * `SafeInt`).
5
9
  *
6
10
  * @example
7
11
  *
@@ -13,12 +17,15 @@ export type Uint = TtfImported_Uint;
13
17
  * assert.isTrue(Uint.is(0));
14
18
  * ```
15
19
  *
16
- * @param value The value to check.
17
- * @returns `true` if the value is a Uint, `false` otherwise.
20
+ * @param value - The value to check
21
+ * @returns `true` if the value is a non-negative integer, `false` otherwise
18
22
  */
19
23
  export declare const isUint: (a: number) => a is import("ts-type-forge").NonNegativeInt;
20
24
  /**
21
- * Casts a number to a Uint type.
25
+ * Casts a `number` to the `Uint` branded type.
26
+ *
27
+ * Validates that the value is a non-negative integer and returns it with the
28
+ * `Uint` brand. Throws a `TypeError` otherwise.
22
29
  *
23
30
  * @example
24
31
  *
@@ -30,9 +37,9 @@ export declare const isUint: (a: number) => a is import("ts-type-forge").NonNega
30
37
  * assert.isTrue(Uint.is(branded));
31
38
  * ```
32
39
  *
33
- * @param value The value to cast.
34
- * @returns The value as a Uint type.
35
- * @throws {TypeError} If the value is not a non-negative integer.
40
+ * @param value - The value to cast
41
+ * @returns The value as an `Uint`
42
+ * @throws {TypeError} If the value is not a non-negative integer
36
43
  */
37
44
  export declare const asUint: <N extends number>(x: N) => number & {
38
45
  readonly "> -2^16": true;
@@ -47,15 +54,18 @@ export declare const asUint: <N extends number>(x: N) => number & {
47
54
  'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
48
55
  }> & N;
49
56
  /**
50
- * Namespace providing type-safe arithmetic operations for unsigned integers.
57
+ * Namespace providing type-safe operations for the `Uint` branded type.
58
+ *
59
+ * The `Uint` type represents a non-negative integer. Division (`div`) uses
60
+ * floor division.
51
61
  *
52
- * All operations maintain the non-negative constraint by clamping negative
53
- * results to 0. This ensures that all arithmetic preserves the unsigned integer
54
- * property.
62
+ * Unlike `SafeInt`, `Uint` allows values outside the safe integer range (±2^53
63
+ * − 1), so very large magnitudes may lose precision in JavaScript's `number`
64
+ * type.
55
65
  */
56
66
  export declare const Uint: {
57
67
  /**
58
- * Type guard to check if a value is a Uint.
68
+ * Type guard that checks if a value is a non-negative integer.
59
69
  *
60
70
  * @example
61
71
  *
@@ -67,19 +77,17 @@ export declare const Uint: {
67
77
  * assert.isTrue(Uint.is(0));
68
78
  * ```
69
79
  *
70
- * @param value The value to check.
71
- * @returns `true` if the value is a non-negative integer, `false` otherwise.
80
+ * @param value - The value to check
81
+ * @returns `true` if the value is a non-negative integer, `false` otherwise
72
82
  * @see {@link isUint} for usage examples
73
83
  */
74
84
  readonly is: (a: number) => a is import("ts-type-forge").NonNegativeInt;
75
85
  /**
76
- * The minimum value for an unsigned integer.
77
- *
78
- * @readonly
86
+ * The smallest value representable as `Uint`.
79
87
  */
80
88
  readonly MIN_VALUE: 0;
81
89
  /**
82
- * Returns the smaller of two Uint values.
90
+ * Returns the smallest of the given non-negative integers.
83
91
  *
84
92
  * @example
85
93
  *
@@ -89,13 +97,12 @@ export declare const Uint: {
89
97
  * assert.isTrue(smallest === 3);
90
98
  * ```
91
99
  *
92
- * @param a The first Uint.
93
- * @param b The second Uint.
94
- * @returns The minimum value as a Uint.
100
+ * @param values - The non-negative integers to compare (at least one required)
101
+ * @returns The smallest value as an `Uint`
95
102
  */
96
103
  readonly min: (...values: readonly import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>[]) => import("ts-type-forge").NonNegativeInt;
97
104
  /**
98
- * Returns the larger of two Uint values.
105
+ * Returns the largest of the given non-negative integers.
99
106
  *
100
107
  * @example
101
108
  *
@@ -105,13 +112,13 @@ export declare const Uint: {
105
112
  * assert.isTrue(largest === 7);
106
113
  * ```
107
114
  *
108
- * @param a The first Uint.
109
- * @param b The second Uint.
110
- * @returns The maximum value as a Uint.
115
+ * @param values - The non-negative integers to compare (at least one required)
116
+ * @returns The largest value as an `Uint`
111
117
  */
112
118
  readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>[]) => import("ts-type-forge").NonNegativeInt;
113
119
  /**
114
- * Clamps a number to the Uint range (non-negative).
120
+ * Clamps a `number` into the `Uint` range, rounding to the nearest integer
121
+ * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
115
122
  *
116
123
  * @example
117
124
  *
@@ -125,12 +132,14 @@ export declare const Uint: {
125
132
  * assert.isTrue(clampedPositive === 42);
126
133
  * ```
127
134
  *
128
- * @param value The number to clamp.
129
- * @returns The value clamped to [0, +∞) as a Uint.
135
+ * @param value - The value to clamp
136
+ * @returns The clamped value as an `Uint`
130
137
  */
131
138
  readonly clamp: (x: number) => import("ts-type-forge").NonNegativeInt;
132
139
  /**
133
- * Generates a random Uint value.
140
+ * Generates a random `Uint` within the given range.
141
+ *
142
+ * The range is inclusive on both ends.
134
143
  *
135
144
  * @example
136
145
  *
@@ -146,11 +155,14 @@ export declare const Uint: {
146
155
  * assert.isTrue(randomValue >= 0 && randomValue <= 3);
147
156
  * ```
148
157
  *
149
- * @returns A random non-negative integer as a Uint.
158
+ * @param min - The minimum value (inclusive)
159
+ * @param max - The maximum value (inclusive)
160
+ * @returns A random `Uint` in `[min, max]`
150
161
  */
151
162
  readonly random: (min?: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt> | undefined, max?: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt> | undefined) => import("ts-type-forge").NonNegativeInt;
152
163
  /**
153
- * Raises a Uint to the power of another Uint.
164
+ * Raises `a` to the power `b`, returning `a ** b` as an `Uint` (floored to an
165
+ * integer).
154
166
  *
155
167
  * @example
156
168
  *
@@ -164,13 +176,13 @@ export declare const Uint: {
164
176
  * assert.isTrue(power === 32);
165
177
  * ```
166
178
  *
167
- * @param a The base Uint.
168
- * @param b The exponent Uint.
169
- * @returns `a ** b` clamped to [0, +∞) as a Uint.
179
+ * @param a - The base non-negative integer
180
+ * @param b - The exponent non-negative integer
181
+ * @returns `a ** b` as an `Uint`
170
182
  */
171
183
  readonly pow: (x: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>, y: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>) => import("ts-type-forge").NonNegativeInt;
172
184
  /**
173
- * Adds two Uint values.
185
+ * Adds two non-negative integers, returning `a + b` as an `Uint`.
174
186
  *
175
187
  * @example
176
188
  *
@@ -180,13 +192,13 @@ export declare const Uint: {
180
192
  * assert.isTrue(sum === 13);
181
193
  * ```
182
194
  *
183
- * @param a The first Uint.
184
- * @param b The second Uint.
185
- * @returns `a + b` clamped to [0, +∞) as a Uint.
195
+ * @param a - The first non-negative integer
196
+ * @param b - The second non-negative integer
197
+ * @returns The sum of `a` and `b` as an `Uint`
186
198
  */
187
199
  readonly add: (x: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>, y: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>) => import("ts-type-forge").NonNegativeInt;
188
200
  /**
189
- * Subtracts one Uint from another.
201
+ * Subtracts two non-negative integers, returning `a - b` as an `Uint`.
190
202
  *
191
203
  * @example
192
204
  *
@@ -196,13 +208,13 @@ export declare const Uint: {
196
208
  * assert.isTrue(difference === 0);
197
209
  * ```
198
210
  *
199
- * @param a The minuend Uint.
200
- * @param b The subtrahend Uint.
201
- * @returns `a - b` clamped to [0, +∞) as a Uint (minimum 0).
211
+ * @param a - The first non-negative integer
212
+ * @param b - The second non-negative integer
213
+ * @returns The difference of `a` and `b` as an `Uint`
202
214
  */
203
215
  readonly sub: (x: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>, y: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>) => import("ts-type-forge").NonNegativeInt;
204
216
  /**
205
- * Multiplies two Uint values.
217
+ * Multiplies two non-negative integers, returning `a * b` as an `Uint`.
206
218
  *
207
219
  * @example
208
220
  *
@@ -212,13 +224,14 @@ export declare const Uint: {
212
224
  * assert.isTrue(product === 42);
213
225
  * ```
214
226
  *
215
- * @param a The first Uint.
216
- * @param b The second Uint.
217
- * @returns `a * b` clamped to [0, +∞) as a Uint.
227
+ * @param a - The first non-negative integer
228
+ * @param b - The second non-negative integer
229
+ * @returns The product of `a` and `b` as an `Uint`
218
230
  */
219
231
  readonly mul: (x: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>, y: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>) => import("ts-type-forge").NonNegativeInt;
220
232
  /**
221
- * Divides one Uint by another using floor division.
233
+ * Divides two non-negative integers using floor division (`⌊a / b⌋`): the
234
+ * result is `a / b` rounded toward negative infinity, as an `Uint`.
222
235
  *
223
236
  * @example
224
237
  *
@@ -228,9 +241,9 @@ export declare const Uint: {
228
241
  * assert.isTrue(quotient === 2);
229
242
  * ```
230
243
  *
231
- * @param a The dividend Uint.
232
- * @param b The divisor Uint.
233
- * @returns `⌊a / b⌋` clamped to [0, +∞) as a Uint.
244
+ * @param a - The dividend
245
+ * @param b - The divisor (must be non-zero)
246
+ * @returns The floored quotient as an `Uint`
234
247
  */
235
248
  readonly div: (x: import("ts-type-forge").WithSmallInt<import("ts-type-forge").NonNegativeInt>, y: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | import("ts-type-forge").NormalizeBrandUnion<number & {
236
249
  readonly "!=0": true;
@@ -1 +1 @@
1
- {"version":3,"file":"uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAI9D,MAAM,MAAM,IAAI,GAAG,gBAAgB,CAAC;AA8BpC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,4DAAK,CAAC;AAEzB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;MAAW,CAAC;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;OAIG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAI9D,MAAM,MAAM,IAAI,GAAG,gBAAgB,CAAC;AA8BpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,4DAAK,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;MAAW,CAAC;AAE/B;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;;;;;;;;;;;OAgBG;;IAGH;;OAEG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;OAeG;;;;;;;;;;;;;;CAEK,CAAC"}
@@ -24,7 +24,7 @@ const isUint = is;
24
24
  const asUint = castType;
25
25
  const Uint = {
26
26
  /**
27
- * Type guard to check if a value is a Uint.
27
+ * Type guard that checks if a value is a non-negative integer.
28
28
  *
29
29
  * @example
30
30
  *
@@ -36,19 +36,17 @@ const Uint = {
36
36
  * assert.isTrue(Uint.is(0));
37
37
  * ```
38
38
  *
39
- * @param value The value to check.
40
- * @returns `true` if the value is a non-negative integer, `false` otherwise.
39
+ * @param value - The value to check
40
+ * @returns `true` if the value is a non-negative integer, `false` otherwise
41
41
  * @see {@link isUint} for usage examples
42
42
  */
43
43
  is,
44
44
  /**
45
- * The minimum value for an unsigned integer.
46
- *
47
- * @readonly
45
+ * The smallest value representable as `Uint`.
48
46
  */
49
47
  MIN_VALUE,
50
48
  /**
51
- * Returns the smaller of two Uint values.
49
+ * Returns the smallest of the given non-negative integers.
52
50
  *
53
51
  * @example
54
52
  *
@@ -58,13 +56,12 @@ const Uint = {
58
56
  * assert.isTrue(smallest === 3);
59
57
  * ```
60
58
  *
61
- * @param a The first Uint.
62
- * @param b The second Uint.
63
- * @returns The minimum value as a Uint.
59
+ * @param values - The non-negative integers to compare (at least one required)
60
+ * @returns The smallest value as an `Uint`
64
61
  */
65
62
  min: min_,
66
63
  /**
67
- * Returns the larger of two Uint values.
64
+ * Returns the largest of the given non-negative integers.
68
65
  *
69
66
  * @example
70
67
  *
@@ -74,13 +71,13 @@ const Uint = {
74
71
  * assert.isTrue(largest === 7);
75
72
  * ```
76
73
  *
77
- * @param a The first Uint.
78
- * @param b The second Uint.
79
- * @returns The maximum value as a Uint.
74
+ * @param values - The non-negative integers to compare (at least one required)
75
+ * @returns The largest value as an `Uint`
80
76
  */
81
77
  max: max_,
82
78
  /**
83
- * Clamps a number to the Uint range (non-negative).
79
+ * Clamps a `number` into the `Uint` range, rounding to the nearest integer
80
+ * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
84
81
  *
85
82
  * @example
86
83
  *
@@ -94,12 +91,14 @@ const Uint = {
94
91
  * assert.isTrue(clampedPositive === 42);
95
92
  * ```
96
93
  *
97
- * @param value The number to clamp.
98
- * @returns The value clamped to [0, +∞) as a Uint.
94
+ * @param value - The value to clamp
95
+ * @returns The clamped value as an `Uint`
99
96
  */
100
97
  clamp,
101
98
  /**
102
- * Generates a random Uint value.
99
+ * Generates a random `Uint` within the given range.
100
+ *
101
+ * The range is inclusive on both ends.
103
102
  *
104
103
  * @example
105
104
  *
@@ -115,11 +114,14 @@ const Uint = {
115
114
  * assert.isTrue(randomValue >= 0 && randomValue <= 3);
116
115
  * ```
117
116
  *
118
- * @returns A random non-negative integer as a Uint.
117
+ * @param min - The minimum value (inclusive)
118
+ * @param max - The maximum value (inclusive)
119
+ * @returns A random `Uint` in `[min, max]`
119
120
  */
120
121
  random,
121
122
  /**
122
- * Raises a Uint to the power of another Uint.
123
+ * Raises `a` to the power `b`, returning `a ** b` as an `Uint` (floored to an
124
+ * integer).
123
125
  *
124
126
  * @example
125
127
  *
@@ -133,13 +135,13 @@ const Uint = {
133
135
  * assert.isTrue(power === 32);
134
136
  * ```
135
137
  *
136
- * @param a The base Uint.
137
- * @param b The exponent Uint.
138
- * @returns `a ** b` clamped to [0, +∞) as a Uint.
138
+ * @param a - The base non-negative integer
139
+ * @param b - The exponent non-negative integer
140
+ * @returns `a ** b` as an `Uint`
139
141
  */
140
142
  pow,
141
143
  /**
142
- * Adds two Uint values.
144
+ * Adds two non-negative integers, returning `a + b` as an `Uint`.
143
145
  *
144
146
  * @example
145
147
  *
@@ -149,13 +151,13 @@ const Uint = {
149
151
  * assert.isTrue(sum === 13);
150
152
  * ```
151
153
  *
152
- * @param a The first Uint.
153
- * @param b The second Uint.
154
- * @returns `a + b` clamped to [0, +∞) as a Uint.
154
+ * @param a - The first non-negative integer
155
+ * @param b - The second non-negative integer
156
+ * @returns The sum of `a` and `b` as an `Uint`
155
157
  */
156
158
  add,
157
159
  /**
158
- * Subtracts one Uint from another.
160
+ * Subtracts two non-negative integers, returning `a - b` as an `Uint`.
159
161
  *
160
162
  * @example
161
163
  *
@@ -165,13 +167,13 @@ const Uint = {
165
167
  * assert.isTrue(difference === 0);
166
168
  * ```
167
169
  *
168
- * @param a The minuend Uint.
169
- * @param b The subtrahend Uint.
170
- * @returns `a - b` clamped to [0, +∞) as a Uint (minimum 0).
170
+ * @param a - The first non-negative integer
171
+ * @param b - The second non-negative integer
172
+ * @returns The difference of `a` and `b` as an `Uint`
171
173
  */
172
174
  sub,
173
175
  /**
174
- * Multiplies two Uint values.
176
+ * Multiplies two non-negative integers, returning `a * b` as an `Uint`.
175
177
  *
176
178
  * @example
177
179
  *
@@ -181,13 +183,14 @@ const Uint = {
181
183
  * assert.isTrue(product === 42);
182
184
  * ```
183
185
  *
184
- * @param a The first Uint.
185
- * @param b The second Uint.
186
- * @returns `a * b` clamped to [0, +∞) as a Uint.
186
+ * @param a - The first non-negative integer
187
+ * @param b - The second non-negative integer
188
+ * @returns The product of `a` and `b` as an `Uint`
187
189
  */
188
190
  mul,
189
191
  /**
190
- * Divides one Uint by another using floor division.
192
+ * Divides two non-negative integers using floor division (`⌊a / b⌋`): the
193
+ * result is `a / b` rounded toward negative infinity, as an `Uint`.
191
194
  *
192
195
  * @example
193
196
  *
@@ -197,9 +200,9 @@ const Uint = {
197
200
  * assert.isTrue(quotient === 2);
198
201
  * ```
199
202
  *
200
- * @param a The dividend Uint.
201
- * @param b The divisor Uint.
202
- * @returns `⌊a / b⌋` clamped to [0, +∞) as a Uint.
203
+ * @param a - The dividend
204
+ * @param b - The divisor (must be non-zero)
205
+ * @returns The floored quotient as an `Uint`
203
206
  */
204
207
  div
205
208
  };
@@ -1 +1 @@
1
- {"version":3,"file":"uint.mjs","sources":["../../../src/number/branded-types/uint.mts"],"sourcesContent":["import { type Uint as TtfImported_Uint } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint = TtfImported_Uint;\n\ntype ElementType = Uint;\n\nconst typeNameInMessage = 'a non-negative integer';\n\nconst {\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 0,\n number\n>({\n integerOrSafeInteger: 'Integer',\n MIN_VALUE: 0,\n MAX_VALUE: Number.MAX_VALUE,\n typeNameInMessage,\n} as const);\n\n/**\n * Checks if a number is a Uint.\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isUint(4));\n *\n * assert.isFalse(isUint(-1));\n *\n * assert.isTrue(Uint.is(0));\n * ```\n *\n * @param value The value to check.\n * @returns `true` if the value is a Uint, `false` otherwise.\n */\nexport const isUint = is;\n\n/**\n * Casts a number to a Uint type.\n *\n * @example\n *\n * ```ts\n * const branded = asUint(12);\n *\n * assert.isTrue(branded === 12);\n *\n * assert.isTrue(Uint.is(branded));\n * ```\n *\n * @param value The value to cast.\n * @returns The value as a Uint type.\n * @throws {TypeError} If the value is not a non-negative integer.\n */\nexport const asUint = castType;\n\n/**\n * Namespace providing type-safe arithmetic operations for unsigned integers.\n *\n * All operations maintain the non-negative constraint by clamping negative\n * results to 0. This ensures that all arithmetic preserves the unsigned integer\n * property.\n */\nexport const Uint = {\n /**\n * Type guard to check if a value is a Uint.\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isUint(4));\n *\n * assert.isFalse(isUint(-1));\n *\n * assert.isTrue(Uint.is(0));\n * ```\n *\n * @param value The value to check.\n * @returns `true` if the value is a non-negative integer, `false` otherwise.\n * @see {@link isUint} for usage examples\n */\n is,\n\n /**\n * The minimum value for an unsigned integer.\n *\n * @readonly\n */\n MIN_VALUE,\n\n /**\n * Returns the smaller of two Uint values.\n *\n * @example\n *\n * ```ts\n * const smallest = Uint.min(asUint(7), asUint(3));\n *\n * assert.isTrue(smallest === 3);\n * ```\n *\n * @param a The first Uint.\n * @param b The second Uint.\n * @returns The minimum value as a Uint.\n */\n min: min_,\n\n /**\n * Returns the larger of two Uint values.\n *\n * @example\n *\n * ```ts\n * const largest = Uint.max(asUint(7), asUint(3));\n *\n * assert.isTrue(largest === 7);\n * ```\n *\n * @param a The first Uint.\n * @param b The second Uint.\n * @returns The maximum value as a Uint.\n */\n max: max_,\n\n /**\n * Clamps a number to the Uint range (non-negative).\n *\n * @example\n *\n * ```ts\n * const clampedNegative = Uint.clamp(-5);\n *\n * const clampedPositive = Uint.clamp(42);\n *\n * assert.isTrue(clampedNegative === 0);\n *\n * assert.isTrue(clampedPositive === 42);\n * ```\n *\n * @param value The number to clamp.\n * @returns The value clamped to [0, +∞) as a Uint.\n */\n clamp,\n\n /**\n * Generates a random Uint value.\n *\n * @example\n *\n * ```ts\n * const min = asUint(0);\n *\n * const max = asUint(3);\n *\n * const randomValue = Uint.random(min, max);\n *\n * assert.isTrue(Uint.is(randomValue));\n *\n * assert.isTrue(randomValue >= 0 && randomValue <= 3);\n * ```\n *\n * @returns A random non-negative integer as a Uint.\n */\n random,\n\n /**\n * Raises a Uint to the power of another Uint.\n *\n * @example\n *\n * ```ts\n * const base = asUint(2);\n *\n * const exponent = asUint(5);\n *\n * const power = Uint.pow(base, exponent);\n *\n * assert.isTrue(power === 32);\n * ```\n *\n * @param a The base Uint.\n * @param b The exponent Uint.\n * @returns `a ** b` clamped to [0, +∞) as a Uint.\n */\n pow,\n\n /**\n * Adds two Uint values.\n *\n * @example\n *\n * ```ts\n * const sum = Uint.add(asUint(5), asUint(8));\n *\n * assert.isTrue(sum === 13);\n * ```\n *\n * @param a The first Uint.\n * @param b The second Uint.\n * @returns `a + b` clamped to [0, +∞) as a Uint.\n */\n add,\n\n /**\n * Subtracts one Uint from another.\n *\n * @example\n *\n * ```ts\n * const difference = Uint.sub(asUint(5), asUint(8));\n *\n * assert.isTrue(difference === 0);\n * ```\n *\n * @param a The minuend Uint.\n * @param b The subtrahend Uint.\n * @returns `a - b` clamped to [0, +∞) as a Uint (minimum 0).\n */\n sub,\n\n /**\n * Multiplies two Uint values.\n *\n * @example\n *\n * ```ts\n * const product = Uint.mul(asUint(7), asUint(6));\n *\n * assert.isTrue(product === 42);\n * ```\n *\n * @param a The first Uint.\n * @param b The second Uint.\n * @returns `a * b` clamped to [0, +∞) as a Uint.\n */\n mul,\n\n /**\n * Divides one Uint by another using floor division.\n *\n * @example\n *\n * ```ts\n * const quotient = Uint.div(asUint(10), asUint(4));\n *\n * assert.isTrue(quotient === 2);\n * ```\n *\n * @param a The dividend Uint.\n * @param b The divisor Uint.\n * @returns `⌊a / b⌋` clamped to [0, +∞) as a Uint.\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative'\n >\n>('=');\n\nexpectType<\n typeof Uint,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,wBAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,SAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB;AACF,CAAU,CAAA;AAkBH,MAAM,MAAA,GAAS;AAmBf,MAAM,MAAA,GAAS;AASf,MAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBlB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA;AACF;;;;"}
1
+ {"version":3,"file":"uint.mjs","sources":["../../../src/number/branded-types/uint.mts"],"sourcesContent":["import { type Uint as TtfImported_Uint } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint = TtfImported_Uint;\n\ntype ElementType = Uint;\n\nconst typeNameInMessage = 'a non-negative integer';\n\nconst {\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 0,\n number\n>({\n integerOrSafeInteger: 'Integer',\n MIN_VALUE: 0,\n MAX_VALUE: Number.MAX_VALUE,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a non-negative integer.\n *\n * Returns `true` for a non-negative integer — a value with no fractional\n * component, including values outside the safe integer range (unlike\n * `SafeInt`).\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isUint(4));\n *\n * assert.isFalse(isUint(-1));\n *\n * assert.isTrue(Uint.is(0));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer, `false` otherwise\n */\nexport const isUint = is;\n\n/**\n * Casts a `number` to the `Uint` branded type.\n *\n * Validates that the value is a non-negative integer and returns it with the\n * `Uint` brand. Throws a `TypeError` otherwise.\n *\n * @example\n *\n * ```ts\n * const branded = asUint(12);\n *\n * assert.isTrue(branded === 12);\n *\n * assert.isTrue(Uint.is(branded));\n * ```\n *\n * @param value - The value to cast\n * @returns The value as an `Uint`\n * @throws {TypeError} If the value is not a non-negative integer\n */\nexport const asUint = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint` branded type.\n *\n * The `Uint` type represents a non-negative integer. Division (`div`) uses\n * floor division.\n *\n * Unlike `SafeInt`, `Uint` allows values outside the safe integer range (±2^53\n * − 1), so very large magnitudes may lose precision in JavaScript's `number`\n * type.\n */\nexport const Uint = {\n /**\n * Type guard that checks if a value is a non-negative integer.\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isUint(4));\n *\n * assert.isFalse(isUint(-1));\n *\n * assert.isTrue(Uint.is(0));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer, `false` otherwise\n * @see {@link isUint} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint`.\n */\n MIN_VALUE,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @example\n *\n * ```ts\n * const smallest = Uint.min(asUint(7), asUint(3));\n *\n * assert.isTrue(smallest === 3);\n * ```\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint`\n */\n min: min_,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @example\n *\n * ```ts\n * const largest = Uint.max(asUint(7), asUint(3));\n *\n * assert.isTrue(largest === 7);\n * ```\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `Uint` range, rounding to the nearest integer\n * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @example\n *\n * ```ts\n * const clampedNegative = Uint.clamp(-5);\n *\n * const clampedPositive = Uint.clamp(42);\n *\n * assert.isTrue(clampedNegative === 0);\n *\n * assert.isTrue(clampedPositive === 42);\n * ```\n *\n * @param value - The value to clamp\n * @returns The clamped value as an `Uint`\n */\n clamp,\n\n /**\n * Generates a random `Uint` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @example\n *\n * ```ts\n * const min = asUint(0);\n *\n * const max = asUint(3);\n *\n * const randomValue = Uint.random(min, max);\n *\n * assert.isTrue(Uint.is(randomValue));\n *\n * assert.isTrue(randomValue >= 0 && randomValue <= 3);\n * ```\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `Uint` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint` (floored to an\n * integer).\n *\n * @example\n *\n * ```ts\n * const base = asUint(2);\n *\n * const exponent = asUint(5);\n *\n * const power = Uint.pow(base, exponent);\n *\n * assert.isTrue(power === 32);\n * ```\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint`.\n *\n * @example\n *\n * ```ts\n * const sum = Uint.add(asUint(5), asUint(8));\n *\n * assert.isTrue(sum === 13);\n * ```\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 `Uint`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint`.\n *\n * @example\n *\n * ```ts\n * const difference = Uint.sub(asUint(5), asUint(8));\n *\n * assert.isTrue(difference === 0);\n * ```\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 `Uint`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint`.\n *\n * @example\n *\n * ```ts\n * const product = Uint.mul(asUint(7), asUint(6));\n *\n * assert.isTrue(product === 42);\n * ```\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 `Uint`\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 `Uint`.\n *\n * @example\n *\n * ```ts\n * const quotient = Uint.div(asUint(10), asUint(4));\n *\n * assert.isTrue(quotient === 2);\n * ```\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative'\n >\n>('=');\n\nexpectType<\n typeof Uint,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,wBAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,SAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB;AACF,CAAU,CAAA;AAsBH,MAAM,MAAA,GAAS;AAsBf,MAAM,MAAA,GAAS;AAYf,MAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBlB,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA;AACF;;;;"}