ts-data-forge 10.0.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/dist/array/impl/array-utils-creation.d.mts +3 -3
  2. package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-creation.mjs.map +1 -1
  4. package/dist/array/impl/array-utils-element-access.d.mts +4 -4
  5. package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
  6. package/dist/{guard/as-length-bounded-array.d.mts → array/impl/array-utils-length-bounded-array-cast.d.mts} +9 -9
  7. package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts.map +1 -0
  8. package/dist/{guard/as-length-bounded-array.mjs → array/impl/array-utils-length-bounded-array-cast.mjs} +2 -2
  9. package/dist/array/impl/array-utils-length-bounded-array-cast.mjs.map +1 -0
  10. package/dist/{guard/is-length-bounded-array.d.mts → array/impl/array-utils-length-bounded-array-guard.d.mts} +13 -13
  11. package/dist/array/impl/array-utils-length-bounded-array-guard.d.mts.map +1 -0
  12. package/dist/{guard/is-length-bounded-array.mjs → array/impl/array-utils-length-bounded-array-guard.mjs} +1 -1
  13. package/dist/array/impl/array-utils-length-bounded-array-guard.mjs.map +1 -0
  14. package/dist/array/impl/array-utils-modification.d.mts +9 -9
  15. package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
  16. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  17. package/dist/array/impl/array-utils-reducing-value.d.mts +9 -9
  18. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  19. package/dist/array/impl/array-utils-size.d.mts +3 -3
  20. package/dist/array/impl/array-utils-size.mjs.map +1 -1
  21. package/dist/array/impl/array-utils-slicing.d.mts +9 -9
  22. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
  23. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  24. package/dist/array/impl/array-utils-transformation.d.mts +16 -10
  25. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
  26. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  27. package/dist/array/impl/index.d.mts +2 -0
  28. package/dist/array/impl/index.d.mts.map +1 -1
  29. package/dist/array/impl/index.mjs +2 -0
  30. package/dist/array/impl/index.mjs.map +1 -1
  31. package/dist/entry-point.mjs +1 -3
  32. package/dist/entry-point.mjs.map +1 -1
  33. package/dist/guard/index.d.mts +0 -3
  34. package/dist/guard/index.d.mts.map +1 -1
  35. package/dist/guard/index.mjs +0 -3
  36. package/dist/guard/index.mjs.map +1 -1
  37. package/dist/index.d.mts +1 -0
  38. package/dist/index.d.mts.map +1 -1
  39. package/dist/index.mjs +1 -3
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/number/branded-types/finite-number.d.mts +47 -61
  42. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  43. package/dist/number/branded-types/finite-number.mjs +37 -41
  44. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  45. package/dist/number/branded-types/int.d.mts +40 -46
  46. package/dist/number/branded-types/int.d.mts.map +1 -1
  47. package/dist/number/branded-types/int.mjs +29 -31
  48. package/dist/number/branded-types/int.mjs.map +1 -1
  49. package/dist/number/branded-types/int16.d.mts +65 -58
  50. package/dist/number/branded-types/int16.d.mts.map +1 -1
  51. package/dist/number/branded-types/int16.mjs +49 -45
  52. package/dist/number/branded-types/int16.mjs.map +1 -1
  53. package/dist/number/branded-types/int32.d.mts +65 -58
  54. package/dist/number/branded-types/int32.d.mts.map +1 -1
  55. package/dist/number/branded-types/int32.mjs +49 -45
  56. package/dist/number/branded-types/int32.mjs.map +1 -1
  57. package/dist/number/branded-types/negative-finite-number.d.mts +68 -59
  58. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  59. package/dist/number/branded-types/negative-finite-number.mjs +52 -46
  60. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  61. package/dist/number/branded-types/negative-int.d.mts +60 -48
  62. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  63. package/dist/number/branded-types/negative-int.mjs +40 -36
  64. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  65. package/dist/number/branded-types/negative-safe-int.d.mts +57 -56
  66. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  67. package/dist/number/branded-types/negative-safe-int.mjs +40 -41
  68. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  69. package/dist/number/branded-types/non-negative-finite-number.d.mts +74 -64
  70. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  71. package/dist/number/branded-types/non-negative-finite-number.mjs +58 -51
  72. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  73. package/dist/number/branded-types/non-negative-int16.d.mts +64 -57
  74. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  75. package/dist/number/branded-types/non-negative-int16.mjs +47 -43
  76. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  77. package/dist/number/branded-types/non-negative-int32.d.mts +64 -58
  78. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  79. package/dist/number/branded-types/non-negative-int32.mjs +47 -44
  80. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  81. package/dist/number/branded-types/non-positive-finite-number.d.mts +64 -54
  82. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  83. package/dist/number/branded-types/non-positive-finite-number.mjs +48 -41
  84. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  85. package/dist/number/branded-types/non-positive-int.d.mts +41 -146
  86. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  87. package/dist/number/branded-types/non-positive-int.mjs +27 -107
  88. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  89. package/dist/number/branded-types/non-positive-safe-int.d.mts +54 -53
  90. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  91. package/dist/number/branded-types/non-positive-safe-int.mjs +37 -39
  92. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  93. package/dist/number/branded-types/non-zero-finite-number.d.mts +62 -49
  94. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  95. package/dist/number/branded-types/non-zero-finite-number.mjs +46 -37
  96. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  97. package/dist/number/branded-types/non-zero-int.d.mts +51 -38
  98. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  99. package/dist/number/branded-types/non-zero-int.mjs +31 -27
  100. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  101. package/dist/number/branded-types/non-zero-int16.d.mts +52 -53
  102. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  103. package/dist/number/branded-types/non-zero-int16.mjs +36 -39
  104. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  105. package/dist/number/branded-types/non-zero-int32.d.mts +52 -54
  106. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  107. package/dist/number/branded-types/non-zero-int32.mjs +36 -40
  108. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  109. package/dist/number/branded-types/non-zero-safe-int.d.mts +53 -54
  110. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  111. package/dist/number/branded-types/non-zero-safe-int.mjs +36 -40
  112. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  113. package/dist/number/branded-types/non-zero-uint16.d.mts +52 -53
  114. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  115. package/dist/number/branded-types/non-zero-uint16.mjs +35 -39
  116. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  117. package/dist/number/branded-types/non-zero-uint32.d.mts +52 -53
  118. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  119. package/dist/number/branded-types/non-zero-uint32.mjs +35 -39
  120. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  121. package/dist/number/branded-types/positive-finite-number.d.mts +74 -63
  122. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  123. package/dist/number/branded-types/positive-finite-number.mjs +58 -50
  124. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  125. package/dist/number/branded-types/positive-int.d.mts +46 -68
  126. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  127. package/dist/number/branded-types/positive-int.mjs +34 -49
  128. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  129. package/dist/number/branded-types/positive-int16.d.mts +61 -57
  130. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  131. package/dist/number/branded-types/positive-int16.mjs +44 -43
  132. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  133. package/dist/number/branded-types/positive-int32.d.mts +61 -57
  134. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  135. package/dist/number/branded-types/positive-int32.mjs +44 -43
  136. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  137. package/dist/number/branded-types/positive-safe-int.d.mts +62 -57
  138. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  139. package/dist/number/branded-types/positive-safe-int.mjs +45 -43
  140. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  141. package/dist/number/branded-types/positive-uint16.d.mts +61 -57
  142. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  143. package/dist/number/branded-types/positive-uint16.mjs +44 -43
  144. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  145. package/dist/number/branded-types/positive-uint32.d.mts +61 -58
  146. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  147. package/dist/number/branded-types/positive-uint32.mjs +44 -44
  148. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  149. package/dist/number/branded-types/safe-int.d.mts +43 -62
  150. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  151. package/dist/number/branded-types/safe-int.mjs +35 -42
  152. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  153. package/dist/number/branded-types/safe-uint.d.mts +62 -57
  154. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  155. package/dist/number/branded-types/safe-uint.mjs +46 -44
  156. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  157. package/dist/number/branded-types/uint.d.mts +63 -50
  158. package/dist/number/branded-types/uint.d.mts.map +1 -1
  159. package/dist/number/branded-types/uint.mjs +42 -39
  160. package/dist/number/branded-types/uint.mjs.map +1 -1
  161. package/dist/number/branded-types/uint16.d.mts +60 -58
  162. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  163. package/dist/number/branded-types/uint16.mjs +44 -43
  164. package/dist/number/branded-types/uint16.mjs.map +1 -1
  165. package/dist/number/branded-types/uint32.d.mts +59 -55
  166. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  167. package/dist/number/branded-types/uint32.mjs +42 -42
  168. package/dist/number/branded-types/uint32.mjs.map +1 -1
  169. package/dist/number/enum/int8.d.mts +56 -65
  170. package/dist/number/enum/int8.d.mts.map +1 -1
  171. package/dist/number/enum/int8.mjs +44 -43
  172. package/dist/number/enum/int8.mjs.map +1 -1
  173. package/dist/number/enum/uint8.d.mts +60 -58
  174. package/dist/number/enum/uint8.d.mts.map +1 -1
  175. package/dist/number/enum/uint8.mjs +44 -43
  176. package/dist/number/enum/uint8.mjs.map +1 -1
  177. package/dist/string/index.d.mts +2 -0
  178. package/dist/string/index.d.mts.map +1 -0
  179. package/dist/string/index.mjs +2 -0
  180. package/dist/string/index.mjs.map +1 -0
  181. package/dist/string/str.d.mts +273 -0
  182. package/dist/string/str.d.mts.map +1 -0
  183. package/dist/string/str.mjs +42 -0
  184. package/dist/string/str.mjs.map +1 -0
  185. package/package.json +31 -92
  186. package/src/array/impl/array-utils-creation.mts +2 -1
  187. package/src/array/impl/array-utils-element-access.mts +3 -3
  188. package/src/array/impl/array-utils-element-access.test.mts +3 -3
  189. package/src/{guard/as-length-bounded-array.mts → array/impl/array-utils-length-bounded-array-cast.mts} +9 -9
  190. package/src/{guard/as-length-bounded-array.test.mts → array/impl/array-utils-length-bounded-array-cast.test.mts} +2 -2
  191. package/src/{guard/is-length-bounded-array.mts → array/impl/array-utils-length-bounded-array-guard.mts} +12 -12
  192. package/src/{guard/is-length-bounded-array.test.mts → array/impl/array-utils-length-bounded-array-guard.test.mts} +2 -2
  193. package/src/array/impl/array-utils-modification.mts +9 -8
  194. package/src/array/impl/array-utils-modification.test.mts +6 -1
  195. package/src/array/impl/array-utils-reducing-value.mts +9 -9
  196. package/src/array/impl/array-utils-size.mts +2 -2
  197. package/src/array/impl/array-utils-slicing.mts +24 -13
  198. package/src/array/impl/array-utils-transformation.mts +18 -12
  199. package/src/array/impl/array-utils-transformation.test.mts +12 -12
  200. package/src/array/impl/index.mts +2 -0
  201. package/src/guard/index.mts +0 -3
  202. package/src/index.mts +1 -0
  203. package/src/number/branded-types/finite-number.mts +47 -61
  204. package/src/number/branded-types/int.mts +40 -46
  205. package/src/number/branded-types/int16.mts +65 -58
  206. package/src/number/branded-types/int32.mts +65 -58
  207. package/src/number/branded-types/negative-finite-number.mts +68 -68
  208. package/src/number/branded-types/negative-int.mts +60 -57
  209. package/src/number/branded-types/negative-safe-int.mts +57 -65
  210. package/src/number/branded-types/non-negative-finite-number.mts +74 -64
  211. package/src/number/branded-types/non-negative-int16.mts +64 -57
  212. package/src/number/branded-types/non-negative-int32.mts +64 -58
  213. package/src/number/branded-types/non-positive-finite-number.mts +64 -54
  214. package/src/number/branded-types/non-positive-int.mts +41 -146
  215. package/src/number/branded-types/non-positive-safe-int.mts +54 -53
  216. package/src/number/branded-types/non-zero-finite-number.mts +62 -51
  217. package/src/number/branded-types/non-zero-int.mts +51 -38
  218. package/src/number/branded-types/non-zero-int16.mts +52 -53
  219. package/src/number/branded-types/non-zero-int32.mts +52 -54
  220. package/src/number/branded-types/non-zero-safe-int.mts +53 -54
  221. package/src/number/branded-types/non-zero-uint16.mts +52 -53
  222. package/src/number/branded-types/non-zero-uint32.mts +52 -53
  223. package/src/number/branded-types/positive-finite-number.mts +74 -63
  224. package/src/number/branded-types/positive-int.mts +46 -68
  225. package/src/number/branded-types/positive-int16.mts +61 -57
  226. package/src/number/branded-types/positive-int32.mts +61 -57
  227. package/src/number/branded-types/positive-safe-int.mts +62 -57
  228. package/src/number/branded-types/positive-uint16.mts +61 -57
  229. package/src/number/branded-types/positive-uint32.mts +61 -58
  230. package/src/number/branded-types/safe-int.mts +43 -62
  231. package/src/number/branded-types/safe-uint.mts +62 -57
  232. package/src/number/branded-types/uint.mts +63 -50
  233. package/src/number/branded-types/uint16.mts +60 -58
  234. package/src/number/branded-types/uint32.mts +59 -55
  235. package/src/number/enum/int8.mts +56 -65
  236. package/src/number/enum/uint8.mts +60 -58
  237. package/src/string/index.mts +1 -0
  238. package/src/string/str.mts +371 -0
  239. package/src/string/str.test.mts +215 -0
  240. package/dist/guard/as-length-bounded-array.d.mts.map +0 -1
  241. package/dist/guard/as-length-bounded-array.mjs.map +0 -1
  242. package/dist/guard/is-length-bounded-array.d.mts.map +0 -1
  243. package/dist/guard/is-length-bounded-array.mjs.map +0 -1
  244. package/dist/guard/is-length-bounded-string.d.mts +0 -163
  245. package/dist/guard/is-length-bounded-string.d.mts.map +0 -1
  246. package/dist/guard/is-length-bounded-string.mjs +0 -7
  247. package/dist/guard/is-length-bounded-string.mjs.map +0 -1
  248. package/src/guard/is-length-bounded-string.mts +0 -199
  249. package/src/guard/is-length-bounded-string.test.mts +0 -170
