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,128 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+
3
+ const typeNameInMessage = 'a non-zero integer';
4
+ const { abs, min: min_, max: max_, pow, add, sub, mul, div, randomNonZero: random, is, castType, } = TsVerifiedInternals.RefinedNumberUtils.operatorsForInteger({
5
+ integerOrSafeInteger: 'Integer',
6
+ nonZero: true,
7
+ MIN_VALUE: undefined,
8
+ MAX_VALUE: undefined,
9
+ typeNameInMessage,
10
+ });
11
+ /**
12
+ * Checks if a number is a NonZeroInt.
13
+ * @param value The value to check.
14
+ * @returns `true` if the value is a NonZeroInt, `false` otherwise.
15
+ */
16
+ const isNonZeroInt = is;
17
+ /**
18
+ * Casts a number to a NonZeroInt type.
19
+ * @param value The value to cast.
20
+ * @returns The value as a NonZeroInt type.
21
+ * @throws {TypeError} If the value is not a non-zero integer.
22
+ * @example
23
+ * ```typescript
24
+ * const x = asNonZeroInt(5); // NonZeroInt
25
+ * const y = asNonZeroInt(-3); // NonZeroInt
26
+ * // asNonZeroInt(0); // throws TypeError
27
+ * // asNonZeroInt(1.5); // throws TypeError
28
+ * ```
29
+ */
30
+ const asNonZeroInt = castType;
31
+ /**
32
+ * Namespace providing type-safe arithmetic operations for non-zero integers.
33
+ *
34
+ * All operations maintain the non-zero constraint, ensuring that results are always valid NonZeroInt values.
35
+ * Division operations return floor division results, and all arithmetic maintains integer precision.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const a = asNonZeroInt(10);
40
+ * const b = asNonZeroInt(-5);
41
+ *
42
+ * // Arithmetic operations
43
+ * const sum = NonZeroInt.add(a, b); // NonZeroInt (5)
44
+ * const diff = NonZeroInt.sub(a, b); // NonZeroInt (15)
45
+ * const product = NonZeroInt.mul(a, b); // NonZeroInt (-50)
46
+ * const quotient = NonZeroInt.div(a, b); // NonZeroInt (-2)
47
+ *
48
+ * // Utility operations
49
+ * const absolute = NonZeroInt.abs(b); // NonZeroInt (5)
50
+ * const power = NonZeroInt.pow(a, asNonZeroInt(2)); // NonZeroInt (100)
51
+ * const minimum = NonZeroInt.min(a, b); // NonZeroInt (-5)
52
+ * const maximum = NonZeroInt(a, b); // NonZeroInt (10)
53
+ *
54
+ * // Random generation
55
+ * const randomInt = NonZeroInt.random(); // NonZeroInt (random non-zero integer)
56
+ * ```
57
+ */
58
+ const NonZeroInt = {
59
+ /**
60
+ * Type guard to check if a value is a NonZeroInt.
61
+ * @param value The value to check.
62
+ * @returns `true` if the value is a non-zero integer, `false` otherwise.
63
+ */
64
+ is,
65
+ /**
66
+ * Returns the absolute value of a non-zero integer.
67
+ * @param a The non-zero integer.
68
+ * @returns The absolute value as a NonZeroInt.
69
+ */
70
+ abs,
71
+ /**
72
+ * Returns the smaller of two non-zero integers.
73
+ * @param a The first non-zero integer.
74
+ * @param b The second non-zero integer.
75
+ * @returns The minimum value as a NonZeroInt.
76
+ */
77
+ min: min_,
78
+ /**
79
+ * Returns the larger of two non-zero integers.
80
+ * @param a The first non-zero integer.
81
+ * @param b The second non-zero integer.
82
+ * @returns The maximum value as a NonZeroInt.
83
+ */
84
+ max: max_,
85
+ /**
86
+ * Generates a random non-zero integer.
87
+ * @returns A random NonZeroInt value.
88
+ */
89
+ random,
90
+ /**
91
+ * Raises a non-zero integer to the power of another non-zero integer.
92
+ * @param a The base non-zero integer.
93
+ * @param b The exponent non-zero integer.
94
+ * @returns `a ** b` as a NonZeroInt.
95
+ */
96
+ pow,
97
+ /**
98
+ * Adds two non-zero integers.
99
+ * @param a The first non-zero integer.
100
+ * @param b The second non-zero integer.
101
+ * @returns `a + b` as a NonZeroInt.
102
+ */
103
+ add,
104
+ /**
105
+ * Subtracts one non-zero integer from another.
106
+ * @param a The minuend non-zero integer.
107
+ * @param b The subtrahend non-zero integer.
108
+ * @returns `a - b` as a NonZeroInt.
109
+ */
110
+ sub,
111
+ /**
112
+ * Multiplies two non-zero integers.
113
+ * @param a The first non-zero integer.
114
+ * @param b The second non-zero integer.
115
+ * @returns `a * b` as a NonZeroInt.
116
+ */
117
+ mul,
118
+ /**
119
+ * Divides one non-zero integer by another using floor division.
120
+ * @param a The dividend non-zero integer.
121
+ * @param b The divisor non-zero integer.
122
+ * @returns `⌊a / b⌋` as a NonZeroInt.
123
+ */
124
+ div,
125
+ };
126
+
127
+ export { NonZeroInt, asNonZeroInt, isNonZeroInt };
128
+ //# sourceMappingURL=non-zero-int.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-zero-int.mjs","sources":["../../../src/number/branded-types/non-zero-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,oBAAoB;AAE9C,MAAM,EACJ,GAAG,EACH,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,EAAE,EACF,QAAQ,GACT,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,mBAAmB,CAI5D;AACA,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,SAAS,EAAE,SAAS;IACpB,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;AAIG;AACI,MAAM,YAAY,GAAG;AAE5B;;;;;;;;;;;;AAYG;AACI,MAAM,YAAY,GAAG;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACI,MAAM,UAAU,GAAG;AACxB;;;;AAIG;IACH,EAAE;AAEF;;;;AAIG;IACH,GAAG;AAEH;;;;;AAKG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;AAKG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;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,166 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+ /**
3
+ * Checks if a number is a NonZeroInt16 (16-bit non-zero signed integer in the range [-2^15, 2^15) excluding 0).
4
+ * @param value The value to check.
5
+ * @returns `true` if the value is a NonZeroInt16, `false` otherwise.
6
+ */
7
+ export declare const isNonZeroInt16: (a: number) => a is NonZeroInt16;
8
+ /**
9
+ * Casts a number to a NonZeroInt16 type.
10
+ * @param value The value to cast.
11
+ * @returns The value as a NonZeroInt16 type.
12
+ * @throws {TypeError} If the value is not a non-zero integer in [-2^15, 2^15).
13
+ * @example
14
+ * ```typescript
15
+ * const x = asNonZeroInt16(1000); // NonZeroInt16
16
+ * const y = asNonZeroInt16(-1000); // NonZeroInt16
17
+ * // asNonZeroInt16(0); // throws TypeError
18
+ * // asNonZeroInt16(32768); // throws TypeError
19
+ * ```
20
+ */
21
+ export declare const asNonZeroInt16: <N extends number>(x: N) => number & {
22
+ readonly NaNValue: false;
23
+ readonly "!=0": true;
24
+ readonly "> -2^16": true;
25
+ readonly "> -2^32": true;
26
+ readonly ">= -2^15": true;
27
+ readonly ">= -2^31": true;
28
+ readonly "< 2^15": true;
29
+ readonly "< 2^16": true;
30
+ readonly "< 2^31": true;
31
+ readonly "< 2^32": true;
32
+ readonly Finite: true;
33
+ readonly Int: true;
34
+ readonly SafeInt: true;
35
+ } & Readonly<{
36
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
37
+ }> & N;
38
+ /**
39
+ * Namespace providing type-safe arithmetic operations for 16-bit non-zero signed integers.
40
+ *
41
+ * All operations automatically clamp results to the valid NonZeroInt16 range [-32768, 32767]
42
+ * excluding 0. This ensures that all arithmetic maintains the 16-bit non-zero signed integer
43
+ * constraint, preventing zero results and overflow.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const a = asNonZeroInt16(30000);
48
+ * const b = asNonZeroInt16(-10000);
49
+ *
50
+ * // Arithmetic operations with automatic clamping and non-zero constraint
51
+ * const sum = NonZeroInt16.add(a, b); // NonZeroInt16 (20000)
52
+ * const diff = NonZeroInt16.sub(a, b); // NonZeroInt16 (32767 - clamped to MAX_VALUE)
53
+ * const product = NonZeroInt16.mul(a, b); // NonZeroInt16 (-32768 - clamped to MIN_VALUE)
54
+ *
55
+ * // Utility operations
56
+ * const absolute = NonZeroInt16.abs(b); // NonZeroInt16 (10000)
57
+ * const minimum = NonZeroInt16.min(a, b); // NonZeroInt16 (-10000)
58
+ * const maximum = NonZeroInt16.max(a, b); // NonZeroInt16 (30000)
59
+ *
60
+ * // Range operations (avoiding zero)
61
+ * const clamped = NonZeroInt16.clamp(0); // NonZeroInt16 (1 or -1, avoiding zero)
62
+ * const random = NonZeroInt16.random(); // NonZeroInt16 (random non-zero value in range)
63
+ * const power = NonZeroInt16.pow(asNonZeroInt16(2), asNonZeroInt16(10)); // NonZeroInt16 (1024)
64
+ * ```
65
+ */
66
+ export declare const NonZeroInt16: {
67
+ /**
68
+ * Type guard to check if a value is a NonZeroInt16.
69
+ * @param value The value to check.
70
+ * @returns `true` if the value is a 16-bit non-zero signed integer, `false` otherwise.
71
+ */
72
+ readonly is: (a: number) => a is NonZeroInt16;
73
+ /**
74
+ * The minimum value for a 16-bit non-zero signed integer.
75
+ * @readonly
76
+ */
77
+ readonly MIN_VALUE: number;
78
+ /**
79
+ * The maximum value for a 16-bit non-zero signed integer.
80
+ * @readonly
81
+ */
82
+ readonly MAX_VALUE: number;
83
+ /**
84
+ * Returns the absolute value of a 16-bit non-zero signed integer.
85
+ * @param a The NonZeroInt16 value.
86
+ * @returns The absolute value as a NonZeroInt16, clamped to valid range.
87
+ */
88
+ readonly abs: (x: WithSmallInt<NonZeroInt16, 40>) => TsVerifiedInternals.RefinedNumberUtils.ToNonNegative<NonZeroInt16>;
89
+ /**
90
+ * Returns the smaller of two NonZeroInt16 values.
91
+ * @param a The first NonZeroInt16.
92
+ * @param b The second NonZeroInt16.
93
+ * @returns The minimum value as a NonZeroInt16.
94
+ */
95
+ readonly min: (...values: readonly WithSmallInt<NonZeroInt16, 40>[]) => NonZeroInt16;
96
+ /**
97
+ * Returns the larger of two NonZeroInt16 values.
98
+ * @param a The first NonZeroInt16.
99
+ * @param b The second NonZeroInt16.
100
+ * @returns The maximum value as a NonZeroInt16.
101
+ */
102
+ readonly max: (...values: readonly WithSmallInt<NonZeroInt16, 40>[]) => NonZeroInt16;
103
+ /**
104
+ * Clamps a number to the NonZeroInt16 range (avoiding zero).
105
+ * @param value The number to clamp.
106
+ * @returns The value clamped to [-32768, 32767] \ {0} as a NonZeroInt16.
107
+ */
108
+ readonly clamp: (x: number) => NonZeroInt16;
109
+ /**
110
+ * Generates a random NonZeroInt16 value within the valid range.
111
+ * @returns A random NonZeroInt16 between MIN_VALUE and MAX_VALUE (excluding 0).
112
+ */
113
+ readonly random: (min: WithSmallInt<NonZeroInt16, 40>, max: WithSmallInt<NonZeroInt16, 40>) => NonZeroInt16;
114
+ /**
115
+ * Raises a NonZeroInt16 to the power of another NonZeroInt16.
116
+ * @param a The base NonZeroInt16.
117
+ * @param b The exponent NonZeroInt16.
118
+ * @returns `a ** b` clamped to [-32768, 32767] as a NonZeroInt16.
119
+ */
120
+ readonly pow: (x: WithSmallInt<NonZeroInt16, 40>, y: WithSmallInt<NonZeroInt16, 40>) => NonZeroInt16;
121
+ /**
122
+ * Adds two NonZeroInt16 values.
123
+ * @param a The first NonZeroInt16.
124
+ * @param b The second NonZeroInt16.
125
+ * @returns `a + b` clamped to [-32768, 32767] as a NonZeroInt16.
126
+ */
127
+ readonly add: (x: WithSmallInt<NonZeroInt16, 40>, y: WithSmallInt<NonZeroInt16, 40>) => NonZeroInt16;
128
+ /**
129
+ * Subtracts one NonZeroInt16 from another.
130
+ * @param a The minuend NonZeroInt16.
131
+ * @param b The subtrahend NonZeroInt16.
132
+ * @returns `a - b` clamped to [-32768, 32767] as a NonZeroInt16.
133
+ */
134
+ readonly sub: (x: WithSmallInt<NonZeroInt16, 40>, y: WithSmallInt<NonZeroInt16, 40>) => NonZeroInt16;
135
+ /**
136
+ * Multiplies two NonZeroInt16 values.
137
+ * @param a The first NonZeroInt16.
138
+ * @param b The second NonZeroInt16.
139
+ * @returns `a * b` clamped to [-32768, 32767] as a NonZeroInt16.
140
+ */
141
+ readonly mul: (x: WithSmallInt<NonZeroInt16, 40>, y: WithSmallInt<NonZeroInt16, 40>) => NonZeroInt16;
142
+ /**
143
+ * Divides one NonZeroInt16 by another using floor division.
144
+ * @param a The dividend NonZeroInt16.
145
+ * @param b The divisor NonZeroInt16.
146
+ * @returns `⌊a / b⌋` clamped to [-32768, 32767] as a NonZeroInt16.
147
+ */
148
+ readonly div: (x: WithSmallInt<NonZeroInt16, 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 & {
149
+ readonly NaNValue: false;
150
+ readonly "!=0": true;
151
+ readonly "> -2^16": true;
152
+ readonly "> -2^32": true;
153
+ readonly ">= -2^15": true;
154
+ readonly ">= -2^31": true;
155
+ readonly "< 2^15": true;
156
+ readonly "< 2^16": true;
157
+ readonly "< 2^31": true;
158
+ readonly "< 2^32": true;
159
+ readonly Finite: true;
160
+ readonly Int: true;
161
+ readonly SafeInt: true;
162
+ } & Readonly<{
163
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
164
+ }>>) => NonZeroInt16;
165
+ };
166
+ //# sourceMappingURL=non-zero-int16.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-zero-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAiClE;;;;GAIG;AACH,eAAO,MAAM,cAAc,kCAAK,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;MAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,YAAY;IACvB;;;;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,145 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+
3
+ const typeNameInMessage = 'a non-zero integer in [-2^15, 2^15)';
4
+ const { MIN_VALUE, MAX_VALUE, abs, min: min_, max: max_, pow, add, sub, mul, div, randomNonZero: random, is, castType, clamp, } = TsVerifiedInternals.RefinedNumberUtils.operatorsForInteger({
5
+ integerOrSafeInteger: 'SafeInteger',
6
+ nonZero: true,
7
+ MIN_VALUE: -32768,
8
+ MAX_VALUE: 2 ** 15 - 1,
9
+ typeNameInMessage,
10
+ });
11
+ /**
12
+ * Checks if a number is a NonZeroInt16 (16-bit non-zero signed integer in the range [-2^15, 2^15) excluding 0).
13
+ * @param value The value to check.
14
+ * @returns `true` if the value is a NonZeroInt16, `false` otherwise.
15
+ */
16
+ const isNonZeroInt16 = is;
17
+ /**
18
+ * Casts a number to a NonZeroInt16 type.
19
+ * @param value The value to cast.
20
+ * @returns The value as a NonZeroInt16 type.
21
+ * @throws {TypeError} If the value is not a non-zero integer in [-2^15, 2^15).
22
+ * @example
23
+ * ```typescript
24
+ * const x = asNonZeroInt16(1000); // NonZeroInt16
25
+ * const y = asNonZeroInt16(-1000); // NonZeroInt16
26
+ * // asNonZeroInt16(0); // throws TypeError
27
+ * // asNonZeroInt16(32768); // throws TypeError
28
+ * ```
29
+ */
30
+ const asNonZeroInt16 = castType;
31
+ /**
32
+ * Namespace providing type-safe arithmetic operations for 16-bit non-zero signed integers.
33
+ *
34
+ * All operations automatically clamp results to the valid NonZeroInt16 range [-32768, 32767]
35
+ * excluding 0. This ensures that all arithmetic maintains the 16-bit non-zero signed integer
36
+ * constraint, preventing zero results and overflow.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const a = asNonZeroInt16(30000);
41
+ * const b = asNonZeroInt16(-10000);
42
+ *
43
+ * // Arithmetic operations with automatic clamping and non-zero constraint
44
+ * const sum = NonZeroInt16.add(a, b); // NonZeroInt16 (20000)
45
+ * const diff = NonZeroInt16.sub(a, b); // NonZeroInt16 (32767 - clamped to MAX_VALUE)
46
+ * const product = NonZeroInt16.mul(a, b); // NonZeroInt16 (-32768 - clamped to MIN_VALUE)
47
+ *
48
+ * // Utility operations
49
+ * const absolute = NonZeroInt16.abs(b); // NonZeroInt16 (10000)
50
+ * const minimum = NonZeroInt16.min(a, b); // NonZeroInt16 (-10000)
51
+ * const maximum = NonZeroInt16.max(a, b); // NonZeroInt16 (30000)
52
+ *
53
+ * // Range operations (avoiding zero)
54
+ * const clamped = NonZeroInt16.clamp(0); // NonZeroInt16 (1 or -1, avoiding zero)
55
+ * const random = NonZeroInt16.random(); // NonZeroInt16 (random non-zero value in range)
56
+ * const power = NonZeroInt16.pow(asNonZeroInt16(2), asNonZeroInt16(10)); // NonZeroInt16 (1024)
57
+ * ```
58
+ */
59
+ const NonZeroInt16 = {
60
+ /**
61
+ * Type guard to check if a value is a NonZeroInt16.
62
+ * @param value The value to check.
63
+ * @returns `true` if the value is a 16-bit non-zero signed integer, `false` otherwise.
64
+ */
65
+ is,
66
+ /**
67
+ * The minimum value for a 16-bit non-zero signed integer.
68
+ * @readonly
69
+ */
70
+ MIN_VALUE,
71
+ /**
72
+ * The maximum value for a 16-bit non-zero signed integer.
73
+ * @readonly
74
+ */
75
+ MAX_VALUE,
76
+ /**
77
+ * Returns the absolute value of a 16-bit non-zero signed integer.
78
+ * @param a The NonZeroInt16 value.
79
+ * @returns The absolute value as a NonZeroInt16, clamped to valid range.
80
+ */
81
+ abs,
82
+ /**
83
+ * Returns the smaller of two NonZeroInt16 values.
84
+ * @param a The first NonZeroInt16.
85
+ * @param b The second NonZeroInt16.
86
+ * @returns The minimum value as a NonZeroInt16.
87
+ */
88
+ min: min_,
89
+ /**
90
+ * Returns the larger of two NonZeroInt16 values.
91
+ * @param a The first NonZeroInt16.
92
+ * @param b The second NonZeroInt16.
93
+ * @returns The maximum value as a NonZeroInt16.
94
+ */
95
+ max: max_,
96
+ /**
97
+ * Clamps a number to the NonZeroInt16 range (avoiding zero).
98
+ * @param value The number to clamp.
99
+ * @returns The value clamped to [-32768, 32767] \ {0} as a NonZeroInt16.
100
+ */
101
+ clamp,
102
+ /**
103
+ * Generates a random NonZeroInt16 value within the valid range.
104
+ * @returns A random NonZeroInt16 between MIN_VALUE and MAX_VALUE (excluding 0).
105
+ */
106
+ random,
107
+ /**
108
+ * Raises a NonZeroInt16 to the power of another NonZeroInt16.
109
+ * @param a The base NonZeroInt16.
110
+ * @param b The exponent NonZeroInt16.
111
+ * @returns `a ** b` clamped to [-32768, 32767] as a NonZeroInt16.
112
+ */
113
+ pow,
114
+ /**
115
+ * Adds two NonZeroInt16 values.
116
+ * @param a The first NonZeroInt16.
117
+ * @param b The second NonZeroInt16.
118
+ * @returns `a + b` clamped to [-32768, 32767] as a NonZeroInt16.
119
+ */
120
+ add,
121
+ /**
122
+ * Subtracts one NonZeroInt16 from another.
123
+ * @param a The minuend NonZeroInt16.
124
+ * @param b The subtrahend NonZeroInt16.
125
+ * @returns `a - b` clamped to [-32768, 32767] as a NonZeroInt16.
126
+ */
127
+ sub,
128
+ /**
129
+ * Multiplies two NonZeroInt16 values.
130
+ * @param a The first NonZeroInt16.
131
+ * @param b The second NonZeroInt16.
132
+ * @returns `a * b` clamped to [-32768, 32767] as a NonZeroInt16.
133
+ */
134
+ mul,
135
+ /**
136
+ * Divides one NonZeroInt16 by another using floor division.
137
+ * @param a The dividend NonZeroInt16.
138
+ * @param b The divisor NonZeroInt16.
139
+ * @returns `⌊a / b⌋` clamped to [-32768, 32767] as a NonZeroInt16.
140
+ */
141
+ div,
142
+ };
143
+
144
+ export { NonZeroInt16, asNonZeroInt16, isNonZeroInt16 };
145
+ //# sourceMappingURL=non-zero-int16.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-zero-int16.mjs","sources":["../../../src/number/branded-types/non-zero-int16.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,qCAAqC;AAE/D,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,EAAE,EACF,QAAQ,EACR,KAAK,GACN,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,mBAAmB,CAI5D;AACA,IAAA,oBAAoB,EAAE,aAAa;AACnC,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,SAAS,EAAE,MAAU;AACrB,IAAA,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;AAIG;AACI,MAAM,cAAc,GAAG;AAE9B;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACI,MAAM,YAAY,GAAG;AAC1B;;;;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,158 @@
1
+ import { TsVerifiedInternals } from '../refined-number-utils.mjs';
2
+ /**
3
+ * Checks if a number is a NonZeroInt32 (32-bit non-zero signed integer in the range [-2^31, 2^31) excluding 0).
4
+ * @param value The value to check.
5
+ * @returns `true` if the value is a NonZeroInt32, `false` otherwise.
6
+ */
7
+ export declare const isNonZeroInt32: (a: number) => a is NonZeroInt32;
8
+ /**
9
+ * Casts a number to a NonZeroInt32 type.
10
+ * @param value The value to cast.
11
+ * @returns The value as a NonZeroInt32 type.
12
+ * @throws {TypeError} If the value is not a non-zero integer in [-2^31, 2^31).
13
+ * @example
14
+ * ```typescript
15
+ * const x = asNonZeroInt32(1000); // NonZeroInt32
16
+ * const y = asNonZeroInt32(-1000); // NonZeroInt32
17
+ * // asNonZeroInt32(0); // throws TypeError
18
+ * // asNonZeroInt32(2147483648); // throws TypeError
19
+ * ```
20
+ */
21
+ export declare const asNonZeroInt32: <N extends number>(x: N) => number & {
22
+ readonly NaNValue: false;
23
+ readonly "!=0": true;
24
+ readonly "> -2^32": true;
25
+ readonly ">= -2^31": true;
26
+ readonly "< 2^31": true;
27
+ readonly "< 2^32": true;
28
+ readonly Finite: true;
29
+ readonly Int: true;
30
+ readonly SafeInt: true;
31
+ } & Readonly<{
32
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
33
+ }> & N;
34
+ /**
35
+ * Namespace providing type-safe arithmetic operations for 32-bit non-zero signed integers.
36
+ *
37
+ * All operations automatically clamp results to the valid NonZeroInt32 range [-2147483648, 2147483647]
38
+ * excluding 0. This ensures that all arithmetic maintains the 32-bit non-zero signed integer
39
+ * constraint, preventing zero results and overflow.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const a = asNonZeroInt32(2000000000);
44
+ * const b = asNonZeroInt32(-500000000);
45
+ *
46
+ * // Arithmetic operations with automatic clamping and non-zero constraint
47
+ * const sum = NonZeroInt32.add(a, b); // NonZeroInt32 (1500000000)
48
+ * const diff = NonZeroInt32.sub(a, b); // NonZeroInt32 (2147483647 - clamped to MAX_VALUE)
49
+ * const product = NonZeroInt32.mul(a, b); // NonZeroInt32 (-2147483648 - clamped to MIN_VALUE)
50
+ *
51
+ * // Utility operations
52
+ * const absolute = NonZeroInt32.abs(b); // NonZeroInt32 (500000000)
53
+ * const minimum = NonZeroInt32.min(a, b); // NonZeroInt32 (-500000000)
54
+ * const maximum = NonZeroInt32.max(a, b); // NonZeroInt32 (2000000000)
55
+ *
56
+ * // Range operations (avoiding zero)
57
+ * const clamped = NonZeroInt32.clamp(0); // NonZeroInt32 (1 or -1, avoiding zero)
58
+ * const random = NonZeroInt32.random(); // NonZeroInt32 (random non-zero value in range)
59
+ * const power = NonZeroInt32.pow(asNonZeroInt32(2), asNonZeroInt32(20)); // NonZeroInt32 (1048576)
60
+ * ```
61
+ */
62
+ export declare const NonZeroInt32: {
63
+ /**
64
+ * Type guard to check if a value is a NonZeroInt32.
65
+ * @param value The value to check.
66
+ * @returns `true` if the value is a 32-bit non-zero signed integer, `false` otherwise.
67
+ */
68
+ readonly is: (a: number) => a is NonZeroInt32;
69
+ /**
70
+ * The minimum value for a 32-bit non-zero signed integer.
71
+ * @readonly
72
+ */
73
+ readonly MIN_VALUE: number;
74
+ /**
75
+ * The maximum value for a 32-bit non-zero signed integer.
76
+ * @readonly
77
+ */
78
+ readonly MAX_VALUE: number;
79
+ /**
80
+ * Returns the absolute value of a 32-bit non-zero signed integer.
81
+ * @param a The NonZeroInt32 value.
82
+ * @returns The absolute value as a NonZeroInt32, clamped to valid range.
83
+ */
84
+ readonly abs: (x: WithSmallInt<NonZeroInt32, 40>) => TsVerifiedInternals.RefinedNumberUtils.ToNonNegative<NonZeroInt32>;
85
+ /**
86
+ * Returns the smaller of two NonZeroInt32 values.
87
+ * @param a The first NonZeroInt32.
88
+ * @param b The second NonZeroInt32.
89
+ * @returns The minimum value as a NonZeroInt32.
90
+ */
91
+ readonly min: (...values: readonly WithSmallInt<NonZeroInt32, 40>[]) => NonZeroInt32;
92
+ /**
93
+ * Returns the larger of two NonZeroInt32 values.
94
+ * @param a The first NonZeroInt32.
95
+ * @param b The second NonZeroInt32.
96
+ * @returns The maximum value as a NonZeroInt32.
97
+ */
98
+ readonly max: (...values: readonly WithSmallInt<NonZeroInt32, 40>[]) => NonZeroInt32;
99
+ /**
100
+ * Clamps a number to the NonZeroInt32 range (avoiding zero).
101
+ * @param value The number to clamp.
102
+ * @returns The value clamped to [-2147483648, 2147483647] \ {0} as a NonZeroInt32.
103
+ */
104
+ readonly clamp: (x: number) => NonZeroInt32;
105
+ /**
106
+ * Generates a random NonZeroInt32 value within the valid range.
107
+ * @returns A random NonZeroInt32 between MIN_VALUE and MAX_VALUE (excluding 0).
108
+ */
109
+ readonly random: (min: WithSmallInt<NonZeroInt32, 40>, max: WithSmallInt<NonZeroInt32, 40>) => NonZeroInt32;
110
+ /**
111
+ * Raises a NonZeroInt32 to the power of another NonZeroInt32.
112
+ * @param a The base NonZeroInt32.
113
+ * @param b The exponent NonZeroInt32.
114
+ * @returns `a ** b` clamped to [-2147483648, 2147483647] as a NonZeroInt32.
115
+ */
116
+ readonly pow: (x: WithSmallInt<NonZeroInt32, 40>, y: WithSmallInt<NonZeroInt32, 40>) => NonZeroInt32;
117
+ /**
118
+ * Adds two NonZeroInt32 values.
119
+ * @param a The first NonZeroInt32.
120
+ * @param b The second NonZeroInt32.
121
+ * @returns `a + b` clamped to [-2147483648, 2147483647] as a NonZeroInt32.
122
+ */
123
+ readonly add: (x: WithSmallInt<NonZeroInt32, 40>, y: WithSmallInt<NonZeroInt32, 40>) => NonZeroInt32;
124
+ /**
125
+ * Subtracts one NonZeroInt32 from another.
126
+ * @param a The minuend NonZeroInt32.
127
+ * @param b The subtrahend NonZeroInt32.
128
+ * @returns `a - b` clamped to [-2147483648, 2147483647] as a NonZeroInt32.
129
+ */
130
+ readonly sub: (x: WithSmallInt<NonZeroInt32, 40>, y: WithSmallInt<NonZeroInt32, 40>) => NonZeroInt32;
131
+ /**
132
+ * Multiplies two NonZeroInt32 values.
133
+ * @param a The first NonZeroInt32.
134
+ * @param b The second NonZeroInt32.
135
+ * @returns `a * b` clamped to [-2147483648, 2147483647] as a NonZeroInt32.
136
+ */
137
+ readonly mul: (x: WithSmallInt<NonZeroInt32, 40>, y: WithSmallInt<NonZeroInt32, 40>) => NonZeroInt32;
138
+ /**
139
+ * Divides one NonZeroInt32 by another using floor division.
140
+ * @param a The dividend NonZeroInt32.
141
+ * @param b The divisor NonZeroInt32.
142
+ * @returns `⌊a / b⌋` clamped to [-2147483648, 2147483647] as a NonZeroInt32.
143
+ */
144
+ readonly div: (x: WithSmallInt<NonZeroInt32, 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 & {
145
+ readonly NaNValue: false;
146
+ readonly "!=0": true;
147
+ readonly "> -2^32": true;
148
+ readonly ">= -2^31": true;
149
+ readonly "< 2^31": true;
150
+ readonly "< 2^32": true;
151
+ readonly Finite: true;
152
+ readonly Int: true;
153
+ readonly SafeInt: true;
154
+ } & Readonly<{
155
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
156
+ }>>) => NonZeroInt32;
157
+ };
158
+ //# sourceMappingURL=non-zero-int32.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-zero-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAiClE;;;;GAIG;AACH,eAAO,MAAM,cAAc,kCAAK,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;MAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,YAAY;IACvB;;;;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"}