@rickosborne/rebound 2025.2.16

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 (194) hide show
  1. package/README.md +1469 -0
  2. package/assert-bounded.cjs +44 -0
  3. package/assert-bounded.cjs.map +6 -0
  4. package/assert-bounded.d.ts +11 -0
  5. package/assert-bounded.d.ts.map +1 -0
  6. package/assert-bounded.mjs +25 -0
  7. package/assert-bounded.mjs.map +6 -0
  8. package/bound.cjs +132 -0
  9. package/bound.cjs.map +6 -0
  10. package/bound.d.ts +35 -0
  11. package/bound.d.ts.map +1 -0
  12. package/bound.mjs +113 -0
  13. package/bound.mjs.map +6 -0
  14. package/effective-range.cjs +30 -0
  15. package/effective-range.cjs.map +6 -0
  16. package/effective-range.d.ts +7 -0
  17. package/effective-range.d.ts.map +1 -0
  18. package/effective-range.mjs +11 -0
  19. package/effective-range.mjs.map +6 -0
  20. package/empty-range.cjs +45 -0
  21. package/empty-range.cjs.map +6 -0
  22. package/empty-range.d.ts +11 -0
  23. package/empty-range.d.ts.map +1 -0
  24. package/empty-range.mjs +26 -0
  25. package/empty-range.mjs.map +6 -0
  26. package/from-number-bounded.cjs +49 -0
  27. package/from-number-bounded.cjs.map +6 -0
  28. package/from-number-bounded.d.ts +12 -0
  29. package/from-number-bounded.d.ts.map +1 -0
  30. package/from-number-bounded.mjs +30 -0
  31. package/from-number-bounded.mjs.map +6 -0
  32. package/guard-bounded.cjs +38 -0
  33. package/guard-bounded.cjs.map +6 -0
  34. package/guard-bounded.d.ts +15 -0
  35. package/guard-bounded.d.ts.map +1 -0
  36. package/guard-bounded.mjs +19 -0
  37. package/guard-bounded.mjs.map +6 -0
  38. package/index.cjs +49 -0
  39. package/index.cjs.map +6 -0
  40. package/index.d.ts +32 -0
  41. package/index.d.ts.map +1 -0
  42. package/index.mjs +32 -0
  43. package/index.mjs.map +6 -0
  44. package/int255-from-01.cjs +34 -0
  45. package/int255-from-01.cjs.map +6 -0
  46. package/int255-from-01.d.ts +8 -0
  47. package/int255-from-01.d.ts.map +1 -0
  48. package/int255-from-01.mjs +15 -0
  49. package/int255-from-01.mjs.map +6 -0
  50. package/int255.cjs +34 -0
  51. package/int255.cjs.map +6 -0
  52. package/int255.d.ts +9 -0
  53. package/int255.d.ts.map +1 -0
  54. package/int255.mjs +14 -0
  55. package/int255.mjs.map +6 -0
  56. package/int360.cjs +34 -0
  57. package/int360.cjs.map +6 -0
  58. package/int360.d.ts +9 -0
  59. package/int360.d.ts.map +1 -0
  60. package/int360.mjs +14 -0
  61. package/int360.mjs.map +6 -0
  62. package/integer-from.cjs +54 -0
  63. package/integer-from.cjs.map +6 -0
  64. package/integer-from.d.ts +19 -0
  65. package/integer-from.d.ts.map +1 -0
  66. package/integer-from.mjs +35 -0
  67. package/integer-from.mjs.map +6 -0
  68. package/integer-generator.cjs +54 -0
  69. package/integer-generator.cjs.map +6 -0
  70. package/integer-generator.d.ts +9 -0
  71. package/integer-generator.d.ts.map +1 -0
  72. package/integer-generator.mjs +35 -0
  73. package/integer-generator.mjs.map +6 -0
  74. package/integer-range.cjs +50 -0
  75. package/integer-range.cjs.map +6 -0
  76. package/integer-range.d.ts +9 -0
  77. package/integer-range.d.ts.map +1 -0
  78. package/integer-range.mjs +31 -0
  79. package/integer-range.mjs.map +6 -0
  80. package/number-range.cjs +97 -0
  81. package/number-range.cjs.map +6 -0
  82. package/number-range.d.ts +20 -0
  83. package/number-range.d.ts.map +1 -0
  84. package/number-range.mjs +78 -0
  85. package/number-range.mjs.map +6 -0
  86. package/package.json +248 -0
  87. package/random-bounded.cjs +52 -0
  88. package/random-bounded.cjs.map +6 -0
  89. package/random-bounded.d.ts +9 -0
  90. package/random-bounded.d.ts.map +1 -0
  91. package/random-bounded.mjs +33 -0
  92. package/random-bounded.mjs.map +6 -0
  93. package/range-base.cjs +127 -0
  94. package/range-base.cjs.map +6 -0
  95. package/range-base.d.ts +29 -0
  96. package/range-base.d.ts.map +1 -0
  97. package/range-base.mjs +108 -0
  98. package/range-base.mjs.map +6 -0
  99. package/range-like.cjs +25 -0
  100. package/range-like.cjs.map +6 -0
  101. package/range-like.d.ts +20 -0
  102. package/range-like.d.ts.map +1 -0
  103. package/range-like.mjs +5 -0
  104. package/range-like.mjs.map +6 -0
  105. package/range.cjs +41 -0
  106. package/range.cjs.map +6 -0
  107. package/range.d.ts +4 -0
  108. package/range.d.ts.map +1 -0
  109. package/range.mjs +22 -0
  110. package/range.mjs.map +6 -0
  111. package/real-range.cjs +53 -0
  112. package/real-range.cjs.map +6 -0
  113. package/real-range.d.ts +8 -0
  114. package/real-range.d.ts.map +1 -0
  115. package/real-range.mjs +34 -0
  116. package/real-range.mjs.map +6 -0
  117. package/real01-from-255.cjs +37 -0
  118. package/real01-from-255.cjs.map +6 -0
  119. package/real01-from-255.d.ts +10 -0
  120. package/real01-from-255.d.ts.map +1 -0
  121. package/real01-from-255.mjs +18 -0
  122. package/real01-from-255.mjs.map +6 -0
  123. package/real01.cjs +34 -0
  124. package/real01.cjs.map +6 -0
  125. package/real01.d.ts +9 -0
  126. package/real01.d.ts.map +1 -0
  127. package/real01.mjs +14 -0
  128. package/real01.mjs.map +6 -0
  129. package/real255-from-01.cjs +28 -0
  130. package/real255-from-01.cjs.map +6 -0
  131. package/real255-from-01.d.ts +7 -0
  132. package/real255-from-01.d.ts.map +1 -0
  133. package/real255-from-01.mjs +9 -0
  134. package/real255-from-01.mjs.map +6 -0
  135. package/real255.cjs +34 -0
  136. package/real255.cjs.map +6 -0
  137. package/real255.d.ts +9 -0
  138. package/real255.d.ts.map +1 -0
  139. package/real255.mjs +14 -0
  140. package/real255.mjs.map +6 -0
  141. package/real360.cjs +34 -0
  142. package/real360.cjs.map +6 -0
  143. package/real360.d.ts +9 -0
  144. package/real360.d.ts.map +1 -0
  145. package/real360.mjs +14 -0
  146. package/real360.mjs.map +6 -0
  147. package/rebound-builder.cjs +148 -0
  148. package/rebound-builder.cjs.map +6 -0
  149. package/rebound-builder.d.ts +46 -0
  150. package/rebound-builder.d.ts.map +1 -0
  151. package/rebound-builder.mjs +129 -0
  152. package/rebound-builder.mjs.map +6 -0
  153. package/rebound.cjs +156 -0
  154. package/rebound.cjs.map +6 -0
  155. package/rebound.d.ts +70 -0
  156. package/rebound.d.ts.map +1 -0
  157. package/rebound.mjs +137 -0
  158. package/rebound.mjs.map +6 -0
  159. package/same-bounds.cjs +46 -0
  160. package/same-bounds.cjs.map +6 -0
  161. package/same-bounds.d.ts +4 -0
  162. package/same-bounds.d.ts.map +1 -0
  163. package/same-bounds.mjs +27 -0
  164. package/same-bounds.mjs.map +6 -0
  165. package/scale-bounded.cjs +59 -0
  166. package/scale-bounded.cjs.map +6 -0
  167. package/scale-bounded.d.ts +12 -0
  168. package/scale-bounded.d.ts.map +1 -0
  169. package/scale-bounded.mjs +40 -0
  170. package/scale-bounded.mjs.map +6 -0
  171. package/spec.cjs +41 -0
  172. package/spec.cjs.map +6 -0
  173. package/spec.d.ts +204 -0
  174. package/spec.d.ts.map +1 -0
  175. package/spec.mjs +21 -0
  176. package/spec.mjs.map +6 -0
  177. package/string-range.cjs +40 -0
  178. package/string-range.cjs.map +6 -0
  179. package/string-range.d.ts +8 -0
  180. package/string-range.d.ts.map +1 -0
  181. package/string-range.mjs +21 -0
  182. package/string-range.mjs.map +6 -0
  183. package/typed-function.cjs +42 -0
  184. package/typed-function.cjs.map +6 -0
  185. package/typed-function.d.ts +3 -0
  186. package/typed-function.d.ts.map +1 -0
  187. package/typed-function.mjs +23 -0
  188. package/typed-function.mjs.map +6 -0
  189. package/util.cjs +28 -0
  190. package/util.cjs.map +6 -0
  191. package/util.d.ts +3 -0
  192. package/util.d.ts.map +1 -0
  193. package/util.mjs +9 -0
  194. package/util.mjs.map +6 -0