@@ -33,117 +33,116 @@ const {
33
33
  } as const);
34
34
 
35
35
  /**
36
- * Checks if a number is a NonZeroUint16 (16-bit non-zero unsigned integer in
37
- * the range [1, 2^16)).
36
+ * Type guard that checks if a value is a non-zero integer in [1, 2^16).
38
37
  *
39
- * @param value The value to check.
40
- * @returns `true` if the value is a NonZeroUint16, `false` otherwise.
38
+ * Returns `true` for a non-zero integer in [1, 2^16) — a value with no
39
+ * fractional component.
40
+ *
41
+ * @param value - The value to check
42
+ * @returns `true` if the value is a non-zero integer in [1, 2^16), `false` otherwise
41
43
  */
42
44
  export const isNonZeroUint16 = is;
43
45
 
44
46
  /**
45
- * Casts a number to a NonZeroUint16 type.
47
+ * Casts a `number` to the `NonZeroUint16` branded type.
48
+ *
49
+ * Validates that the value is a non-zero integer in [1, 2^16) and returns it
50
+ * with the `NonZeroUint16` brand. Throws a `TypeError` otherwise.
46
51
  *
47
- * @param value The value to cast.
48
- * @returns The value as a NonZeroUint16 type.
49
- * @throws {TypeError} If the value is not a non-zero integer in [1, 2^16).
52
+ * @param value - The value to cast
53
+ * @returns The value as a `NonZeroUint16`
54
+ * @throws {TypeError} If the value is not a non-zero integer in [1, 2^16)
50
55
  */
