ts-data-forge 1.0.0 → 1.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 (292) hide show
  1. package/README.md +1 -1
  2. package/dist/array/array-utils.d.mts +2617 -0
  3. package/dist/array/array-utils.d.mts.map +1 -0
  4. package/dist/array/array-utils.mjs +2915 -0
  5. package/dist/array/array-utils.mjs.map +1 -0
  6. package/dist/array/index.d.mts +3 -0
  7. package/dist/array/index.d.mts.map +1 -0
  8. package/dist/array/index.mjs +3 -0
  9. package/dist/array/index.mjs.map +1 -0
  10. package/dist/array/tuple-utils.d.mts +421 -0
  11. package/dist/array/tuple-utils.d.mts.map +1 -0
  12. package/dist/array/tuple-utils.mjs +391 -0
  13. package/dist/array/tuple-utils.mjs.map +1 -0
  14. package/dist/collections/imap-mapped.d.mts +445 -0
  15. package/dist/collections/imap-mapped.d.mts.map +1 -0
  16. package/dist/collections/imap-mapped.mjs +424 -0
  17. package/dist/collections/imap-mapped.mjs.map +1 -0
  18. package/dist/collections/imap.d.mts +359 -0
  19. package/dist/collections/imap.d.mts.map +1 -0
  20. package/dist/collections/imap.mjs +338 -0
  21. package/dist/collections/imap.mjs.map +1 -0
  22. package/dist/collections/index.d.mts +7 -0
  23. package/dist/collections/index.d.mts.map +1 -0
  24. package/dist/collections/index.mjs +7 -0
  25. package/dist/collections/index.mjs.map +1 -0
  26. package/dist/collections/iset-mapped.d.mts +576 -0
  27. package/dist/collections/iset-mapped.d.mts.map +1 -0
  28. package/dist/collections/iset-mapped.mjs +522 -0
  29. package/dist/collections/iset-mapped.mjs.map +1 -0
  30. package/dist/collections/iset.d.mts +426 -0
  31. package/dist/collections/iset.d.mts.map +1 -0
  32. package/dist/collections/iset.mjs +437 -0
  33. package/dist/collections/iset.mjs.map +1 -0
  34. package/dist/collections/queue.d.mts +190 -0
  35. package/dist/collections/queue.d.mts.map +1 -0
  36. package/dist/collections/queue.mjs +317 -0
  37. package/dist/collections/queue.mjs.map +1 -0
  38. package/dist/collections/stack.d.mts +210 -0
  39. package/dist/collections/stack.d.mts.map +1 -0
  40. package/dist/collections/stack.mjs +353 -0
  41. package/dist/collections/stack.mjs.map +1 -0
  42. package/dist/expect-type.d.mts +199 -0
  43. package/dist/expect-type.d.mts.map +1 -0
  44. package/dist/expect-type.mjs +201 -0
  45. package/dist/expect-type.mjs.map +1 -0
  46. package/dist/functional/index.d.mts +5 -0
  47. package/dist/functional/index.d.mts.map +1 -0
  48. package/dist/functional/index.mjs +5 -0
  49. package/dist/functional/index.mjs.map +1 -0
  50. package/dist/functional/match.d.mts +215 -0
  51. package/dist/functional/match.d.mts.map +1 -0
  52. package/dist/functional/match.mjs +139 -0
  53. package/dist/functional/match.mjs.map +1 -0
  54. package/dist/functional/optional.d.mts +517 -0
  55. package/dist/functional/optional.d.mts.map +1 -0
  56. package/dist/functional/optional.mjs +532 -0
  57. package/dist/functional/optional.mjs.map +1 -0
  58. package/dist/functional/pipe.d.mts +185 -0
  59. package/dist/functional/pipe.d.mts.map +1 -0
  60. package/dist/functional/pipe.mjs +129 -0
  61. package/dist/functional/pipe.mjs.map +1 -0
  62. package/dist/functional/result.d.mts +796 -0
  63. package/dist/functional/result.d.mts.map +1 -0
  64. package/dist/functional/result.mjs +844 -0
  65. package/dist/functional/result.mjs.map +1 -0
  66. package/dist/globals.d.mts +38 -0
  67. package/dist/guard/has-key.d.mts +100 -0
  68. package/dist/guard/has-key.d.mts.map +1 -0
  69. package/dist/guard/has-key.mjs +94 -0
  70. package/dist/guard/has-key.mjs.map +1 -0
  71. package/dist/guard/index.d.mts +8 -0
  72. package/dist/guard/index.d.mts.map +1 -0
  73. package/dist/guard/index.mjs +8 -0
  74. package/dist/guard/index.mjs.map +1 -0
  75. package/dist/guard/is-non-empty-string.d.mts +106 -0
  76. package/dist/guard/is-non-empty-string.d.mts.map +1 -0
  77. package/dist/guard/is-non-empty-string.mjs +108 -0
  78. package/dist/guard/is-non-empty-string.mjs.map +1 -0
  79. package/dist/guard/is-non-null-object.d.mts +105 -0
  80. package/dist/guard/is-non-null-object.d.mts.map +1 -0
  81. package/dist/guard/is-non-null-object.mjs +108 -0
  82. package/dist/guard/is-non-null-object.mjs.map +1 -0
  83. package/dist/guard/is-primitive.d.mts +146 -0
  84. package/dist/guard/is-primitive.d.mts.map +1 -0
  85. package/dist/guard/is-primitive.mjs +161 -0
  86. package/dist/guard/is-primitive.mjs.map +1 -0
  87. package/dist/guard/is-record.d.mts +151 -0
  88. package/dist/guard/is-record.d.mts.map +1 -0
  89. package/dist/guard/is-record.mjs +155 -0
  90. package/dist/guard/is-record.mjs.map +1 -0
  91. package/dist/guard/is-type.d.mts +430 -0
  92. package/dist/guard/is-type.d.mts.map +1 -0
  93. package/dist/guard/is-type.mjs +432 -0
  94. package/dist/guard/is-type.mjs.map +1 -0
  95. package/dist/guard/key-is-in.d.mts +158 -0
  96. package/dist/guard/key-is-in.d.mts.map +1 -0
  97. package/dist/guard/key-is-in.mjs +160 -0
  98. package/dist/guard/key-is-in.mjs.map +1 -0
  99. package/dist/index.d.mts +11 -0
  100. package/dist/index.d.mts.map +1 -0
  101. package/dist/index.mjs +61 -0
  102. package/dist/index.mjs.map +1 -0
  103. package/dist/iterator/index.d.mts +2 -0
  104. package/dist/iterator/index.d.mts.map +1 -0
  105. package/dist/iterator/index.mjs +2 -0
  106. package/dist/iterator/index.mjs.map +1 -0
  107. package/dist/iterator/range.d.mts +97 -0
  108. package/dist/iterator/range.d.mts.map +1 -0
  109. package/dist/iterator/range.mjs +130 -0
  110. package/dist/iterator/range.mjs.map +1 -0
  111. package/dist/json/index.d.mts +2 -0
  112. package/dist/json/index.d.mts.map +1 -0
  113. package/dist/json/index.mjs +2 -0
  114. package/dist/json/index.mjs.map +1 -0
  115. package/dist/json/json.d.mts +597 -0
  116. package/dist/json/json.d.mts.map +1 -0
  117. package/dist/json/json.mjs +687 -0
  118. package/dist/json/json.mjs.map +1 -0
  119. package/dist/number/branded-types/finite-number.d.mts +291 -0
  120. package/dist/number/branded-types/finite-number.d.mts.map +1 -0
  121. package/dist/number/branded-types/finite-number.mjs +296 -0
  122. package/dist/number/branded-types/finite-number.mjs.map +1 -0
  123. package/dist/number/branded-types/index.d.mts +27 -0
  124. package/dist/number/branded-types/index.d.mts.map +1 -0
  125. package/dist/number/branded-types/index.mjs +27 -0
  126. package/dist/number/branded-types/index.mjs.map +1 -0
  127. package/dist/number/branded-types/int.d.mts +242 -0
  128. package/dist/number/branded-types/int.d.mts.map +1 -0
  129. package/dist/number/branded-types/int.mjs +239 -0
  130. package/dist/number/branded-types/int.mjs.map +1 -0
  131. package/dist/number/branded-types/int16.d.mts +162 -0
  132. package/dist/number/branded-types/int16.d.mts.map +1 -0
  133. package/dist/number/branded-types/int16.mjs +141 -0
  134. package/dist/number/branded-types/int16.mjs.map +1 -0
  135. package/dist/number/branded-types/int32.d.mts +155 -0
  136. package/dist/number/branded-types/int32.d.mts.map +1 -0
  137. package/dist/number/branded-types/int32.mjs +142 -0
  138. package/dist/number/branded-types/int32.mjs.map +1 -0
  139. package/dist/number/branded-types/non-negative-finite-number.d.mts +165 -0
  140. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -0
  141. package/dist/number/branded-types/non-negative-finite-number.mjs +160 -0
  142. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -0
  143. package/dist/number/branded-types/non-negative-int16.d.mts +160 -0
  144. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -0
  145. package/dist/number/branded-types/non-negative-int16.mjs +138 -0
  146. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -0
  147. package/dist/number/branded-types/non-negative-int32.d.mts +156 -0
  148. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -0
  149. package/dist/number/branded-types/non-negative-int32.mjs +138 -0
  150. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -0
  151. package/dist/number/branded-types/non-zero-finite-number.d.mts +154 -0
  152. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -0
  153. package/dist/number/branded-types/non-zero-finite-number.mjs +160 -0
  154. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -0
  155. package/dist/number/branded-types/non-zero-int.d.mts +131 -0
  156. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -0
  157. package/dist/number/branded-types/non-zero-int.mjs +128 -0
  158. package/dist/number/branded-types/non-zero-int.mjs.map +1 -0
  159. package/dist/number/branded-types/non-zero-int16.d.mts +166 -0
  160. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -0
  161. package/dist/number/branded-types/non-zero-int16.mjs +145 -0
  162. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -0
  163. package/dist/number/branded-types/non-zero-int32.d.mts +158 -0
  164. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -0
  165. package/dist/number/branded-types/non-zero-int32.mjs +145 -0
  166. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -0
  167. package/dist/number/branded-types/non-zero-safe-int.d.mts +148 -0
  168. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -0
  169. package/dist/number/branded-types/non-zero-safe-int.mjs +145 -0
  170. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -0
  171. package/dist/number/branded-types/non-zero-uint16.d.mts +160 -0
  172. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -0
  173. package/dist/number/branded-types/non-zero-uint16.mjs +140 -0
  174. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -0
  175. package/dist/number/branded-types/non-zero-uint32.d.mts +156 -0
  176. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -0
  177. package/dist/number/branded-types/non-zero-uint32.mjs +140 -0
  178. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -0
  179. package/dist/number/branded-types/positive-finite-number.d.mts +171 -0
  180. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -0
  181. package/dist/number/branded-types/positive-finite-number.mjs +165 -0
  182. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -0
  183. package/dist/number/branded-types/positive-int.d.mts +270 -0
  184. package/dist/number/branded-types/positive-int.d.mts.map +1 -0
  185. package/dist/number/branded-types/positive-int.mjs +257 -0
  186. package/dist/number/branded-types/positive-int.mjs.map +1 -0
  187. package/dist/number/branded-types/positive-int16.d.mts +162 -0
  188. package/dist/number/branded-types/positive-int16.d.mts.map +1 -0
  189. package/dist/number/branded-types/positive-int16.mjs +139 -0
  190. package/dist/number/branded-types/positive-int16.mjs.map +1 -0
  191. package/dist/number/branded-types/positive-int32.d.mts +158 -0
  192. package/dist/number/branded-types/positive-int32.d.mts.map +1 -0
  193. package/dist/number/branded-types/positive-int32.mjs +139 -0
  194. package/dist/number/branded-types/positive-int32.mjs.map +1 -0
  195. package/dist/number/branded-types/positive-safe-int.d.mts +152 -0
  196. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -0
  197. package/dist/number/branded-types/positive-safe-int.mjs +138 -0
  198. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -0
  199. package/dist/number/branded-types/positive-uint16.d.mts +160 -0
  200. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -0
  201. package/dist/number/branded-types/positive-uint16.mjs +139 -0
  202. package/dist/number/branded-types/positive-uint16.mjs.map +1 -0
  203. package/dist/number/branded-types/positive-uint32.d.mts +156 -0
  204. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -0
  205. package/dist/number/branded-types/positive-uint32.mjs +139 -0
  206. package/dist/number/branded-types/positive-uint32.mjs.map +1 -0
  207. package/dist/number/branded-types/safe-int.d.mts +243 -0
  208. package/dist/number/branded-types/safe-int.d.mts.map +1 -0
  209. package/dist/number/branded-types/safe-int.mjs +240 -0
  210. package/dist/number/branded-types/safe-int.mjs.map +1 -0
  211. package/dist/number/branded-types/safe-uint.d.mts +151 -0
  212. package/dist/number/branded-types/safe-uint.d.mts.map +1 -0
  213. package/dist/number/branded-types/safe-uint.mjs +138 -0
  214. package/dist/number/branded-types/safe-uint.mjs.map +1 -0
  215. package/dist/number/branded-types/uint.d.mts +144 -0
  216. package/dist/number/branded-types/uint.d.mts.map +1 -0
  217. package/dist/number/branded-types/uint.mjs +132 -0
  218. package/dist/number/branded-types/uint.mjs.map +1 -0
  219. package/dist/number/branded-types/uint16.d.mts +157 -0
  220. package/dist/number/branded-types/uint16.d.mts.map +1 -0
  221. package/dist/number/branded-types/uint16.mjs +137 -0
  222. package/dist/number/branded-types/uint16.mjs.map +1 -0
  223. package/dist/number/branded-types/uint32.d.mts +185 -0
  224. package/dist/number/branded-types/uint32.d.mts.map +1 -0
  225. package/dist/number/branded-types/uint32.mjs +169 -0
  226. package/dist/number/branded-types/uint32.mjs.map +1 -0
  227. package/dist/number/enum/index.d.mts +3 -0
  228. package/dist/number/enum/index.d.mts.map +1 -0
  229. package/dist/number/enum/index.mjs +3 -0
  230. package/dist/number/enum/index.mjs.map +1 -0
  231. package/dist/number/enum/int8.d.mts +202 -0
  232. package/dist/number/enum/int8.d.mts.map +1 -0
  233. package/dist/number/enum/int8.mjs +296 -0
  234. package/dist/number/enum/int8.mjs.map +1 -0
  235. package/dist/number/enum/uint8.d.mts +128 -0
  236. package/dist/number/enum/uint8.d.mts.map +1 -0
  237. package/dist/number/enum/uint8.mjs +251 -0
  238. package/dist/number/enum/uint8.mjs.map +1 -0
  239. package/dist/number/index.d.mts +5 -0
  240. package/dist/number/index.d.mts.map +1 -0
  241. package/dist/number/index.mjs +31 -0
  242. package/dist/number/index.mjs.map +1 -0
  243. package/dist/number/num.d.mts +515 -0
  244. package/dist/number/num.d.mts.map +1 -0
  245. package/dist/number/num.mjs +513 -0
  246. package/dist/number/num.mjs.map +1 -0
  247. package/dist/number/refined-number-utils.d.mts +191 -0
  248. package/dist/number/refined-number-utils.d.mts.map +1 -0
  249. package/dist/number/refined-number-utils.mjs +179 -0
  250. package/dist/number/refined-number-utils.mjs.map +1 -0
  251. package/dist/object/index.d.mts +2 -0
  252. package/dist/object/index.d.mts.map +1 -0
  253. package/dist/object/index.mjs +2 -0
  254. package/dist/object/index.mjs.map +1 -0
  255. package/dist/object/object.d.mts +296 -0
  256. package/dist/object/object.d.mts.map +1 -0
  257. package/dist/object/object.mjs +295 -0
  258. package/dist/object/object.mjs.map +1 -0
  259. package/dist/others/cast-mutable.d.mts +110 -0
  260. package/dist/others/cast-mutable.d.mts.map +1 -0
  261. package/dist/others/cast-mutable.mjs +114 -0
  262. package/dist/others/cast-mutable.mjs.map +1 -0
  263. package/dist/others/cast-readonly.d.mts +189 -0
  264. package/dist/others/cast-readonly.d.mts.map +1 -0
  265. package/dist/others/cast-readonly.mjs +193 -0
  266. package/dist/others/cast-readonly.mjs.map +1 -0
  267. package/dist/others/if-then.d.mts +98 -0
  268. package/dist/others/if-then.d.mts.map +1 -0
  269. package/dist/others/if-then.mjs +100 -0
  270. package/dist/others/if-then.mjs.map +1 -0
  271. package/dist/others/index.d.mts +8 -0
  272. package/dist/others/index.d.mts.map +1 -0
  273. package/dist/others/index.mjs +8 -0
  274. package/dist/others/index.mjs.map +1 -0
  275. package/dist/others/map-nullable.d.mts +151 -0
  276. package/dist/others/map-nullable.d.mts.map +1 -0
  277. package/dist/others/map-nullable.mjs +159 -0
  278. package/dist/others/map-nullable.mjs.map +1 -0
  279. package/dist/others/memoize-function.d.mts +173 -0
  280. package/dist/others/memoize-function.d.mts.map +1 -0
  281. package/dist/others/memoize-function.mjs +189 -0
  282. package/dist/others/memoize-function.mjs.map +1 -0
  283. package/dist/others/tuple.d.mts +159 -0
  284. package/dist/others/tuple.d.mts.map +1 -0
  285. package/dist/others/tuple.mjs +161 -0
  286. package/dist/others/tuple.mjs.map +1 -0
  287. package/dist/others/unknown-to-string.d.mts +180 -0
  288. package/dist/others/unknown-to-string.d.mts.map +1 -0
  289. package/dist/others/unknown-to-string.mjs +211 -0
  290. package/dist/others/unknown-to-string.mjs.map +1 -0
  291. package/dist/tsconfig.json +1 -0
  292. package/package.json +16 -14