package/README.md ADDED
@@ -0,0 +1,1469 @@
1
+ # @rickosborne/rebound
2
+
3
+ Tools for working with bounded numbers.
4
+ For example:
5
+
6
+ - RGB values: \[0,255\] for both integers and real numbers
7
+ - Hues: \[0,360), also int and real
8
+ - Chroma: \[0,1\]
9
+ - And other non-color-related things.
10
+
11
+ Built on top of:
12
+
13
+ - [@rickosborne/foundation](https://www.npmjs.com/package/@rickosborne/foundation) for data structures and general helpers
14
+ - [@rickosborne/guard](https://www.npmjs.com/package/@rickosborne/guard) for TypeScript guards
15
+ - [@rickosborne/typical](https://www.npmjs.com/package/@rickosborne/typical) for helper TypeScript type definitions
16
+ ## Usage
17
+
18
+ Install via your favorite package manager.
19
+
20
+ Each package supports CommonJS `require`, ESM `import`, and TypeScript usage.
21
+
22
+ You also have a choice: barrel imports or direct imports.
23
+
24
+ Barrel imports mean you're going to require/import everything from the same package-level namespace:
25
+
26
+ ```typescript
27
+ // CommonJS
28
+ const { isPlainObject, isListOf } = require("@rickosborne/guard");
29
+ // ESM / TypeScript
30
+ import { isPlainObject, isListOf } from "@rickosborne/guard";
31
+ ```
32
+
33
+ Implications:
34
+
35
+ - Nice and simple.
36
+ - Your build system needs to do tree-shaking well ... or you'll end up adding the entire package even if you only import two functions.
37
+
38
+ The other option is to use direct imports:
39
+
40
+ ```typescript
41
+ // CommonJS
42
+ const { isPlainObject } = require("@rickosborne/guard/is-object");
43
+ const { isListOf } = require("@rickosborne/guard/is-list-of");
44
+ // ESM / TypeScript
45
+ import { isPlainObject } from "@rickosborne/guard/is-object.js";
46
+ import { isListOf } from "@rickosborne/guard/is-list-of.js";
47
+ ```
48
+
49
+ Implications:
50
+
51
+ - You (probably) don't have to worry about tree-shaking as your build (likely) ends up with only the functions you need.
52
+
53
+ If you're using a modern build system, there aren't any strong reasons to prefer one way over the other.
54
+ It's really just down to your personal preference.
55
+
56
+ ### A quick note about file extensions
57
+
58
+ Do you need to use file extensions?
59
+ And if so, which extensions?
60
+
61
+ Honestly ... this is a dumpster fire question.
62
+ It really comes down to your own setup and configuration.
63
+
64
+ Within each package itself:
65
+
66
+ - The CommonJS files all have `.cjs` extensions.
67
+ - The ESM files all have `.mjs` extensions.
68
+ - Node subpath exports have been set up to send `.js` imports to the `.cjs` (via `require`) or `.mjs` (via `import`) files, depending on your setup.
69
+
70
+ So, in theory, the only extension which _won't_ work would be `.ts` because the source isn't included.
71
+
72
+ If you run into a problem with a particular configuration, file a GitHub issue with:
73
+
74
+ - Your `tsconfig.json`'s `module`, `moduleResolution`, and `target` settings.
75
+ - Your `package.json`'s `type` and `imports` settings.
76
+ - An example of another package which imports correctly for you.
77
+
78
+ ## License
79
+
80
+ This package is licensed as [CC-BY-NC-SA-4.0] unless otherwise noted.
81
+ That is, Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International.
82
+
83
+ [CC-BY-NC-SA-4.0]: https://creativecommons.org/licenses/by-nc-sa/4.0/
84
+
85
+
86
+ ***
87
+
88
+ ## API
89
+
90
+ ### Classes
91
+
92
+ #### Bound
93
+
94
+ <a id="api-bound"></a>
95
+
96
+ ```typescript
97
+ class Bound<T>
98
+ ```
99
+
100
+ #### EmptyRange
101
+
102
+ <a id="api-emptyrange"></a>
103
+
104
+ ```typescript
105
+ class EmptyRange extends RangeBase<never>
106
+ ```
107
+
108
+ #### IntegerRange
109
+
110
+ <a id="api-integerrange"></a>
111
+
112
+ ```typescript
113
+ class IntegerRange extends NumberRange
114
+ ```
115
+
116
+ #### NumberRange
117
+
118
+ <a id="api-numberrange"></a>
119
+
120
+ ```typescript
121
+ abstract class NumberRange extends RangeBase<number> implements CheckedBounds, RangeLike<number>
122
+ ```
123
+
124
+ #### RangeBase
125
+
126
+ <a id="api-rangebase"></a>
127
+
128
+ ```typescript
129
+ abstract class RangeBase<T> implements RangeLike<T>
130
+ ```
131
+
132
+ #### RealRange
133
+
134
+ <a id="api-realrange"></a>
135
+
136
+ ```typescript
137
+ class RealRange extends NumberRange
138
+ ```
139
+
140
+ #### Rebound
141
+
142
+ <a id="api-rebound"></a>
143
+
144
+ ```typescript
145
+ class Rebound<N extends number> implements TypedCheckedBounds
146
+ ```
147
+
148
+ #### ReboundBuilder
149
+
150
+ <a id="api-reboundbuilder"></a>
151
+
152
+ ```typescript
153
+ class ReboundBuilder<LowerInc extends LowerInEx, Lower extends number, Int extends NumberSet, Upper extends number, UpperInc extends UpperInEx>
154
+ ```
155
+
156
+ #### StringRange
157
+
158
+ <a id="api-stringrange"></a>
159
+
160
+ ```typescript
161
+ class StringRange extends RangeBase<string>
162
+ ```
163
+
164
+ ### Functions
165
+
166
+ #### addTypedProperties
167
+
168
+ <a id="api-addtypedproperties"></a>
169
+
170
+ ```typescript
171
+ addTypedProperties: <T extends object, Bounds extends Omit<TypedCheckedBounds, "typeName">>(target: T, bounds: Bounds, typeName: string, fnName: string) => T & TypedCheckedBounds
172
+ ```
173
+
174
+ #### assertBounded
175
+
176
+ <a id="api-assertbounded"></a>
177
+
178
+ ```typescript
179
+ function assertBounded<N extends number, IfPresent extends boolean>(guard: If<IfPresent, GuardIfPresent<N>, GuardExact<N>>, errorProvider: OutOfBoundsErrorProvider, ifPresent: IfPresent, value: unknown, name?: string | undefined): asserts value is IfIfPresent<IfPresent, N>;
180
+ ```
181
+
182
+ #### assertForBounds
183
+
184
+ <a id="api-assertforbounds"></a>
185
+
186
+ ```typescript
187
+ function assertForBounds<N extends number, IfPresent extends boolean>(guard: If<IfPresent, GuardIfPresent<N>, GuardExact<N>>, errorProvider: OutOfBoundsErrorProvider, ifPresent: IfPresent, fnName?: string): If<IfPresent, AssertIfPresent<N>, AssertExact<N>>;
188
+ ```
189
+
190
+ #### assertSameBounds
191
+
192
+ <a id="api-assertsamebounds"></a>
193
+
194
+ ```typescript
195
+ function assertSameBounds(left: TypedCheckedBounds, right: TypedCheckedBounds, errorSupplier?: undefined | ((mismatchedKeys: (keyof TypedCheckedBounds)[], left: TypedCheckedBounds, right: TypedCheckedBounds) => Error)): void;
196
+ ```
197
+
198
+ #### boundComparator
199
+
200
+ <a id="api-boundcomparator"></a>
201
+
202
+ ```typescript
203
+ boundComparator: <T>(a: Bound<T> | Unbounded, b: Bound<T> | Unbounded) => number
204
+ ```
205
+
206
+ #### boundedFromNumber
207
+
208
+ <a id="api-boundedfromnumber"></a>
209
+
210
+ ```typescript
211
+ function boundedFromNumber<N extends number, IfPresent extends boolean>(guard: GuardExact<N>, errorProvider: OutOfBoundsErrorProvider, ifPresent: IfPresent, value: number | undefined | null, name?: string | undefined): If<IfPresent, N | undefined, N>;
212
+ ```
213
+
214
+ #### boundedIntFromNumber
215
+
216
+ <a id="api-boundedintfromnumber"></a>
217
+
218
+ ```typescript
219
+ function boundedIntFromNumber<N extends number, IsLowerInc extends boolean, Lower extends number, Upper extends number, IsUpperInc extends boolean, IfPresent extends boolean>(isLowerInc: IsLowerInc, lower: Lower, upper: Upper, isUpperInc: IsUpperInc, ifPresent: IfPresent, errorProvider: OutOfBoundsErrorProvider, strategy: ToInt<N>, value: number | undefined | null, name?: string | undefined): If<IfPresent, N | undefined, N>;
220
+ ```
221
+
222
+ #### checkMissing
223
+
224
+ <a id="api-checkmissing"></a>
225
+
226
+ ```typescript
227
+ function checkMissing<Lower extends number, LowerInc extends LowerInEx, Int extends NumberSet, UpperInc extends UpperInEx, Upper extends number>(config: Partial<BoundsConfig<LowerInEx, number, NumberSet, number, UpperInEx>>): asserts config is BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>;
228
+ ```
229
+
230
+ #### effectiveRange
231
+
232
+ <a id="api-effectiverange"></a>
233
+
234
+ ```typescript
235
+ effectiveRange: (bounds: CheckedBounds) => number
236
+ ```
237
+
238
+ Calculate the effective range for a given bounds. That is, take into account the inclusivity of the lower and upper bounds.
239
+
240
+
241
+ #### fromNumberForBounds
242
+
243
+ <a id="api-fromnumberforbounds"></a>
244
+
245
+ ```typescript
246
+ function fromNumberForBounds<N extends number, IfPresent extends boolean>(guard: GuardExact<N>, errorProvider: OutOfBoundsErrorProvider, ifPresent: IfPresent, fnName?: string): If<IfPresent, FromNumberIfPresent<N>, FromNumber<N>>;
247
+ ```
248
+
249
+ #### guardForBounds
250
+
251
+ <a id="api-guardforbounds"></a>
252
+
253
+ ```typescript
254
+ function guardForBounds<Bounds extends Omit<TypedCheckedBounds, "typeName">, N extends number, IfPresent extends boolean>(bounds: Bounds, typeName: string, fnName: string, ifPresent: IfPresent): If<IfPresent, GuardIfPresent<N>, GuardExact<N>>;
255
+ ```
256
+
257
+ Generate a guard for the branded number type matching the given spec.
258
+
259
+
260
+ #### ifIfPresent
261
+
262
+ <a id="api-ififpresent"></a>
263
+
264
+ ```typescript
265
+ ifIfPresent: <IfPresent extends boolean, T, U>(ifPresent: IfPresent, t: T, u: U) => If<IfPresent, T, U>
266
+ ```
267
+
268
+ #### int255From01
269
+
270
+ <a id="api-int255from01"></a>
271
+
272
+ ```typescript
273
+ function int255From01(value: Real01): Int255;
274
+ ```
275
+
276
+ Convert a [Real01](#api-real01) to an [Int255](#api-int255).
277
+
278
+
279
+ #### int255From01
280
+
281
+ <a id="api-int255from01"></a>
282
+
283
+ ```typescript
284
+ function int255From01(value: undefined): undefined;
285
+ ```
286
+
287
+ #### integerFrom
288
+
289
+ <a id="api-integerfrom"></a>
290
+
291
+ ```typescript
292
+ function integerFrom<N extends number, IsLowerInc extends boolean, Lower extends number, Upper extends number, IsUpperInc extends boolean, IfPresent extends boolean>(typeName: string, bounds: CheckedBoundsConfig<IsLowerInc, Lower, boolean, Upper, IsUpperInc> & {
293
+ label: string;
294
+ }, errorProvider: OutOfBoundsErrorProvider, ifPresent: IfPresent, strategy?: IntStrategy, fnName?: string): If<IfPresent, ConvertIfPresentTo<N>, ConvertTo<N>>;
295
+ ```
296
+
297
+ #### integerGenerator
298
+
299
+ <a id="api-integergenerator"></a>
300
+
301
+ ```typescript
302
+ function integerGenerator<N extends number>(bounds: CheckedBounds, options?: IntegerGeneratorOptions): Generator<N, undefined, undefined>;
303
+ ```
304
+
305
+ #### randomBounded
306
+
307
+ <a id="api-randombounded"></a>
308
+
309
+ ```typescript
310
+ randomBounded: <N extends number>(typeName: string, label: string, isLowerInc: boolean, lower: number, isInt: boolean, upper: number, isUpperInc: boolean, rng?: ({
311
+ float01(): number;
312
+ range(low: number, high: number): number;
313
+ }), fnName?: string) => RandomBounded<N>
314
+ ```
315
+
316
+ #### rangeFromChecked
317
+
318
+ <a id="api-rangefromchecked"></a>
319
+
320
+ ```typescript
321
+ rangeFromChecked: <Config extends CheckedBounds>(config: CheckedBounds) => BoundsLabel<DefinedFromCheckedConfig<Config>>
322
+ ```
323
+
324
+ #### rangeFromConfig
325
+
326
+ <a id="api-rangefromconfig"></a>
327
+
328
+ ```typescript
329
+ rangeFromConfig: <LowerInc extends LowerInEx, Lower extends number, Int extends NumberSet, Upper extends number, UpperInc extends UpperInEx, Config extends BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>>(config: Config) => BoundsLabel<Config>
330
+ ```
331
+
332
+ #### real01From255
333
+
334
+ <a id="api-real01from255"></a>
335
+
336
+ ```typescript
337
+ function real01From255(value: number | Int255 | Real255): Real01;
338
+ ```
339
+
340
+ Convert a [Real255](#api-real255) or [Int255](#api-int255) to a [Real01](#api-real01).
341
+
342
+
343
+ #### real01From255
344
+
345
+ <a id="api-real01from255"></a>
346
+
347
+ ```typescript
348
+ function real01From255(value: undefined): undefined;
349
+ ```
350
+
351
+ #### real01From255
352
+
353
+ <a id="api-real01from255"></a>
354
+
355
+ ```typescript
356
+ function real01From255(value: number | Int255 | Real255 | undefined): Real01 | undefined;
357
+ ```
358
+
359
+ #### real255From01
360
+
361
+ <a id="api-real255from01"></a>
362
+
363
+ ```typescript
364
+ real255From01: (value: Real01) => Real255
365
+ ```
366
+
367
+ Convert a [Real01](#api-real01) to a [Real255](#api-real255).
368
+
369
+
370
+ #### sameBounds
371
+
372
+ <a id="api-samebounds"></a>
373
+
374
+ ```typescript
375
+ sameBounds: (left: TypedCheckedBounds, right: TypedCheckedBounds) => boolean
376
+ ```
377
+
378
+ #### scaleBounded
379
+
380
+ <a id="api-scalebounded"></a>
381
+
382
+ ```typescript
383
+ scaleBounded: <Input extends number, Output extends number, IfPresent extends boolean>(inputBounds: TypedCheckedBounds, outputBounds: TypedCheckedBounds, ifPresent: IfPresent, fnName?: string) => If<IfPresent, ScaleIfPresent<Input, Output>, ScaleExact<Input, Output>>
384
+ ```
385
+
386
+ #### validateBounded
387
+
388
+ <a id="api-validatebounded"></a>
389
+
390
+ ```typescript
391
+ validateBounded: <IsLowerInc extends boolean, Lower extends number, IsInt extends boolean, Upper extends number, IsUpperInc extends boolean, IfPresent extends boolean>(isLowerInc: IsLowerInc, lower: Lower, isInt: IsInt, upper: Upper, isUpperInc: IsUpperInc, ifPresent: IfPresent, value: unknown) => value is IfIfPresent<IfPresent, number & ReboundedFromChecked<IsLowerInc, Lower, IsInt, Upper, IsUpperInc>>
392
+ ```
393
+
394
+ ### Interfaces
395
+
396
+ #### AnyBoundsConfig
397
+
398
+ <a id="api-anyboundsconfig"></a>
399
+
400
+ ```typescript
401
+ export interface AnyBoundsConfig
402
+ ```
403
+
404
+ #### AssertExact
405
+
406
+ <a id="api-assertexact"></a>
407
+
408
+ ```typescript
409
+ export interface AssertExact<N extends number> extends TypedCheckedBounds
410
+ ```
411
+
412
+ #### AssertIfPresent
413
+
414
+ <a id="api-assertifpresent"></a>
415
+
416
+ ```typescript
417
+ export interface AssertIfPresent<N extends number> extends TypedCheckedBounds
418
+ ```
419
+
420
+ #### BoundIsInclusive
421
+
422
+ <a id="api-boundisinclusive"></a>
423
+
424
+ ```typescript
425
+ export interface BoundIsInclusive
426
+ ```
427
+
428
+ #### BoundsConfig
429
+
430
+ <a id="api-boundsconfig"></a>
431
+
432
+ ```typescript
433
+ export interface BoundsConfig<LowerInc extends LowerInEx, Lower extends number, Int extends NumberSet, Upper extends number, UpperInc extends UpperInEx> extends AnyBoundsConfig
434
+ ```
435
+
436
+ #### BoundsWithRange
437
+
438
+ <a id="api-boundswithrange"></a>
439
+
440
+ ```typescript
441
+ export interface BoundsWithRange<Range extends BoundsLabel<BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>>, LowerInc extends LowerInEx, Lower extends number, Int extends NumberSet, Upper extends number, UpperInc extends UpperInEx> extends BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>
442
+ ```
443
+
444
+ #### CheckedBounds
445
+
446
+ <a id="api-checkedbounds"></a>
447
+
448
+ ```typescript
449
+ export interface CheckedBounds
450
+ ```
451
+
452
+ #### CheckedBoundsConfig
453
+
454
+ <a id="api-checkedboundsconfig"></a>
455
+
456
+ ```typescript
457
+ export interface CheckedBoundsConfig<IsLowerInc extends boolean, Lower extends number, IsInt extends boolean, Upper extends number, IsUpperInc extends boolean>
458
+ ```
459
+
460
+ #### ConvertIfPresentTo
461
+
462
+ <a id="api-convertifpresentto"></a>
463
+
464
+ ```typescript
465
+ export interface ConvertIfPresentTo<N extends number> extends ConvertTo<N>
466
+ ```
467
+
468
+ #### ConvertTo
469
+
470
+ <a id="api-convertto"></a>
471
+
472
+ ```typescript
473
+ export interface ConvertTo<N extends number> extends TypedCheckedBounds
474
+ ```
475
+
476
+ #### DefinedBounds
477
+
478
+ <a id="api-definedbounds"></a>
479
+
480
+ ```typescript
481
+ export interface DefinedBounds
482
+ ```
483
+
484
+ #### DefinedFromChecked
485
+
486
+ <a id="api-definedfromchecked"></a>
487
+
488
+ ```typescript
489
+ export interface DefinedFromChecked<IsLowerInc extends boolean, Lower extends number, IsInt extends boolean, Upper extends number, IsUpperInc extends boolean> extends DefinedBounds
490
+ ```
491
+
492
+ #### DefinedFromCheckedConfig
493
+
494
+ <a id="api-definedfromcheckedconfig"></a>
495
+
496
+ ```typescript
497
+ export interface DefinedFromCheckedConfig<Config extends CheckedBounds> extends DefinedFromChecked<Config["isLowerInc"], Config["lower"], Config["isInt"], Config["upper"], Config["isUpperInc"]>
498
+ ```
499
+
500
+ #### FromNumber
501
+
502
+ <a id="api-fromnumber"></a>
503
+
504
+ ```typescript
505
+ export interface FromNumber<N extends number> extends TypedCheckedBounds
506
+ ```
507
+
508
+ #### FromNumberIfPresent
509
+
510
+ <a id="api-fromnumberifpresent"></a>
511
+
512
+ ```typescript
513
+ export interface FromNumberIfPresent<N extends number> extends FromNumber<N>
514
+ ```
515
+
516
+ #### GuardExact
517
+
518
+ <a id="api-guardexact"></a>
519
+
520
+ ```typescript
521
+ export interface GuardExact<T extends number> extends TypedCheckedBounds
522
+ ```
523
+
524
+ #### GuardIfPresent
525
+
526
+ <a id="api-guardifpresent"></a>
527
+
528
+ ```typescript
529
+ export interface GuardIfPresent<T extends number> extends TypedCheckedBounds
530
+ ```
531
+
532
+ #### IntegerGeneratorOptions
533
+
534
+ <a id="api-integergeneratoroptions"></a>
535
+
536
+ ```typescript
537
+ export interface IntegerGeneratorOptions
538
+ ```
539
+
540
+ #### NumberSetIsInt
541
+
542
+ <a id="api-numbersetisint"></a>
543
+
544
+ ```typescript
545
+ export interface NumberSetIsInt
546
+ ```
547
+
548
+ #### RandomBounded
549
+
550
+ <a id="api-randombounded"></a>
551
+
552
+ ```typescript
553
+ export interface RandomBounded<N extends number> extends TypedCheckedBounds
554
+ ```
555
+
556
+ #### RangedBounds
557
+
558
+ <a id="api-rangedbounds"></a>
559
+
560
+ ```typescript
561
+ export interface RangedBounds extends DefinedBounds
562
+ ```
563
+
564
+ #### RangeLike
565
+
566
+ <a id="api-rangelike"></a>
567
+
568
+ ```typescript
569
+ export interface RangeLike<T>
570
+ ```
571
+
572
+ #### ReboundAllowUndef
573
+
574
+ <a id="api-reboundallowundef"></a>
575
+
576
+ ```typescript
577
+ export interface ReboundAllowUndef
578
+ ```
579
+
580
+ #### Rebounded
581
+
582
+ <a id="api-rebounded"></a>
583
+
584
+ ```typescript
585
+ export interface Rebounded<Range extends BoundsLabel<BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>>, LowerInc extends LowerInEx, Lower extends number, Int extends NumberSet, Upper extends number, UpperInc extends UpperInEx>
586
+ ```
587
+
588
+ Nice, short, human-readable signature which will show up in the IDE.
589
+
590
+
591
+ #### ReboundedFromChecked
592
+
593
+ <a id="api-reboundedfromchecked"></a>
594
+
595
+ ```typescript
596
+ export interface ReboundedFromChecked<IsLowerInc extends boolean, Lower extends number, IsInt extends boolean, Upper extends number, IsUpperInc extends boolean> extends Rebounded<BoundsLabel<DefinedFromChecked<IsLowerInc, Lower, IsInt, Upper, IsUpperInc>>, LowerInExFrom<IsLowerInc>, Lower, NumberSetFrom<IsInt>, Upper, UpperInExFrom<IsUpperInc>>
597
+ ```
598
+
599
+ #### ReboundedFromConfig
600
+
601
+ <a id="api-reboundedfromconfig"></a>
602
+
603
+ ```typescript
604
+ export interface ReboundedFromConfig<LowerInc extends LowerInEx, Lower extends number, Int extends NumberSet, Upper extends number, UpperInc extends UpperInEx> extends Rebounded<BoundsLabel<BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>>, LowerInc, Lower, Int, Upper, UpperInc>
605
+ ```
606
+
607
+ #### ReboundFnOptions
608
+
609
+ <a id="api-reboundfnoptions"></a>
610
+
611
+ ```typescript
612
+ export interface ReboundFnOptions
613
+ ```
614
+
615
+ #### ReboundRandomOptions
616
+
617
+ <a id="api-reboundrandomoptions"></a>
618
+
619
+ ```typescript
620
+ export interface ReboundRandomOptions
621
+ ```
622
+
623
+ #### ReboundToIntOptions
624
+
625
+ <a id="api-reboundtointoptions"></a>
626
+
627
+ ```typescript
628
+ export interface ReboundToIntOptions extends ReboundFnOptions
629
+ ```
630
+
631
+ #### ResolvedFnOptions
632
+
633
+ <a id="api-resolvedfnoptions"></a>
634
+
635
+ ```typescript
636
+ export interface ResolvedFnOptions extends Required<ReboundFnOptions>
637
+ ```
638
+
639
+ #### ResolvedToIntOptions
640
+
641
+ <a id="api-resolvedtointoptions"></a>
642
+
643
+ ```typescript
644
+ export interface ResolvedToIntOptions extends Required<ReboundToIntOptions>
645
+ ```
646
+
647
+ #### ScaleExact
648
+
649
+ <a id="api-scaleexact"></a>
650
+
651
+ ```typescript
652
+ export interface ScaleExact<Input extends number, Output extends number> extends TypedCheckedBounds
653
+ ```
654
+
655
+ #### ScaleIfPresent
656
+
657
+ <a id="api-scaleifpresent"></a>
658
+
659
+ ```typescript
660
+ export interface ScaleIfPresent<Input extends number, Output extends number> extends TypedCheckedBounds
661
+ ```
662
+
663
+ #### TypedBounds
664
+
665
+ <a id="api-typedbounds"></a>
666
+
667
+ ```typescript
668
+ export interface TypedBounds extends RangedBounds
669
+ ```
670
+
671
+ #### TypedCheckedBounds
672
+
673
+ <a id="api-typedcheckedbounds"></a>
674
+
675
+ ```typescript
676
+ export interface TypedCheckedBounds extends CheckedBounds
677
+ ```
678
+
679
+ ### TypeAliases
680
+
681
+ #### BoundedNumber
682
+
683
+ <a id="api-boundednumber"></a>
684
+
685
+ ```typescript
686
+ type BoundedNumber<Bounds> = Bounds extends BoundsConfig<infer LowerInc, infer Lower, infer Int, infer Upper, infer UpperInc> ? (number & ReboundedFromConfig<LowerInc, Lower, Int, Upper, UpperInc>) : Bounds extends CheckedBoundsConfig<infer IsLowerInc extends boolean, infer Lower extends number, infer IsInt extends boolean, infer Upper extends number, infer IsUpperInc extends boolean> ? (number & ReboundedFromChecked<IsLowerInc, Lower, IsInt, Upper, IsUpperInc>) : never;
687
+ ```
688
+
689
+ Brand a number type with a type-generated explanation of its bounds, so that it can only accept other numbers with the exact same bounds.
690
+
691
+
692
+ #### BoundsLabel
693
+
694
+ <a id="api-boundslabel"></a>
695
+
696
+ ```typescript
697
+ type BoundsLabel<C extends DefinedBounds> = `${C extends {
698
+ lowerInc: infer LowerInc extends LowerInEx;
699
+ } ? LowerInc : never}${C extends {
700
+ lower: NegInfinity;
701
+ } ? NegInfinityLabel : C extends {
702
+ lower: infer Lower extends number;
703
+ } ? number extends Lower ? never : `${Lower}` : never}${C extends {
704
+ int: infer Int extends NumberSet;
705
+ } ? Int extends IntegerSet ? ".." : "," : never}${C extends {
706
+ upper: PosInfinity;
707
+ } ? PosInfinityLabel : C extends {
708
+ upper: infer Upper extends number;
709
+ } ? number extends Upper ? never : `${Upper}` : never}${C extends {
710
+ upperInc: infer UpperInc extends UpperInEx;
711
+ } ? UpperInc : never}`;
712
+ ```
713
+
714
+ #### BoundType
715
+
716
+ <a id="api-boundtype"></a>
717
+
718
+ ```typescript
719
+ type BoundType = typeof BOUND_GT | typeof BOUND_GTE | typeof BOUND_LT | typeof BOUND_LTE;
720
+ ```
721
+
722
+ #### If
723
+
724
+ <a id="api-if"></a>
725
+
726
+ ```typescript
727
+ type If<IfPresent extends boolean | undefined, T, U> = IfPresent extends true ? T : U;
728
+ ```
729
+
730
+ #### IfIfPresent
731
+
732
+ <a id="api-ififpresent"></a>
733
+
734
+ ```typescript
735
+ type IfIfPresent<IfPresent extends boolean, T> = IfPresent extends true ? (T | null | undefined) : T;
736
+ ```
737
+
738
+ #### InfinityBound
739
+
740
+ <a id="api-infinitybound"></a>
741
+
742
+ ```typescript
743
+ type InfinityBound = number & {
744
+ infinity: string;
745
+ };
746
+ ```
747
+
748
+ #### Int255
749
+
750
+ <a id="api-int255"></a>
751
+
752
+ ```typescript
753
+ type Int255 = typeof int255.numberType;
754
+ ```
755
+
756
+ An integer in the range [0,255].
757
+
758
+
759
+ #### Int360
760
+
761
+ <a id="api-int360"></a>
762
+
763
+ ```typescript
764
+ type Int360 = typeof int360.numberType;
765
+ ```
766
+
767
+ An integer in the range [0,360).
768
+
769
+
770
+ #### IntegerSet
771
+
772
+ <a id="api-integerset"></a>
773
+
774
+ ```typescript
775
+ type IntegerSet = "int";
776
+ ```
777
+
778
+ #### IntStrategy
779
+
780
+ <a id="api-intstrategy"></a>
781
+
782
+ ```typescript
783
+ type IntStrategy = typeof ROUND | typeof CEIL | typeof TRUNC | typeof FLOOR | ((value: number) => number);
784
+ ```
785
+
786
+ #### IsBounded
787
+
788
+ <a id="api-isbounded"></a>
789
+
790
+ ```typescript
791
+ type IsBounded<N extends number> = N extends {
792
+ [BOUNDS]: object;
793
+ } ? true : false;
794
+ ```
795
+
796
+ Helper for checking if you're dealing with a [BoundedNumber](#api-boundednumber).
797
+
798
+
799
+ #### IsFinite
800
+
801
+ <a id="api-isfinite"></a>
802
+
803
+ ```typescript
804
+ type IsFinite<N extends number> = N extends {
805
+ [BOUNDS]: {
806
+ lower: infer Lower extends number;
807
+ upper: infer Upper extends number;
808
+ };
809
+ } ? Lower extends InfinityBound ? false : Upper extends InfinityBound ? false : true : never;
810
+ ```
811
+
812
+ Whether the number has defined bounds (neither upper nor lower is infinite).
813
+
814
+
815
+ #### IsInclusive
816
+
817
+ <a id="api-isinclusive"></a>
818
+
819
+ ```typescript
820
+ type IsInclusive<Inc extends UpperInEx | LowerInEx> = BoundIsInclusive[Inc];
821
+ ```
822
+
823
+ #### IsInfinite
824
+
825
+ <a id="api-isinfinite"></a>
826
+
827
+ ```typescript
828
+ type IsInfinite<N extends number> = N extends {
829
+ [BOUNDS]: {
830
+ lower: infer Lower extends number;
831
+ upper: infer Upper extends number;
832
+ };
833
+ } ? Lower extends InfinityBound ? true : Upper extends InfinityBound ? true : false : never;
834
+ ```
835
+
836
+ Whether the number has infinite bounds, either upper or lower.
837
+
838
+
839
+ #### IsIntegersOnly
840
+
841
+ <a id="api-isintegersonly"></a>
842
+
843
+ ```typescript
844
+ type IsIntegersOnly<N extends number> = N extends {
845
+ [BOUNDS]: {
846
+ int: IntegerSet;
847
+ };
848
+ } ? true : false;
849
+ ```
850
+
851
+ Extract whether the number only accepts integers.
852
+
853
+
854
+ #### IsIntFrom
855
+
856
+ <a id="api-isintfrom"></a>
857
+
858
+ ```typescript
859
+ type IsIntFrom<Int extends NumberSet> = NumberSetIsInt[Int];
860
+ ```
861
+
862
+ #### LowerBound
863
+
864
+ <a id="api-lowerbound"></a>
865
+
866
+ ```typescript
867
+ type LowerBound<N extends number> = N extends {
868
+ [BOUNDS]: {
869
+ lower: infer Lower extends number;
870
+ };
871
+ } ? Lower : never;
872
+ ```
873
+
874
+ Extract the value for the lower bound.
875
+
876
+
877
+ #### LowerBoundIsInc
878
+
879
+ <a id="api-lowerboundisinc"></a>
880
+
881
+ ```typescript
882
+ type LowerBoundIsInc<N extends number> = N extends {
883
+ [BOUNDS]: {
884
+ lowerInc: infer LowerInc extends LowerInEx;
885
+ };
886
+ } ? LowerInc extends LowerInclusive ? true : false : never;
887
+ ```
888
+
889
+ Extract whether the lower bound is inclusive (true) or exclusive (false).
890
+
891
+
892
+ #### LowerExclusive
893
+
894
+ <a id="api-lowerexclusive"></a>
895
+
896
+ ```typescript
897
+ type LowerExclusive = "(";
898
+ ```
899
+
900
+ #### LowerInclusive
901
+
902
+ <a id="api-lowerinclusive"></a>
903
+
904
+ ```typescript
905
+ type LowerInclusive = "[";
906
+ ```
907
+
908
+ #### LowerInEx
909
+
910
+ <a id="api-lowerinex"></a>
911
+
912
+ ```typescript
913
+ type LowerInEx = LowerInclusive | LowerExclusive;
914
+ ```
915
+
916
+ #### LowerInExFrom
917
+
918
+ <a id="api-lowerinexfrom"></a>
919
+
920
+ ```typescript
921
+ type LowerInExFrom<B extends boolean> = boolean extends B ? never : true extends B ? LowerInclusive : LowerExclusive;
922
+ ```
923
+
924
+ #### NegInfinity
925
+
926
+ <a id="api-neginfinity"></a>
927
+
928
+ ```typescript
929
+ type NegInfinity = number & {
930
+ infinity: NegInfinityLabel;
931
+ };
932
+ ```
933
+
934
+ #### NegInfinityLabel
935
+
936
+ <a id="api-neginfinitylabel"></a>
937
+
938
+ ```typescript
939
+ type NegInfinityLabel = "-∞";
940
+ ```
941
+
942
+ #### NumberSet
943
+
944
+ <a id="api-numberset"></a>
945
+
946
+ ```typescript
947
+ type NumberSet = IntegerSet | RealSet;
948
+ ```
949
+
950
+ #### NumberSetFrom
951
+
952
+ <a id="api-numbersetfrom"></a>
953
+
954
+ ```typescript
955
+ type NumberSetFrom<B extends boolean> = boolean extends B ? never : true extends B ? IntegerSet : RealSet;
956
+ ```
957
+
958
+ #### OutOfBoundsErrorProvider
959
+
960
+ <a id="api-outofboundserrorprovider"></a>
961
+
962
+ ```typescript
963
+ type OutOfBoundsErrorProvider = (value: unknown, name?: string | undefined) => Error;
964
+ ```
965
+
966
+ #### PosInfinity
967
+
968
+ <a id="api-posinfinity"></a>
969
+
970
+ ```typescript
971
+ type PosInfinity = number & {
972
+ infinity: PosInfinityLabel;
973
+ };
974
+ ```
975
+
976
+ #### PosInfinityLabel
977
+
978
+ <a id="api-posinfinitylabel"></a>
979
+
980
+ ```typescript
981
+ type PosInfinityLabel = "+∞";
982
+ ```
983
+
984
+ #### Real01
985
+
986
+ <a id="api-real01"></a>
987
+
988
+ ```typescript
989
+ type Real01 = typeof real01.numberType;
990
+ ```
991
+
992
+ A real number in the range [0,1].
993
+
994
+
995
+ #### Real255
996
+
997
+ <a id="api-real255"></a>
998
+
999
+ ```typescript
1000
+ type Real255 = typeof real255.numberType;
1001
+ ```
1002
+
1003
+ A real number in the range [0,255].
1004
+
1005
+
1006
+ #### Real360
1007
+
1008
+ <a id="api-real360"></a>
1009
+
1010
+ ```typescript
1011
+ type Real360 = typeof real360.numberType;
1012
+ ```
1013
+
1014
+ A number in the range [0,360).
1015
+
1016
+
1017
+ #### RealSet
1018
+
1019
+ <a id="api-realset"></a>
1020
+
1021
+ ```typescript
1022
+ type RealSet = "real";
1023
+ ```
1024
+
1025
+ #### ReboundConfigBuilder
1026
+
1027
+ <a id="api-reboundconfigbuilder"></a>
1028
+
1029
+ ```typescript
1030
+ type ReboundConfigBuilder<LowerInc extends LowerInEx, Lower extends number, Int extends NumberSet, Upper extends number, UpperInc extends UpperInEx> = {
1031
+ readonly config: BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>;
1032
+ } & IsCompleteConfig<LowerInc, Lower, Int, Upper, UpperInc> extends true ? {
1033
+ build(): Rebound<BoundedNumber<BoundsConfig<LowerInc, Lower, Int, Upper, UpperInc>>>;
1034
+ } : ((number extends Lower ? {
1035
+ fromExclusive<L extends number>(value: L): ReboundConfigBuilder<LowerExclusive, L, Int, Upper, UpperInc>;
1036
+ fromInclusive<L extends number>(value: L): ReboundConfigBuilder<LowerInclusive, L, Int, Upper, UpperInc>;
1037
+ fromNegInfinity(): ReboundConfigBuilder<LowerInExFrom<true>, NegInfinity, Int, Upper, UpperInc>;
1038
+ fromValue<L extends number, LI extends boolean>(value: L, inclusive: LI): ReboundConfigBuilder<LowerInExFrom<LI>, L, Int, Upper, UpperInc>;
1039
+ } : object) & (NumberSet extends Int ? {
1040
+ intOnly<IR extends boolean>(int: IR): ReboundConfigBuilder<LowerInc, Lower, NumberSetFrom<IR>, Upper, UpperInc>;
1041
+ integers(): ReboundConfigBuilder<LowerInc, Lower, IntegerSet, Upper, UpperInc>;
1042
+ reals(): ReboundConfigBuilder<LowerInc, Lower, RealSet, Upper, UpperInc>;
1043
+ } : object) & (number extends Upper ? {
1044
+ toExclusive<U extends number>(value: U): ReboundConfigBuilder<LowerInc, Lower, Int, U, UpperExclusive>;
1045
+ toInclusive<U extends number>(value: U): ReboundConfigBuilder<LowerInc, Lower, Int, U, UpperInclusive>;
1046
+ toPosInfinity(): ReboundConfigBuilder<LowerInc, Lower, Int, PosInfinity, UpperInExFrom<true>>;
1047
+ toValue<U extends number, UI extends boolean>(value: U, inclusive: UI): ReboundConfigBuilder<LowerInc, Lower, Int, U, UpperInExFrom<UI>>;
1048
+ } : object));
1049
+ ```
1050
+
1051
+ #### ToInt
1052
+
1053
+ <a id="api-toint"></a>
1054
+
1055
+ ```typescript
1056
+ type ToInt<N> = (this: void, value: number, name?: string | undefined) => N;
1057
+ ```
1058
+
1059
+ #### Unbound
1060
+
1061
+ <a id="api-unbound"></a>
1062
+
1063
+ ```typescript
1064
+ type Unbound<N extends number> = IsBounded<N> extends true ? number : N;
1065
+ ```
1066
+
1067
+ You could also just cast to `number`, but this provides a nice explicit and hard-to-miss visual. It is also helpful in downstream type definitions where you need the bound types to be fungible.
1068
+
1069
+
1070
+ #### Unbounded
1071
+
1072
+ <a id="api-unbounded"></a>
1073
+
1074
+ ```typescript
1075
+ type Unbounded = typeof unbounded;
1076
+ ```
1077
+
1078
+ #### UpperBound
1079
+
1080
+ <a id="api-upperbound"></a>
1081
+
1082
+ ```typescript
1083
+ type UpperBound<N extends number> = N extends {
1084
+ [BOUNDS]: {
1085
+ upper: infer Upper extends number;
1086
+ };
1087
+ } ? Upper : never;
1088
+ ```
1089
+
1090
+ Extract the value for the upper bound.
1091
+
1092
+
1093
+ #### UpperBoundIsInc
1094
+
1095
+ <a id="api-upperboundisinc"></a>
1096
+
1097
+ ```typescript
1098
+ type UpperBoundIsInc<N extends number> = N extends {
1099
+ [BOUNDS]: {
1100
+ upperInc: infer UpperInc extends UpperInEx;
1101
+ };
1102
+ } ? UpperInc extends UpperInclusive ? true : false : never;
1103
+ ```
1104
+
1105
+ Extract whether the lower bound is inclusive (true) or exclusive (false).
1106
+
1107
+
1108
+ #### UpperExclusive
1109
+
1110
+ <a id="api-upperexclusive"></a>
1111
+
1112
+ ```typescript
1113
+ type UpperExclusive = ")";
1114
+ ```
1115
+
1116
+ #### UpperInclusive
1117
+
1118
+ <a id="api-upperinclusive"></a>
1119
+
1120
+ ```typescript
1121
+ type UpperInclusive = "]";
1122
+ ```
1123
+
1124
+ #### UpperInEx
1125
+
1126
+ <a id="api-upperinex"></a>
1127
+
1128
+ ```typescript
1129
+ type UpperInEx = UpperInclusive | UpperExclusive;
1130
+ ```
1131
+
1132
+ #### UpperInExFrom
1133
+
1134
+ <a id="api-upperinexfrom"></a>
1135
+
1136
+ ```typescript
1137
+ type UpperInExFrom<B extends boolean> = boolean extends B ? never : true extends B ? UpperInclusive : UpperExclusive;
1138
+ ```
1139
+
1140
+ ### Variables
1141
+
1142
+ #### assertInt255
1143
+
1144
+ <a id="api-assertint255"></a>
1145
+
1146
+ ```typescript
1147
+ assertInt255: import("./assert-bounded.js").AssertExact<never>
1148
+ ```
1149
+
1150
+ #### assertInt360
1151
+
1152
+ <a id="api-assertint360"></a>
1153
+
1154
+ ```typescript
1155
+ assertInt360: import("./assert-bounded.js").AssertExact<never>
1156
+ ```
1157
+
1158
+ #### assertReal01
1159
+
1160
+ <a id="api-assertreal01"></a>
1161
+
1162
+ ```typescript
1163
+ assertReal01: import("./assert-bounded.js").AssertExact<never>
1164
+ ```
1165
+
1166
+ #### assertReal255
1167
+
1168
+ <a id="api-assertreal255"></a>
1169
+
1170
+ ```typescript
1171
+ assertReal255: import("./assert-bounded.js").AssertExact<never>
1172
+ ```
1173
+
1174
+ #### assertReal360
1175
+
1176
+ <a id="api-assertreal360"></a>
1177
+
1178
+ ```typescript
1179
+ assertReal360: import("./assert-bounded.js").AssertExact<never>
1180
+ ```
1181
+
1182
+ #### BOUND_GT
1183
+
1184
+ <a id="api-bound-gt"></a>
1185
+
1186
+ ```typescript
1187
+ BOUND_GT = ">"
1188
+ ```
1189
+
1190
+ #### BOUND_GTE
1191
+
1192
+ <a id="api-bound-gte"></a>
1193
+
1194
+ ```typescript
1195
+ BOUND_GTE = ">="
1196
+ ```
1197
+
1198
+ #### BOUND_LT
1199
+
1200
+ <a id="api-bound-lt"></a>
1201
+
1202
+ ```typescript
1203
+ BOUND_LT = "<"
1204
+ ```
1205
+
1206
+ #### BOUND_LTE
1207
+
1208
+ <a id="api-bound-lte"></a>
1209
+
1210
+ ```typescript
1211
+ BOUND_LTE = "<="
1212
+ ```
1213
+
1214
+ #### BOUND_TYPES
1215
+
1216
+ <a id="api-bound-types"></a>
1217
+
1218
+ ```typescript
1219
+ BOUND_TYPES: Readonly<BoundType[]>
1220
+ ```
1221
+
1222
+ #### BOUNDS
1223
+
1224
+ <a id="api-bounds"></a>
1225
+
1226
+ ```typescript
1227
+ BOUNDS: unique symbol
1228
+ ```
1229
+
1230
+ #### boundTypeComparator
1231
+
1232
+ <a id="api-boundtypecomparator"></a>
1233
+
1234
+ ```typescript
1235
+ boundTypeComparator: Comparator<BoundType>
1236
+ ```
1237
+
1238
+ #### boundTypeComparisonIsValid
1239
+
1240
+ <a id="api-boundtypecomparisonisvalid"></a>
1241
+
1242
+ ```typescript
1243
+ boundTypeComparisonIsValid: Readonly<Record<BoundType, (comparison: number) => boolean>>
1244
+ ```
1245
+
1246
+ #### CEIL
1247
+
1248
+ <a id="api-ceil"></a>
1249
+
1250
+ ```typescript
1251
+ CEIL = "ceil"
1252
+ ```
1253
+
1254
+ #### FLOOR
1255
+
1256
+ <a id="api-floor"></a>
1257
+
1258
+ ```typescript
1259
+ FLOOR = "floor"
1260
+ ```
1261
+
1262
+ #### INT_SET
1263
+
1264
+ <a id="api-int-set"></a>
1265
+
1266
+ ```typescript
1267
+ INT_SET: IntegerSet
1268
+ ```
1269
+
1270
+ #### int255
1271
+
1272
+ <a id="api-int255"></a>
1273
+
1274
+ ```typescript
1275
+ int255: Rebound<number & import("./spec.js").ReboundedFromConfig<"[", 0, "int", 255, "]">>
1276
+ ```
1277
+
1278
+ #### int360
1279
+
1280
+ <a id="api-int360"></a>
1281
+
1282
+ ```typescript
1283
+ int360: Rebound<number & import("./spec.js").ReboundedFromConfig<"[", 0, "int", 359, "]">>
1284
+ ```
1285
+
1286
+ #### isInt255
1287
+
1288
+ <a id="api-isint255"></a>
1289
+
1290
+ ```typescript
1291
+ isInt255: import("./guard-bounded.js").GuardExact<number & import("./spec.js").ReboundedFromConfig<"[", 0, "int", 255, "]">>
1292
+ ```
1293
+
1294
+ #### isInt360
1295
+
1296
+ <a id="api-isint360"></a>
1297
+
1298
+ ```typescript
1299
+ isInt360: import("./guard-bounded.js").GuardExact<number & import("./spec.js").ReboundedFromConfig<"[", 0, "int", 359, "]">>
1300
+ ```
1301
+
1302
+ #### isReal01
1303
+
1304
+ <a id="api-isreal01"></a>
1305
+
1306
+ ```typescript
1307
+ isReal01: import("./guard-bounded.js").GuardExact<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 1, "]">>
1308
+ ```
1309
+
1310
+ #### isReal255
1311
+
1312
+ <a id="api-isreal255"></a>
1313
+
1314
+ ```typescript
1315
+ isReal255: import("./guard-bounded.js").GuardExact<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 255, "]">>
1316
+ ```
1317
+
1318
+ #### isReal360
1319
+
1320
+ <a id="api-isreal360"></a>
1321
+
1322
+ ```typescript
1323
+ isReal360: import("./guard-bounded.js").GuardExact<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 360, ")">>
1324
+ ```
1325
+
1326
+ #### LOWER_EX
1327
+
1328
+ <a id="api-lower-ex"></a>
1329
+
1330
+ ```typescript
1331
+ LOWER_EX: LowerExclusive
1332
+ ```
1333
+
1334
+ #### LOWER_IN
1335
+
1336
+ <a id="api-lower-in"></a>
1337
+
1338
+ ```typescript
1339
+ LOWER_IN: LowerInclusive
1340
+ ```
1341
+
1342
+ #### REAL_SET
1343
+
1344
+ <a id="api-real-set"></a>
1345
+
1346
+ ```typescript
1347
+ REAL_SET: RealSet
1348
+ ```
1349
+
1350
+ #### real01
1351
+
1352
+ <a id="api-real01"></a>
1353
+
1354
+ ```typescript
1355
+ real01: Rebound<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 1, "]">>
1356
+ ```
1357
+
1358
+ #### real255
1359
+
1360
+ <a id="api-real255"></a>
1361
+
1362
+ ```typescript
1363
+ real255: Rebound<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 255, "]">>
1364
+ ```
1365
+
1366
+ #### real360
1367
+
1368
+ <a id="api-real360"></a>
1369
+
1370
+ ```typescript
1371
+ real360: Rebound<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 360, ")">>
1372
+ ```
1373
+
1374
+ #### ROUND
1375
+
1376
+ <a id="api-round"></a>
1377
+
1378
+ ```typescript
1379
+ ROUND = "round"
1380
+ ```
1381
+
1382
+ #### toInt255
1383
+
1384
+ <a id="api-toint255"></a>
1385
+
1386
+ ```typescript
1387
+ toInt255: import("./from-number-bounded.js").FromNumberIfPresent<number & import("./spec.js").ReboundedFromConfig<"[", 0, "int", 255, "]">>
1388
+ ```
1389
+
1390
+ #### toInt360
1391
+
1392
+ <a id="api-toint360"></a>
1393
+
1394
+ ```typescript
1395
+ toInt360: import("./from-number-bounded.js").FromNumberIfPresent<number & import("./spec.js").ReboundedFromConfig<"[", 0, "int", 359, "]">>
1396
+ ```
1397
+
1398
+ #### toReal01
1399
+
1400
+ <a id="api-toreal01"></a>
1401
+
1402
+ ```typescript
1403
+ toReal01: import("./from-number-bounded.js").FromNumberIfPresent<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 1, "]">>
1404
+ ```
1405
+
1406
+ #### toReal255
1407
+
1408
+ <a id="api-toreal255"></a>
1409
+
1410
+ ```typescript
1411
+ toReal255: import("./from-number-bounded.js").FromNumberIfPresent<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 255, "]">>
1412
+ ```
1413
+
1414
+ #### toReal360
1415
+
1416
+ <a id="api-toreal360"></a>
1417
+
1418
+ ```typescript
1419
+ toReal360: import("./from-number-bounded.js").FromNumberIfPresent<number & import("./spec.js").ReboundedFromConfig<"[", 0, "real", 360, ")">>
1420
+ ```
1421
+
1422
+ #### TRUNC
1423
+
1424
+ <a id="api-trunc"></a>
1425
+
1426
+ ```typescript
1427
+ TRUNC = "trunc"
1428
+ ```
1429
+
1430
+ #### TYPED_BOUNDS_KEYS
1431
+
1432
+ <a id="api-typed-bounds-keys"></a>
1433
+
1434
+ ```typescript
1435
+ TYPED_BOUNDS_KEYS: (keyof TypedBounds)[]
1436
+ ```
1437
+
1438
+ #### TYPED_CHECKED_BOUNDS_KEYS
1439
+
1440
+ <a id="api-typed-checked-bounds-keys"></a>
1441
+
1442
+ ```typescript
1443
+ TYPED_CHECKED_BOUNDS_KEYS: (keyof TypedCheckedBounds)[]
1444
+ ```
1445
+
1446
+ #### unbounded
1447
+
1448
+ <a id="api-unbounded"></a>
1449
+
1450
+ ```typescript
1451
+ unbounded: unique symbol
1452
+ ```
1453
+
1454
+ #### UPPER_EX
1455
+
1456
+ <a id="api-upper-ex"></a>
1457
+
1458
+ ```typescript
1459
+ UPPER_EX: UpperExclusive
1460
+ ```
1461
+
1462
+ #### UPPER_IN
1463
+
1464
+ <a id="api-upper-in"></a>
1465
+
1466
+ ```typescript
1467
+ UPPER_IN: UpperInclusive
1468
+ ```
1469
+