51
56
  export const asNonZeroUint16 = castType;
52
57
 
53
58
  /**
54
- * Namespace providing type-safe arithmetic operations for 16-bit non-zero
55
- * unsigned integers.
59
+ * Namespace providing type-safe operations for the `NonZeroUint16` branded
60
+ * type.
56
61
  *
57
- * All operations automatically clamp results to the valid NonZeroUint16 range
58
- * [1, 65535]. This ensures that all arithmetic maintains the 16-bit non-zero
59
- * unsigned integer constraint, with results below 1 clamped to MIN_VALUE and
60
- * overflow results clamped to MAX_VALUE.
62
+ * The `NonZeroUint16` type represents a non-zero integer in [1, 2^16). Division
63
+ * (`div`) uses floor division.
61
64
  */
62
65
  export const NonZeroUint16 = {
63
66
  /**
64
- * Type guard to check if a value is a NonZeroUint16.
67
+ * Type guard that checks if a value is a non-zero integer in [1, 2^16).
65
68
  *
66
- * @param value The value to check.
67
- * @returns `true` if the value is a 16-bit non-zero unsigned integer, `false`
68
- * otherwise.
69
+ * @param value - The value to check
70
+ * @returns `true` if the value is a non-zero integer in [1, 2^16), `false` otherwise
71
+ * @see {@link isNonZeroUint16} for usage examples
69
72
  */
70
73
  is,
71
74
 
72
75
  /**
73
- * The minimum value for a 16-bit non-zero unsigned integer.
74
- *
75
- * @readonly
76
+ * The smallest value representable as `NonZeroUint16`.
76
77
  */
77
78
  MIN_VALUE,
78
79
 
79
80
  /**
80
- * The maximum value for a 16-bit non-zero unsigned integer.
81
- *
82
- * @readonly
81
+ * The largest value representable as `NonZeroUint16`.
83
82
  */
84
83
  MAX_VALUE,
85
84
 
86
85
  /**
87
- * Returns the smaller of two NonZeroUint16 values.
86
+ * Returns the smallest of the given non-zero integers.
88
87
  *
89
- * @param a The first NonZeroUint16.
90
- * @param b The second NonZeroUint16.
91
- * @returns The minimum value as a NonZeroUint16.
88
+ * @param values - The non-zero integers to compare (at least one required)
89
+ * @returns The smallest value as a `NonZeroUint16`
92
90
  */
93
91
  min: min_,
94
92
 
95
93
  /**
96
- * Returns the larger of two NonZeroUint16 values.
94
+ * Returns the largest of the given non-zero integers.
97
95
  *
98
- * @param a The first NonZeroUint16.
99
- * @param b The second NonZeroUint16.
100
- * @returns The maximum value as a NonZeroUint16.
96
+ * @param values - The non-zero integers to compare (at least one required)
97
+ * @returns The largest value as a `NonZeroUint16`
101
98
  */
102
99
  max: max_,
103
100
 
104
101
  /**
105
- * Clamps a number to the NonZeroUint16 range.
102
+ * Clamps a `number` into the `NonZeroUint16` range, rounding to the nearest
103
+ * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
106
104
  *
107
- * @param value The number to clamp.
108
- * @returns The value clamped to [1, 65535] as a NonZeroUint16.
105
+ * @param value - The value to clamp
106
+ * @returns The clamped value as a `NonZeroUint16`
109
107
  */
110
108
  clamp,
111
109
 
112
110
  /**
113
- * Generates a random NonZeroUint16 value within the valid range.
111
+ * Generates a random `NonZeroUint16` within the given range.
112
+ *
113
+ * The range is inclusive on both ends.
114
114
  *
115
- * @returns A random NonZeroUint16 between 1 and 65535.
115
+ * @param min - The minimum value (inclusive)
116
+ * @param max - The maximum value (inclusive)
117
+ * @returns A random `NonZeroUint16` in `[min, max]`
116
118
  */
117
119
  random,
118
120
 
119
121
  /**
120
- * Raises a NonZeroUint16 to the power of another NonZeroUint16.
122
+ * Raises `a` to the power `b`, returning `a ** b` as a `NonZeroUint16`
123
+ * (floored to an integer).
121
124
  *
122
- * @param a The base NonZeroUint16.
123
- * @param b The exponent NonZeroUint16.
124
- * @returns `a ** b` clamped to [1, 65535] as a NonZeroUint16.
125
+ * @param a - The base non-zero integer
126
+ * @param b - The exponent non-zero integer
127
+ * @returns `a ** b` as a `NonZeroUint16`
125
128
  */
126
129
  pow,
127
130
 
128
131
  /**
129
- * Adds two NonZeroUint16 values.
132
+ * Adds two non-zero integers, returning `a + b` as a `NonZeroUint16`.
130
133
  *
131
- * @param a The first NonZeroUint16.
132
- * @param b The second NonZeroUint16.
133
- * @returns `a + b` clamped to [1, 65535] as a NonZeroUint16.
134
+ * @param a - The first non-zero integer
135
+ * @param b - The second non-zero integer
136
+ * @returns The sum of `a` and `b` as a `NonZeroUint16`
134
137
  */
135
138
  add,
136
139
 
137
140
  /**
138
- * Multiplies two NonZeroUint16 values.
139
- *
140
- * Both `add` and `mul` stay within `[1, 65535]`. For the non-closed
141
- * operations (`sub`/`div`, whose result may be `0`) use {@link Num.sub} /
142
- * {@link Num.divInt}.
141
+ * Multiplies two non-zero integers, returning `a * b` as a `NonZeroUint16`.
143
142
  *
144
- * @param a The first NonZeroUint16.
145
- * @param b The second NonZeroUint16.
146
- * @returns `a * b` clamped to [1, 65535] as a NonZeroUint16.
143
+ * @param a - The first non-zero integer
144
+ * @param b - The second non-zero integer
145
+ * @returns The product of `a` and `b` as a `NonZeroUint16`
147
146
  */
148
147
  mul,
149
148
  } as const;