@@ -0,0 +1,141 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+
3
+ const typeNameInMessage = 'an integer in [-2^15, 2^15)';
4
+ const { MIN_VALUE, MAX_VALUE, min: min_, max: max_, abs, pow, add, sub, mul, div, random, is, castType, clamp, } = TsVerifiedInternals.RefinedNumberUtils.operatorsForInteger({
5
+ integerOrSafeInteger: 'SafeInteger',
6
+ MIN_VALUE: -32768,
7
+ MAX_VALUE: 2 ** 15 - 1,
8
+ typeNameInMessage,
9
+ });
10
+ /**
11
+ * Checks if a number is an Int16 (16-bit signed integer in the range [-2^15, 2^15)).
12
+ * @param value The value to check.
13
+ * @returns `true` if the value is an Int16, `false` otherwise.
14
+ */
15
+ const isInt16 = is;
16
+ /**
17
+ * Casts a number to an Int16 type.
18
+ * @param value The value to cast.
19
+ * @returns The value as an Int16 type.
20
+ * @throws {TypeError} If the value is not an integer in [-2^15, 2^15).
21
+ * @example
22
+ * ```typescript
23
+ * const x = asInt16(1000); // Int16
24
+ * const y = asInt16(-5000); // Int16
25
+ * // asInt16(50000); // throws TypeError
26
+ * // asInt16(1.5); // throws TypeError
27
+ * ```
28
+ */
29
+ const asInt16 = castType;
30
+ /**
31
+ * Namespace providing type-safe arithmetic operations for 16-bit signed integers.
32
+ *
33
+ * All operations automatically clamp results to the valid Int16 range [-32768, 32767].
34
+ * This ensures that all arithmetic maintains the 16-bit signed integer constraint.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const a = asInt16(30000);
39
+ * const b = asInt16(5000);
40
+ *
41
+ * // Arithmetic operations with automatic clamping
42
+ * const sum = Int16.add(a, b); // Int16 (32767 - clamped to MAX_VALUE)
43
+ * const diff = Int16.sub(a, b); // Int16 (25000)
44
+ * const product = Int16.mul(a, b); // Int16 (32767 - clamped due to overflow)
45
+ *
46
+ * // Range operations
47
+ * const clamped = Int16.clamp(100000); // Int16 (32767)
48
+ * const minimum = Int16.min(a, b); // Int16 (5000)
49
+ * const maximum = Int16.max(a, b); // Int16 (30000)
50
+ *
51
+ * // Range constants
52
+ * const range = Int16.MAX_VALUE - Int16.MIN_VALUE + 1; // 65536
53
+ * ```
54
+ */
55
+ const Int16 = {
56
+ /**
57
+ * Type guard to check if a value is an Int16.
58
+ * @param value The value to check.
59
+ * @returns `true` if the value is a 16-bit signed integer, `false` otherwise.
60
+ */
61
+ is,
62
+ /**
63
+ * The minimum value for a 16-bit signed integer.
64
+ * @readonly
65
+ */
66
+ MIN_VALUE,
67
+ /**
68
+ * The maximum value for a 16-bit signed integer.
69
+ * @readonly
70
+ */
71
+ MAX_VALUE,
72
+ /**
73
+ * Returns the absolute value of a 16-bit signed integer.
74
+ * @param a The Int16 value.
75
+ * @returns The absolute value as an Int16, clamped to valid range.
76
+ */
77
+ abs,
78
+ /**
79
+ * Returns the smaller of two Int16 values.
80
+ * @param a The first Int16.
81
+ * @param b The second Int16.
82
+ * @returns The minimum value as an Int16.
83
+ */
84
+ min: min_,
85
+ /**
86
+ * Returns the larger of two Int16 values.
87
+ * @param a The first Int16.
88
+ * @param b The second Int16.
89
+ * @returns The maximum value as an Int16.
90
+ */
91
+ max: max_,
92
+ /**
93
+ * Clamps a number to the Int16 range.
94
+ * @param value The number to clamp.
95
+ * @returns The value clamped to [-32768, 32767] as an Int16.
96
+ */
97
+ clamp,
98
+ /**
99
+ * Generates a random Int16 value within the valid range.
100
+ * @returns A random Int16 between MIN_VALUE and MAX_VALUE.
101
+ */
102
+ random,
103
+ /**
104
+ * Raises an Int16 to the power of another Int16.
105
+ * @param a The base Int16.
106
+ * @param b The exponent Int16.
107
+ * @returns `a ** b` clamped to [-32768, 32767] as an Int16.
108
+ */
109
+ pow,
110
+ /**
111
+ * Adds two Int16 values.
112
+ * @param a The first Int16.
113
+ * @param b The second Int16.
114
+ * @returns `a + b` clamped to [-32768, 32767] as an Int16.
115
+ */
116
+ add,
117
+ /**
118
+ * Subtracts one Int16 from another.
119
+ * @param a The minuend Int16.
120
+ * @param b The subtrahend Int16.
121
+ * @returns `a - b` clamped to [-32768, 32767] as an Int16.
122
+ */
123
+ sub,
124
+ /**
125
+ * Multiplies two Int16 values.
126
+ * @param a The first Int16.
127
+ * @param b The second Int16.
128
+ * @returns `a * b` clamped to [-32768, 32767] as an Int16.
129
+ */
130
+ mul,
131
+ /**
132
+ * Divides one Int16 by another using floor division.
133
+ * @param a The dividend Int16.
134
+ * @param b The divisor Int16.
135
+ * @returns `⌊a / b⌋` clamped to [-32768, 32767] as an Int16.
136
+ */
137
+ div,
138
+ };
139
+
140
+ export { Int16, asInt16, isInt16 };
141
+ //# sourceMappingURL=int16.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"int16.mjs","sources":["../../../src/number/branded-types/int16.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,6BAA6B;AAEvD,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,MAAM,EACN,EAAE,EACF,QAAQ,EACR,KAAK,GACN,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,mBAAmB,CAI5D;AACA,IAAA,oBAAoB,EAAE,aAAa;AACnC,IAAA,SAAS,EAAE,MAAU;AACrB,IAAA,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;AAIG;AACI,MAAM,OAAO,GAAG;AAEvB;;;;;;;;;;;;AAYG;AACI,MAAM,OAAO,GAAG;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AACI,MAAM,KAAK,GAAG;AACnB;;;;AAIG;IACH,EAAE;AAEF;;;AAGG;IACH,SAAS;AAET;;;AAGG;IACH,SAAS;AAET;;;;AAIG;IACH,GAAG;AAEH;;;;;AAKG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;AAKG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;AAIG;IACH,KAAK;AAEL;;;AAGG;IACH,MAAM;AAEN;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;;;;;"}
@@ -0,0 +1,155 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+ /**
3
+ * Checks if a number is an Int32 (32-bit signed integer in the range [-2^31, 2^31)).
4
+ * @param value The value to check.
5
+ * @returns `true` if the value is an Int32, `false` otherwise.
6
+ */
7
+ export declare const isInt32: (a: number) => a is Int32;
8
+ /**
9
+ * Casts a number to an Int32 type.
10
+ * @param value The value to cast.
11
+ * @returns The value as an Int32 type.
12
+ * @throws {TypeError} If the value is not an integer in [-2^31, 2^31).
13
+ * @example
14
+ * ```typescript
15
+ * const x = asInt32(100000); // Int32
16
+ * const y = asInt32(-500000); // Int32
17
+ * // asInt32(3000000000); // throws TypeError
18
+ * // asInt32(1.5); // throws TypeError
19
+ * ```
20
+ */
21
+ export declare const asInt32: <N extends number>(x: N) => number & {
22
+ readonly NaNValue: false;
23
+ readonly "> -2^32": true;
24
+ readonly ">= -2^31": true;
25
+ readonly "< 2^31": true;
26
+ readonly "< 2^32": true;
27
+ readonly Finite: true;
28
+ readonly Int: true;
29
+ readonly SafeInt: true;
30
+ } & Readonly<{
31
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
32
+ }> & N;
33
+ /**
34
+ * Namespace providing type-safe arithmetic operations for 32-bit signed integers.
35
+ *
36
+ * All operations automatically clamp results to the valid Int32 range [-2147483648, 2147483647].
37
+ * This ensures that all arithmetic maintains the 32-bit signed integer constraint, preventing overflow.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const a = asInt32(2000000000);
42
+ * const b = asInt32(500000000);
43
+ *
44
+ * // Arithmetic operations with automatic clamping
45
+ * const sum = Int32.add(a, b); // Int32 (2147483647 - clamped to MAX_VALUE)
46
+ * const diff = Int32.sub(a, b); // Int32 (1500000000)
47
+ * const product = Int32.mul(a, b); // Int32 (2147483647 - clamped due to overflow)
48
+ *
49
+ * // Range operations
50
+ * const clamped = Int32.clamp(5000000000); // Int32 (2147483647)
51
+ * const minimum = Int32.min(a, b); // Int32 (500000000)
52
+ * const maximum = Int32.max(a, b); // Int32 (2000000000)
53
+ *
54
+ * // Utility operations
55
+ * const absolute = Int32.abs(asInt32(-1000)); // Int32 (1000)
56
+ * const random = Int32.random(); // Int32 (random value in valid range)
57
+ * ```
58
+ */
59
+ export declare const Int32: {
60
+ /**
61
+ * Type guard to check if a value is an Int32.
62
+ * @param value The value to check.
63
+ * @returns `true` if the value is a 32-bit signed integer, `false` otherwise.
64
+ */
65
+ readonly is: (a: number) => a is Int32;
66
+ /**
67
+ * The minimum value for a 32-bit signed integer.
68
+ * @readonly
69
+ */
70
+ readonly MIN_VALUE: number;
71
+ /**
72
+ * The maximum value for a 32-bit signed integer.
73
+ * @readonly
74
+ */
75
+ readonly MAX_VALUE: number;
76
+ /**
77
+ * Returns the absolute value of a 32-bit signed integer.
78
+ * @param a The Int32 value.
79
+ * @returns The absolute value as an Int32, clamped to valid range.
80
+ */
81
+ readonly abs: (x: WithSmallInt<Int32, 40>) => TsVerifiedInternals.RefinedNumberUtils.ToNonNegative<Int32>;
82
+ /**
83
+ * Returns the smaller of two Int32 values.
84
+ * @param a The first Int32.
85
+ * @param b The second Int32.
86
+ * @returns The minimum value as an Int32.
87
+ */
88
+ readonly min: (...values: readonly WithSmallInt<Int32, 40>[]) => Int32;
89
+ /**
90
+ * Returns the larger of two Int32 values.
91
+ * @param a The first Int32.
92
+ * @param b The second Int32.
93
+ * @returns The maximum value as an Int32.
94
+ */
95
+ readonly max: (...values: readonly WithSmallInt<Int32, 40>[]) => Int32;
96
+ /**
97
+ * Clamps a number to the Int32 range.
98
+ * @param value The number to clamp.
99
+ * @returns The value clamped to [-2147483648, 2147483647] as an Int32.
100
+ */
101
+ readonly clamp: (x: number) => Int32;
102
+ /**
103
+ * Generates a random Int32 value within the valid range.
104
+ * @returns A random Int32 between MIN_VALUE and MAX_VALUE.
105
+ */
106
+ readonly random: (min: WithSmallInt<Int32, 40>, max: WithSmallInt<Int32, 40>) => Int32;
107
+ /**
108
+ * Raises an Int32 to the power of another Int32.
109
+ * @param a The base Int32.
110
+ * @param b The exponent Int32.
111
+ * @returns `a ** b` clamped to [-2147483648, 2147483647] as an Int32.
112
+ */
113
+ readonly pow: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
114
+ /**
115
+ * Adds two Int32 values.
116
+ * @param a The first Int32.
117
+ * @param b The second Int32.
118
+ * @returns `a + b` clamped to [-2147483648, 2147483647] as an Int32.
119
+ */
120
+ readonly add: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
121
+ /**
122
+ * Subtracts one Int32 from another.
123
+ * @param a The minuend Int32.
124
+ * @param b The subtrahend Int32.
125
+ * @returns `a - b` clamped to [-2147483648, 2147483647] as an Int32.
126
+ */
127
+ readonly sub: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
128
+ /**
129
+ * Multiplies two Int32 values.
130
+ * @param a The first Int32.
131
+ * @param b The second Int32.
132
+ * @returns `a * b` clamped to [-2147483648, 2147483647] as an Int32.
133
+ */
134
+ readonly mul: (x: WithSmallInt<Int32, 40>, y: WithSmallInt<Int32, 40>) => Int32;
135
+ /**
136
+ * Divides one Int32 by another using floor division.
137
+ * @param a The dividend Int32.
138
+ * @param b The divisor Int32.
139
+ * @returns `⌊a / b⌋` clamped to [-2147483648, 2147483647] as an Int32.
140
+ */
141
+ readonly div: (x: WithSmallInt<Int32, 40>, y: 1 | 2 | 3 | 32 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 10 | 24 | 14 | 34 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 35 | 36 | 37 | 38 | 39 | -1 | -2 | -3 | -32 | -4 | -5 | -6 | -7 | -8 | -9 | -11 | -10 | -24 | -14 | -34 | -12 | -13 | -15 | -16 | -17 | -18 | -19 | -20 | -21 | -22 | -23 | -25 | -26 | -27 | -28 | -29 | -30 | -31 | -33 | -35 | -36 | -37 | -38 | -39 | -40 | NormalizeBrandUnion<number & {
142
+ readonly NaNValue: false;
143
+ readonly "!=0": true;
144
+ readonly "> -2^32": true;
145
+ readonly ">= -2^31": true;
146
+ readonly "< 2^31": true;
147
+ readonly "< 2^32": true;
148
+ readonly Finite: true;
149
+ readonly Int: true;
150
+ readonly SafeInt: true;
151
+ } & Readonly<{
152
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
153
+ }>>) => Int32;
154
+ };
155
+ //# sourceMappingURL=int32.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAgClE;;;;GAIG;AACH,eAAO,MAAM,OAAO,2BAAK,CAAC;AAE1B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;MAAW,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,KAAK;IAChB;;;;OAIG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;;;;;;;;;;;;;CAEK,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+
3
+ const typeNameInMessage = 'an integer in [-2^31, 2^31)';
4
+ const { MIN_VALUE, MAX_VALUE, min: min_, max: max_, abs, pow, add, sub, mul, div, random, is, castType, clamp, } = TsVerifiedInternals.RefinedNumberUtils.operatorsForInteger({
5
+ integerOrSafeInteger: 'SafeInteger',
6
+ MIN_VALUE: -2147483648,
7
+ MAX_VALUE: 2 ** 31 - 1,
8
+ typeNameInMessage,
9
+ });
10
+ /**
11
+ * Checks if a number is an Int32 (32-bit signed integer in the range [-2^31, 2^31)).
12
+ * @param value The value to check.
13
+ * @returns `true` if the value is an Int32, `false` otherwise.
14
+ */
15
+ const isInt32 = is;
16
+ /**
17
+ * Casts a number to an Int32 type.
18
+ * @param value The value to cast.
19
+ * @returns The value as an Int32 type.
20
+ * @throws {TypeError} If the value is not an integer in [-2^31, 2^31).
21
+ * @example
22
+ * ```typescript
23
+ * const x = asInt32(100000); // Int32
24
+ * const y = asInt32(-500000); // Int32
25
+ * // asInt32(3000000000); // throws TypeError
26
+ * // asInt32(1.5); // throws TypeError
27
+ * ```
28
+ */
29
+ const asInt32 = castType;
30
+ /**
31
+ * Namespace providing type-safe arithmetic operations for 32-bit signed integers.
32
+ *
33
+ * All operations automatically clamp results to the valid Int32 range [-2147483648, 2147483647].
34
+ * This ensures that all arithmetic maintains the 32-bit signed integer constraint, preventing overflow.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const a = asInt32(2000000000);
39
+ * const b = asInt32(500000000);
40
+ *
41
+ * // Arithmetic operations with automatic clamping
42
+ * const sum = Int32.add(a, b); // Int32 (2147483647 - clamped to MAX_VALUE)
43
+ * const diff = Int32.sub(a, b); // Int32 (1500000000)
44
+ * const product = Int32.mul(a, b); // Int32 (2147483647 - clamped due to overflow)
45
+ *
46
+ * // Range operations
47
+ * const clamped = Int32.clamp(5000000000); // Int32 (2147483647)
48
+ * const minimum = Int32.min(a, b); // Int32 (500000000)
49
+ * const maximum = Int32.max(a, b); // Int32 (2000000000)
50
+ *
51
+ * // Utility operations
52
+ * const absolute = Int32.abs(asInt32(-1000)); // Int32 (1000)
53
+ * const random = Int32.random(); // Int32 (random value in valid range)
54
+ * ```
55
+ */
56
+ const Int32 = {
57
+ /**
58
+ * Type guard to check if a value is an Int32.
59
+ * @param value The value to check.
60
+ * @returns `true` if the value is a 32-bit signed integer, `false` otherwise.
61
+ */
62
+ is,
63
+ /**
64
+ * The minimum value for a 32-bit signed integer.
65
+ * @readonly
66
+ */
67
+ MIN_VALUE,
68
+ /**
69
+ * The maximum value for a 32-bit signed integer.
70
+ * @readonly
71
+ */
72
+ MAX_VALUE,
73
+ /**
74
+ * Returns the absolute value of a 32-bit signed integer.
75
+ * @param a The Int32 value.
76
+ * @returns The absolute value as an Int32, clamped to valid range.
77
+ */
78
+ abs,
79
+ /**
80
+ * Returns the smaller of two Int32 values.
81
+ * @param a The first Int32.
82
+ * @param b The second Int32.
83
+ * @returns The minimum value as an Int32.
84
+ */
85
+ min: min_,
86
+ /**
87
+ * Returns the larger of two Int32 values.
88
+ * @param a The first Int32.
89
+ * @param b The second Int32.
90
+ * @returns The maximum value as an Int32.
91
+ */
92
+ max: max_,
93
+ /**
94
+ * Clamps a number to the Int32 range.
95
+ * @param value The number to clamp.
96
+ * @returns The value clamped to [-2147483648, 2147483647] as an Int32.
97
+ */
98
+ clamp,
99
+ /**
100
+ * Generates a random Int32 value within the valid range.
101
+ * @returns A random Int32 between MIN_VALUE and MAX_VALUE.
102
+ */
103
+ random,
104
+ /**
105
+ * Raises an Int32 to the power of another Int32.
106
+ * @param a The base Int32.
107
+ * @param b The exponent Int32.
108
+ * @returns `a ** b` clamped to [-2147483648, 2147483647] as an Int32.
109
+ */
110
+ pow,
111
+ /**
112
+ * Adds two Int32 values.
113
+ * @param a The first Int32.
114
+ * @param b The second Int32.
115
+ * @returns `a + b` clamped to [-2147483648, 2147483647] as an Int32.
116
+ */
117
+ add,
118
+ /**
119
+ * Subtracts one Int32 from another.
120
+ * @param a The minuend Int32.
121
+ * @param b The subtrahend Int32.
122
+ * @returns `a - b` clamped to [-2147483648, 2147483647] as an Int32.
123
+ */
124
+ sub,
125
+ /**
126
+ * Multiplies two Int32 values.
127
+ * @param a The first Int32.
128
+ * @param b The second Int32.
129
+ * @returns `a * b` clamped to [-2147483648, 2147483647] as an Int32.
130
+ */
131
+ mul,
132
+ /**
133
+ * Divides one Int32 by another using floor division.
134
+ * @param a The dividend Int32.
135
+ * @param b The divisor Int32.
136
+ * @returns `⌊a / b⌋` clamped to [-2147483648, 2147483647] as an Int32.
137
+ */
138
+ div,
139
+ };
140
+
141
+ export { Int32, asInt32, isInt32 };
142
+ //# sourceMappingURL=int32.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"int32.mjs","sources":["../../../src/number/branded-types/int32.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,6BAA6B;AAEvD,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,MAAM,EACN,EAAE,EACF,QAAQ,EACR,KAAK,GACN,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,mBAAmB,CAI5D;AACA,IAAA,oBAAoB,EAAE,aAAa;AACnC,IAAA,SAAS,EAAE,WAAU;AACrB,IAAA,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;AAIG;AACI,MAAM,OAAO,GAAG;AAEvB;;;;;;;;;;;;AAYG;AACI,MAAM,OAAO,GAAG;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACI,MAAM,KAAK,GAAG;AACnB;;;;AAIG;IACH,EAAE;AAEF;;;AAGG;IACH,SAAS;AAET;;;AAGG;IACH,SAAS;AAET;;;;AAIG;IACH,GAAG;AAEH;;;;;AAKG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;AAKG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;AAIG;IACH,KAAK;AAEL;;;AAGG;IACH,MAAM;AAEN;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;AAEH;;;;;AAKG;IACH,GAAG;;;;;"}
@@ -0,0 +1,165 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+ type ElementType = NonNegativeFiniteNumber;
3
+ /**
4
+ * Checks if a number is a NonNegativeFiniteNumber (a finite number >= 0).
5
+ * @param value The value to check.
6
+ * @returns `true` if the value is a NonNegativeFiniteNumber, `false` otherwise.
7
+ */
8
+ export declare const isNonNegativeFiniteNumber: (a: number) => a is NonNegativeFiniteNumber;
9
+ /**
10
+ * Casts a number to a NonNegativeFiniteNumber type.
11
+ * @param value The value to cast.
12
+ * @returns The value as a NonNegativeFiniteNumber type.
13
+ * @throws {TypeError} If the value is not a non-negative finite number.
14
+ * @example
15
+ * ```typescript
16
+ * const x = asNonNegativeFiniteNumber(5.5); // NonNegativeFiniteNumber
17
+ * const y = asNonNegativeFiniteNumber(0); // NonNegativeFiniteNumber
18
+ * // asNonNegativeFiniteNumber(-1); // throws TypeError
19
+ * // asNonNegativeFiniteNumber(Infinity); // throws TypeError
20
+ * ```
21
+ */
22
+ export declare const asNonNegativeFiniteNumber: <N extends number>(x: N) => number & {
23
+ readonly NaNValue: false;
24
+ readonly "> -2^16": true;
25
+ readonly "> -2^32": true;
26
+ readonly ">= -2^15": true;
27
+ readonly ">= -2^31": true;
28
+ readonly ">=0": true;
29
+ readonly Finite: true;
30
+ } & Readonly<{
31
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
32
+ }> & N;
33
+ /**
34
+ * Namespace providing type-safe arithmetic operations for non-negative finite numbers.
35
+ *
36
+ * All operations maintain the non-negative constraint by clamping negative results to 0,
37
+ * while ensuring results remain finite (excluding NaN and Infinity). This type is useful
38
+ * for representing measurements, distances, weights, and other inherently non-negative values.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const distance = asNonNegativeFiniteNumber(5.5);
43
+ * const speed = asNonNegativeFiniteNumber(2.2);
44
+ *
45
+ * // Arithmetic operations with non-negative clamping
46
+ * const total = NonNegativeFiniteNumber.add(distance, speed); // NonNegativeFiniteNumber (7.7)
47
+ * const diff = NonNegativeFiniteNumber.sub(speed, distance); // NonNegativeFiniteNumber (0 - clamped)
48
+ * const area = NonNegativeFiniteNumber.mul(distance, speed); // NonNegativeFiniteNumber (12.1)
49
+ * const ratio = NonNegativeFiniteNumber.div(distance, speed); // NonNegativeFiniteNumber (2.5)
50
+ *
51
+ * // Range operations
52
+ * const clamped = NonNegativeFiniteNumber.clamp(-10.5); // NonNegativeFiniteNumber (0)
53
+ * const minimum = NonNegativeFiniteNumber.min(distance, speed); // NonNegativeFiniteNumber (2.2)
54
+ * const maximum = NonNegativeFiniteNumber.max(distance, speed); // NonNegativeFiniteNumber (5.5)
55
+ *
56
+ * // Rounding operations (return Uint)
57
+ * const pixels = NonNegativeFiniteNumber.round(distance); // Uint (6)
58
+ * const floorValue = NonNegativeFiniteNumber.floor(distance); // Uint (5)
59
+ * const ceilValue = NonNegativeFiniteNumber.ceil(distance); // Uint (6)
60
+ * ```
61
+ */
62
+ export declare const NonNegativeFiniteNumber: {
63
+ /**
64
+ * Type guard to check if a value is a NonNegativeFiniteNumber.
65
+ * @param value The value to check.
66
+ * @returns `true` if the value is a non-negative finite number, `false` otherwise.
67
+ */
68
+ readonly is: (a: number) => a is NonNegativeFiniteNumber;
69
+ /**
70
+ * The minimum value for a non-negative finite number.
71
+ * @readonly
72
+ */
73
+ readonly MIN_VALUE: 0;
74
+ /**
75
+ * Returns the smaller of two NonNegativeFiniteNumber values.
76
+ * @param a The first NonNegativeFiniteNumber.
77
+ * @param b The second NonNegativeFiniteNumber.
78
+ * @returns The minimum value as a NonNegativeFiniteNumber.
79
+ */
80
+ readonly min: (...values: readonly NonNegativeFiniteNumber[]) => NonNegativeFiniteNumber;
81
+ /**
82
+ * Returns the larger of two NonNegativeFiniteNumber values.
83
+ * @param a The first NonNegativeFiniteNumber.
84
+ * @param b The second NonNegativeFiniteNumber.
85
+ * @returns The maximum value as a NonNegativeFiniteNumber.
86
+ */
87
+ readonly max: (...values: readonly NonNegativeFiniteNumber[]) => NonNegativeFiniteNumber;
88
+ /**
89
+ * Clamps a number to the non-negative finite range.
90
+ * @param value The number to clamp.
91
+ * @returns The value clamped to [0, +∞) as a NonNegativeFiniteNumber.
92
+ */
93
+ readonly clamp: (x: number) => NonNegativeFiniteNumber;
94
+ /**
95
+ * Rounds down a NonNegativeFiniteNumber to the nearest integer.
96
+ * @param x The NonNegativeFiniteNumber to round down.
97
+ * @returns The floor value as a Uint.
98
+ */
99
+ readonly floor: (x: ElementType) => TsVerifiedInternals.RefinedNumberUtils.ToInt<ElementType>;
100
+ /**
101
+ * Rounds up a NonNegativeFiniteNumber to the nearest integer.
102
+ * @param x The NonNegativeFiniteNumber to round up.
103
+ * @returns The ceiling value as a Uint.
104
+ */
105
+ readonly ceil: (x: ElementType) => TsVerifiedInternals.RefinedNumberUtils.ToInt<ElementType>;
106
+ /**
107
+ * Rounds a NonNegativeFiniteNumber to the nearest integer.
108
+ * @param x The NonNegativeFiniteNumber to round.
109
+ * @returns The rounded value as a Uint.
110
+ */
111
+ readonly round: (x: ElementType) => TsVerifiedInternals.RefinedNumberUtils.ToInt<ElementType>;
112
+ /**
113
+ * Generates a random NonNegativeFiniteNumber value.
114
+ * @returns A random non-negative finite number.
115
+ */
116
+ readonly random: (min: NonNegativeFiniteNumber, max: NonNegativeFiniteNumber) => NonNegativeFiniteNumber;
117
+ /**
118
+ * Raises a NonNegativeFiniteNumber to the power of another NonNegativeFiniteNumber.
119
+ * @param a The base NonNegativeFiniteNumber.
120
+ * @param b The exponent NonNegativeFiniteNumber.
121
+ * @returns `a ** b` clamped to [0, +∞) as a NonNegativeFiniteNumber.
122
+ */
123
+ readonly pow: (x: NonNegativeFiniteNumber, y: NonNegativeFiniteNumber) => NonNegativeFiniteNumber;
124
+ /**
125
+ * Adds two NonNegativeFiniteNumber values.
126
+ * @param a The first NonNegativeFiniteNumber.
127
+ * @param b The second NonNegativeFiniteNumber.
128
+ * @returns `a + b` clamped to [0, +∞) as a NonNegativeFiniteNumber.
129
+ */
130
+ readonly add: (x: NonNegativeFiniteNumber, y: NonNegativeFiniteNumber) => NonNegativeFiniteNumber;
131
+ /**
132
+ * Subtracts one NonNegativeFiniteNumber from another.
133
+ * @param a The minuend NonNegativeFiniteNumber.
134
+ * @param b The subtrahend NonNegativeFiniteNumber.
135
+ * @returns `a - b` clamped to [0, +∞) as a NonNegativeFiniteNumber (minimum 0).
136
+ */
137
+ readonly sub: (x: NonNegativeFiniteNumber, y: NonNegativeFiniteNumber) => NonNegativeFiniteNumber;
138
+ /**
139
+ * Multiplies two NonNegativeFiniteNumber values.
140
+ * @param a The first NonNegativeFiniteNumber.
141
+ * @param b The second NonNegativeFiniteNumber.
142
+ * @returns `a * b` clamped to [0, +∞) as a NonNegativeFiniteNumber.
143
+ */
144
+ readonly mul: (x: NonNegativeFiniteNumber, y: NonNegativeFiniteNumber) => NonNegativeFiniteNumber;
145
+ /**
146
+ * Divides one NonNegativeFiniteNumber by another.
147
+ * @param a The dividend NonNegativeFiniteNumber.
148
+ * @param b The divisor NonNegativeFiniteNumber.
149
+ * @returns `a / b` clamped to [0, +∞) as a NonNegativeFiniteNumber.
150
+ */
151
+ readonly div: (x: NonNegativeFiniteNumber, y: number & {
152
+ readonly NaNValue: false;
153
+ readonly "!=0": true;
154
+ readonly "> -2^16": true;
155
+ readonly "> -2^32": true;
156
+ readonly ">= -2^15": true;
157
+ readonly ">= -2^31": true;
158
+ readonly ">=0": true;
159
+ readonly Finite: true;
160
+ } & Readonly<{
161
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
162
+ }>) => NonNegativeFiniteNumber;
163
+ };
164
+ export {};
165
+ //# sourceMappingURL=non-negative-finite-number.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-negative-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-finite-number.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,KAAK,WAAW,GAAG,uBAAuB,CAAC;AAiD3C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,6CAAK,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;MAAW,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;OAIG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;wBAjHA,WAAW,KACb,mBAAmB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAmH1D;;;;OAIG;uBAlHA,WAAW,KACb,mBAAmB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAoH1D;;;;OAIG;wBAnHA,WAAW,KACb,mBAAmB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAqH1D;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;;;;;;;;;;;;CAEK,CAAC"}