@@ -33,117 +33,116 @@ const {
33
33
  } as const);
34
34
 
35
35
  /**
36
- * Checks if a number is a NonZeroUint32 (32-bit non-zero unsigned integer in
37
- * the range [1, 2^32)).
36
+ * Type guard that checks if a value is a non-zero integer in [1, 2^32).
38
37
  *
39
- * @param value The value to check.
40
- * @returns `true` if the value is a NonZeroUint32, `false` otherwise.
38
+ * Returns `true` for a non-zero integer in [1, 2^32) — a value with no
39
+ * fractional component.
40
+ *
41
+ * @param value - The value to check
42
+ * @returns `true` if the value is a non-zero integer in [1, 2^32), `false` otherwise
41
43
  */
42
44
  export const isNonZeroUint32 = is;
43
45
 
44
46
  /**
45
- * Casts a number to a NonZeroUint32 type.
47
+ * Casts a `number` to the `NonZeroUint32` branded type.
48
+ *
49
+ * Validates that the value is a non-zero integer in [1, 2^32) and returns it
50
+ * with the `NonZeroUint32` brand. Throws a `TypeError` otherwise.
46
51
  *
47
- * @param value The value to cast.
48
- * @returns The value as a NonZeroUint32 type.
49
- * @throws {TypeError} If the value is not a non-zero integer in [1, 2^32).
52
+ * @param value - The value to cast
53
+ * @returns The value as a `NonZeroUint32`
54
+ * @throws {TypeError} If the value is not a non-zero integer in [1, 2^32)
50
55
  */
51
56
  export const asNonZeroUint32 = castType;
52
57
 
53
58
  /**
54
- * Namespace providing type-safe arithmetic operations for 32-bit non-zero
55
- * unsigned integers.
59
+ * Namespace providing type-safe operations for the `NonZeroUint32` branded
60
+ * type.
56
61
  *
57
- * All operations automatically clamp results to the valid NonZeroUint32 range
58
- * [1, 4294967295]. This ensures that all arithmetic maintains the 32-bit
59
- * non-zero unsigned integer constraint, with results below 1 clamped to
60
- * MIN_VALUE and overflow results clamped to MAX_VALUE.
62
+ * The `NonZeroUint32` type represents a non-zero integer in [1, 2^32). Division
63
+ * (`div`) uses floor division.
61
64
  */
62
65
  export const NonZeroUint32 = {
63
66
  /**
64
- * Type guard to check if a value is a NonZeroUint32.
67
+ * Type guard that checks if a value is a non-zero integer in [1, 2^32).
65
68
  *
66
- * @param value The value to check.
67
- * @returns `true` if the value is a 32-bit non-zero unsigned integer, `false`
68
- * otherwise.
69
+ * @param value - The value to check
70
+ * @returns `true` if the value is a non-zero integer in [1, 2^32), `false` otherwise
71
+ * @see {@link isNonZeroUint32} for usage examples
69
72
  */
70
73
  is,
71
74
 
72
75
  /**
73
- * The minimum value for a 32-bit non-zero unsigned integer.
74
- *
75
- * @readonly
76
+ * The smallest value representable as `NonZeroUint32`.
76
77
  */
77
78
  MIN_VALUE,
78
79
 
79
80
  /**
80
- * The maximum value for a 32-bit non-zero unsigned integer.
81
- *
82
- * @readonly
81
+ * The largest value representable as `NonZeroUint32`.
83
82
  */
84
83
  MAX_VALUE,
85
84
 
86
85
  /**
87
- * Returns the smaller of two NonZeroUint32 values.
86
+ * Returns the smallest of the given non-zero integers.
88
87
  *
89
- * @param a The first NonZeroUint32.
90
- * @param b The second NonZeroUint32.
91
- * @returns The minimum value as a NonZeroUint32.
88
+ * @param values - The non-zero integers to compare (at least one required)
89
+ * @returns The smallest value as a `NonZeroUint32`
92
90
  */
93
91
  min: min_,
94
92
 
95
93
  /**
96
- * Returns the larger of two NonZeroUint32 values.
94
+ * Returns the largest of the given non-zero integers.
97
95
  *
98
- * @param a The first NonZeroUint32.
99
- * @param b The second NonZeroUint32.
100
- * @returns The maximum value as a NonZeroUint32.
96
+ * @param values - The non-zero integers to compare (at least one required)
97
+ * @returns The largest value as a `NonZeroUint32`
101
98
  */
102
99
  max: max_,
103
100
 
104
101
  /**
105
- * Clamps a number to the NonZeroUint32 range.
102
+ * Clamps a `number` into the `NonZeroUint32` range, rounding to the nearest
103
+ * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
106
104
  *
107
- * @param value The number to clamp.
108
- * @returns The value clamped to [1, 4294967295] as a NonZeroUint32.
105
+ * @param value - The value to clamp
106
+ * @returns The clamped value as a `NonZeroUint32`
109
107
  */
110
108
  clamp,
111
109
 
112
110
  /**
113
- * Generates a random NonZeroUint32 value within the valid range.
111
+ * Generates a random `NonZeroUint32` within the given range.
112
+ *
113
+ * The range is inclusive on both ends.
114
114
  *
115
- * @returns A random NonZeroUint32 between 1 and 4294967295.
115
+ * @param min - The minimum value (inclusive)
116
+ * @param max - The maximum value (inclusive)
117
+ * @returns A random `NonZeroUint32` in `[min, max]`
116
118
  */
117
119
  random,
118
120
 
119
121
  /**
120
- * Raises a NonZeroUint32 to the power of another NonZeroUint32.
122
+ * Raises `a` to the power `b`, returning `a ** b` as a `NonZeroUint32`
123
+ * (floored to an integer).
121
124
  *
122
- * @param a The base NonZeroUint32.
123
- * @param b The exponent NonZeroUint32.
124
- * @returns `a ** b` clamped to [1, 4294967295] as a NonZeroUint32.
125
+ * @param a - The base non-zero integer
126
+ * @param b - The exponent non-zero integer
127
+ * @returns `a ** b` as a `NonZeroUint32`
125
128
  */
126
129
  pow,
127
130
 
128
131
  /**
129
- * Adds two NonZeroUint32 values.
132
+ * Adds two non-zero integers, returning `a + b` as a `NonZeroUint32`.
130
133
  *
131
- * @param a The first NonZeroUint32.
132
- * @param b The second NonZeroUint32.
133
- * @returns `a + b` clamped to [1, 4294967295] as a NonZeroUint32.
134
+ * @param a - The first non-zero integer
135
+ * @param b - The second non-zero integer
136
+ * @returns The sum of `a` and `b` as a `NonZeroUint32`
134
137
  */
135
138
  add,
136
139
 
137
140
  /**
138
- * Multiplies two NonZeroUint32 values.
139
- *
140
- * Both `add` and `mul` stay within `[1, 4294967295]`. For the non-closed
141
- * operations (`sub`/`div`, whose result may be `0`) use {@link Num.sub} /
142
- * {@link Num.divInt}.
141
+ * Multiplies two non-zero integers, returning `a * b` as a `NonZeroUint32`.
143
142
  *
144
- * @param a The first NonZeroUint32.
145
- * @param b The second NonZeroUint32.
146
- * @returns `a * b` clamped to [1, 4294967295] as a NonZeroUint32.
143
+ * @param a - The first non-zero integer
144
+ * @param b - The second non-zero integer
145
+ * @returns The product of `a` and `b` as a `NonZeroUint32`
147
146
  */
148
147
  mul,
149
148
  } as const;
@@ -78,148 +78,159 @@ expectType<
78
78
  >('=');
79
79
 
80
80
  /**
81
- * Checks if a number is a PositiveFiniteNumber (a finite number > 0).
81
+ * Type guard that checks if a value is a positive finite number.
82
82
  *
83
- * @param value The value to check.
84
- * @returns `true` if the value is a PositiveFiniteNumber, `false` otherwise.
83
+ * Returns `true` only for a finite value — never `NaN`, `Infinity`, or
84
+ * `-Infinity`.
85
+ *
86
+ * @param value - The value to check
87
+ * @returns `true` if the value is a positive finite number, `false` otherwise
85
88
  */
86
89
  export const isPositiveFiniteNumber = is;
87
90
 
88
91
  /**
89
- * Casts a number to a PositiveFiniteNumber type.
92
+ * Casts a `number` to the `PositiveFiniteNumber` branded type.
93
+ *
94
+ * Validates that the value is a positive finite number and returns it with the
95
+ * `PositiveFiniteNumber` brand. Throws a `TypeError` otherwise.
90
96
  *
91
- * @param value The value to cast.
92
- * @returns The value as a PositiveFiniteNumber type.
93
- * @throws {TypeError} If the value is not a positive finite number.
97
+ * @param value - The value to cast
98
+ * @returns The value as a `PositiveFiniteNumber`
99
+ * @throws {TypeError} If the value is not a positive finite number
94
100
  */
95
101
  export const asPositiveFiniteNumber = castType;
96
102
 
97
103
  /**
98
- * Namespace providing type-safe arithmetic operations for positive finite
99
- * numbers.
104
+ * Namespace providing type-safe operations for the `PositiveFiniteNumber`
105
+ * branded type.
100
106
  *
101
- * All operations maintain the positive constraint by clamping non-positive
102
- * results to MIN_VALUE, while ensuring results remain finite (excluding NaN and
103
- * Infinity). This type is useful for representing quantities that must always
104
- * be positive, such as probabilities, magnitudes, and physical measurements.
107
+ * The `PositiveFiniteNumber` type represents a positive finite number.
105
108
  */
106
109
  export const PositiveFiniteNumber = {
107
110
  /**
108
- * Type guard to check if a value is a PositiveFiniteNumber.
111
+ * Type guard that checks if a value is a positive finite number.
109
112
  *
110
- * @param value The value to check.
111
- * @returns `true` if the value is a positive finite number, `false`
112
- * otherwise.
113
+ * @param value - The value to check
114
+ * @returns `true` if the value is a positive finite number, `false` otherwise
115
+ * @see {@link isPositiveFiniteNumber} for usage examples
113
116
  */
114
117
  is,
115
118
 
116
119
  /**
117
- * The minimum value for a positive finite number.
118
- *
119
- * @readonly
120
+ * The smallest value representable as `PositiveFiniteNumber`.
120
121
  */
121
122
  MIN_VALUE,
122
123
 
123
124
  /**
124
- * Returns the smaller of two PositiveFiniteNumber values.
125
+ * Returns the smallest of the given positive finite numbers.
125
126
  *
126
- * @param a The first PositiveFiniteNumber.
127
- * @param b The second PositiveFiniteNumber.
128
- * @returns The minimum value as a PositiveFiniteNumber.
127
+ * @param values - The positive finite numbers to compare (at least one required)
128
+ * @returns The smallest value as a `PositiveFiniteNumber`
129
129
  */
130
130
  min: min_,
131
131
 
132
132
  /**
133
- * Returns the larger of two PositiveFiniteNumber values.
133
+ * Returns the largest of the given positive finite numbers.
134
134
  *
135
- * @param a The first PositiveFiniteNumber.
136
- * @param b The second PositiveFiniteNumber.
137
- * @returns The maximum value as a PositiveFiniteNumber.
135
+ * @param values - The positive finite numbers to compare (at least one required)
136
+ * @returns The largest value as a `PositiveFiniteNumber`
138
137
  */
139
138
  max: max_,
140
139
 
141
140
  /**
142
- * Clamps a number to the positive finite range.
141
+ * Clamps a `number` into the `PositiveFiniteNumber` range `[MIN_VALUE,
142
+ * MAX_VALUE]`.
143
143
  *
144
- * @param value The number to clamp.
145
- * @returns The value clamped to (0, +∞) as a PositiveFiniteNumber.
144
+ * @param value - The value to clamp
145
+ * @returns The clamped value as a `PositiveFiniteNumber`
146
146
  */
147
147
  clamp,
148
148
 
149
149
  /**
150
- * Rounds down a PositiveFiniteNumber to the nearest integer.
150
+ * Returns the greatest integer less than or equal to a positive finite
151
+ * number.
151
152
  *
152
- * @param x The PositiveFiniteNumber to round down.
153
- * @returns The floor value as a Uint (can be 0).
153
+ * @param a - The positive finite number value
154
+ * @returns The floored value as an integer
154
155
  */
155
156
  floor,
156
157
 
157
158
  /**
158
- * Rounds up a PositiveFiniteNumber to the nearest integer.
159
+ * Returns the smallest integer greater than or equal to a positive finite
160
+ * number.
159
161
  *
160
- * @param x The PositiveFiniteNumber to round up.
161
- * @returns The ceiling value as a PositiveInt (always >= 1).
162
+ * @param a - The positive finite number value
163
+ * @returns The ceiled value as an integer
162
164
  */
163
165
  ceil,
164
166
 
165
167
  /**
166
- * Rounds a PositiveFiniteNumber to the nearest integer.
168
+ * Returns the value of a positive finite number rounded to the nearest
169
+ * integer.
167
170
  *
168
- * @param x The PositiveFiniteNumber to round.
169
- * @returns The rounded value as a Uint (can be 0 if x < 0.5).
171
+ * @param a - The positive finite number value
172
+ * @returns The rounded value as an integer
170
173
  */
171
174
  round,
172
175
 
173
176
  /**
174
- * Generates a random PositiveFiniteNumber value.
177
+ * Generates a random `PositiveFiniteNumber` within the given range.
178
+ *
179
+ * The range is inclusive on both ends.
175
180
  *
176
- * @returns A random positive finite number.
181
+ * @param min - The minimum value (inclusive)
182
+ * @param max - The maximum value (inclusive)
183
+ * @returns A random `PositiveFiniteNumber` in `[min, max]`
177
184
  */
178
185
  random,
179
186
 
180
187
  /**
181
- * Raises a PositiveFiniteNumber to the power of another PositiveFiniteNumber.
188
+ * Raises `a` to the power `b`, returning `a ** b` as a
189
+ * `PositiveFiniteNumber`.
182
190
  *
183
- * @param a The base PositiveFiniteNumber.
184
- * @param b The exponent PositiveFiniteNumber.
185
- * @returns `a ** b` clamped to (0, +∞) as a PositiveFiniteNumber.
191
+ * @param a - The base positive finite number
192
+ * @param b - The exponent positive finite number
193
+ * @returns `a ** b` as a `PositiveFiniteNumber`
186
194
  */
187
195
  pow,
188
196
 
189
197
  /**
190
- * Adds two PositiveFiniteNumber values.
198
+ * Adds two positive finite numbers, returning `a + b` as a
199
+ * `PositiveFiniteNumber`.
191
200
  *
192
- * @param a The first PositiveFiniteNumber.
193
- * @param b The second PositiveFiniteNumber.
194
- * @returns `a + b` clamped to (0, +∞) as a PositiveFiniteNumber.
201
+ * @param a - The first positive finite number
202
+ * @param b - The second positive finite number
203
+ * @returns The sum of `a` and `b` as a `PositiveFiniteNumber`
195
204
  */
196
205
  add,
197
206
 
198
207
  /**
199
- * Subtracts one PositiveFiniteNumber from another.
208
+ * Subtracts two positive finite numbers, returning `a - b` as a
209
+ * `PositiveFiniteNumber`.
200
210
  *
201
- * @param a The minuend PositiveFiniteNumber.
202
- * @param b The subtrahend PositiveFiniteNumber.
203
- * @returns `a - b` clamped to (0, +∞) as a PositiveFiniteNumber (minimum
204
- * MIN_VALUE).
211
+ * @param a - The first positive finite number
212
+ * @param b - The second positive finite number
213
+ * @returns The difference of `a` and `b` as a `PositiveFiniteNumber`
205
214
  */
206
215
  sub,
207
216
 
208
217
  /**
209
- * Multiplies two PositiveFiniteNumber values.
218
+ * Multiplies two positive finite numbers, returning `a * b` as a
219
+ * `PositiveFiniteNumber`.
210
220
  *
211
- * @param a The first PositiveFiniteNumber.
212
- * @param b The second PositiveFiniteNumber.
213
- * @returns `a * b` clamped to (0, +∞) as a PositiveFiniteNumber.
221
+ * @param a - The first positive finite number
222
+ * @param b - The second positive finite number
223
+ * @returns The product of `a` and `b` as a `PositiveFiniteNumber`
214
224
  */
215
225
  mul,
216
226
 
217
227
  /**
218
- * Divides one PositiveFiniteNumber by another.
228
+ * Divides two positive finite numbers, returning `a / b` as a
229
+ * `PositiveFiniteNumber`.
219
230
  *
220
- * @param a The dividend PositiveFiniteNumber.
221
- * @param b The divisor PositiveFiniteNumber.
222
- * @returns `a / b` clamped to (0, +∞) as a PositiveFiniteNumber.
231
+ * @param a - The dividend
232
+ * @param b - The divisor (must be non-zero)
233
+ * @returns `a / b` as a `PositiveFiniteNumber`
223
234
  */
224
235
  div,
225
236
  } as const;