ts-data-forge 11.0.0 → 12.0.0

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 (185) hide show
  1. package/README.md +2 -2
  2. package/dist/number/branded-types/finite-number.d.mts +47 -61
  3. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  4. package/dist/number/branded-types/finite-number.mjs +37 -41
  5. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  6. package/dist/number/branded-types/int.d.mts +40 -46
  7. package/dist/number/branded-types/int.d.mts.map +1 -1
  8. package/dist/number/branded-types/int.mjs +29 -31
  9. package/dist/number/branded-types/int.mjs.map +1 -1
  10. package/dist/number/branded-types/int16.d.mts +71 -59
  11. package/dist/number/branded-types/int16.d.mts.map +1 -1
  12. package/dist/number/branded-types/int16.mjs +56 -47
  13. package/dist/number/branded-types/int16.mjs.map +1 -1
  14. package/dist/number/branded-types/int32.d.mts +71 -59
  15. package/dist/number/branded-types/int32.d.mts.map +1 -1
  16. package/dist/number/branded-types/int32.mjs +56 -47
  17. package/dist/number/branded-types/int32.mjs.map +1 -1
  18. package/dist/number/branded-types/negative-finite-number.d.mts +76 -60
  19. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  20. package/dist/number/branded-types/negative-finite-number.mjs +62 -49
  21. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  22. package/dist/number/branded-types/negative-int.d.mts +66 -49
  23. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  24. package/dist/number/branded-types/negative-int.mjs +48 -39
  25. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  26. package/dist/number/branded-types/negative-safe-int.d.mts +64 -57
  27. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  28. package/dist/number/branded-types/negative-safe-int.mjs +49 -44
  29. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  30. package/dist/number/branded-types/non-negative-finite-number.d.mts +80 -65
  31. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  32. package/dist/number/branded-types/non-negative-finite-number.mjs +65 -53
  33. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  34. package/dist/number/branded-types/non-negative-int16.d.mts +71 -58
  35. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  36. package/dist/number/branded-types/non-negative-int16.mjs +55 -45
  37. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  38. package/dist/number/branded-types/non-negative-int32.d.mts +71 -59
  39. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  40. package/dist/number/branded-types/non-negative-int32.mjs +55 -46
  41. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  42. package/dist/number/branded-types/non-positive-finite-number.d.mts +70 -55
  43. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  44. package/dist/number/branded-types/non-positive-finite-number.mjs +55 -43
  45. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  46. package/dist/number/branded-types/non-positive-int.d.mts +46 -146
  47. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  48. package/dist/number/branded-types/non-positive-int.mjs +33 -108
  49. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  50. package/dist/number/branded-types/non-positive-safe-int.d.mts +62 -54
  51. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  52. package/dist/number/branded-types/non-positive-safe-int.mjs +46 -41
  53. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  54. package/dist/number/branded-types/non-zero-finite-number.d.mts +62 -49
  55. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  56. package/dist/number/branded-types/non-zero-finite-number.mjs +46 -37
  57. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  58. package/dist/number/branded-types/non-zero-int.d.mts +51 -38
  59. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  60. package/dist/number/branded-types/non-zero-int.mjs +31 -27
  61. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  62. package/dist/number/branded-types/non-zero-int16.d.mts +59 -54
  63. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  64. package/dist/number/branded-types/non-zero-int16.mjs +44 -41
  65. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  66. package/dist/number/branded-types/non-zero-int32.d.mts +59 -55
  67. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  68. package/dist/number/branded-types/non-zero-int32.mjs +44 -42
  69. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  70. package/dist/number/branded-types/non-zero-safe-int.d.mts +60 -55
  71. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  72. package/dist/number/branded-types/non-zero-safe-int.mjs +44 -42
  73. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  74. package/dist/number/branded-types/non-zero-uint16.d.mts +59 -54
  75. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  76. package/dist/number/branded-types/non-zero-uint16.mjs +43 -41
  77. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  78. package/dist/number/branded-types/non-zero-uint32.d.mts +59 -54
  79. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  80. package/dist/number/branded-types/non-zero-uint32.mjs +43 -41
  81. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  82. package/dist/number/branded-types/positive-finite-number.d.mts +82 -64
  83. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  84. package/dist/number/branded-types/positive-finite-number.mjs +67 -52
  85. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  86. package/dist/number/branded-types/positive-int.d.mts +53 -70
  87. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  88. package/dist/number/branded-types/positive-int.mjs +42 -52
  89. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  90. package/dist/number/branded-types/positive-int16.d.mts +68 -58
  91. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  92. package/dist/number/branded-types/positive-int16.mjs +52 -45
  93. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  94. package/dist/number/branded-types/positive-int32.d.mts +68 -58
  95. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  96. package/dist/number/branded-types/positive-int32.mjs +52 -45
  97. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  98. package/dist/number/branded-types/positive-safe-int.d.mts +72 -61
  99. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  100. package/dist/number/branded-types/positive-safe-int.mjs +56 -48
  101. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  102. package/dist/number/branded-types/positive-uint16.d.mts +68 -58
  103. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  104. package/dist/number/branded-types/positive-uint16.mjs +52 -45
  105. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  106. package/dist/number/branded-types/positive-uint32.d.mts +68 -59
  107. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  108. package/dist/number/branded-types/positive-uint32.mjs +52 -46
  109. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  110. package/dist/number/branded-types/safe-int.d.mts +52 -66
  111. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  112. package/dist/number/branded-types/safe-int.mjs +45 -47
  113. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  114. package/dist/number/branded-types/safe-uint.d.mts +68 -58
  115. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  116. package/dist/number/branded-types/safe-uint.mjs +53 -46
  117. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  118. package/dist/number/branded-types/uint.d.mts +72 -55
  119. package/dist/number/branded-types/uint.d.mts.map +1 -1
  120. package/dist/number/branded-types/uint.mjs +52 -45
  121. package/dist/number/branded-types/uint.mjs.map +1 -1
  122. package/dist/number/branded-types/uint16.d.mts +66 -59
  123. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  124. package/dist/number/branded-types/uint16.mjs +51 -45
  125. package/dist/number/branded-types/uint16.mjs.map +1 -1
  126. package/dist/number/branded-types/uint32.d.mts +66 -57
  127. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  128. package/dist/number/branded-types/uint32.mjs +50 -45
  129. package/dist/number/branded-types/uint32.mjs.map +1 -1
  130. package/dist/number/enum/int8.d.mts +62 -66
  131. package/dist/number/enum/int8.d.mts.map +1 -1
  132. package/dist/number/enum/int8.mjs +57 -51
  133. package/dist/number/enum/int8.mjs.map +1 -1
  134. package/dist/number/enum/uint8.d.mts +66 -59
  135. package/dist/number/enum/uint8.d.mts.map +1 -1
  136. package/dist/number/enum/uint8.mjs +57 -51
  137. package/dist/number/enum/uint8.mjs.map +1 -1
  138. package/dist/number/refined-number-utils.d.mts +9 -9
  139. package/dist/number/refined-number-utils.d.mts.map +1 -1
  140. package/dist/number/refined-number-utils.mjs +7 -7
  141. package/dist/number/refined-number-utils.mjs.map +1 -1
  142. package/package.json +2 -1
  143. package/src/number/branded-types/finite-number.mts +47 -61
  144. package/src/number/branded-types/int.mts +40 -46
  145. package/src/number/branded-types/int16.mts +72 -60
  146. package/src/number/branded-types/int32.mts +72 -60
  147. package/src/number/branded-types/negative-finite-number.mts +78 -71
  148. package/src/number/branded-types/negative-finite-number.test.mts +4 -4
  149. package/src/number/branded-types/negative-int.mts +68 -60
  150. package/src/number/branded-types/negative-int.test.mts +5 -5
  151. package/src/number/branded-types/negative-safe-int.mts +66 -68
  152. package/src/number/branded-types/negative-safe-int.test.mts +4 -4
  153. package/src/number/branded-types/non-negative-finite-number.mts +81 -66
  154. package/src/number/branded-types/non-negative-int16.mts +72 -59
  155. package/src/number/branded-types/non-negative-int32.mts +72 -60
  156. package/src/number/branded-types/non-positive-finite-number.mts +71 -56
  157. package/src/number/branded-types/non-positive-finite-number.test.mts +7 -7
  158. package/src/number/branded-types/non-positive-int.mts +47 -147
  159. package/src/number/branded-types/non-positive-int.test.mts +7 -7
  160. package/src/number/branded-types/non-positive-safe-int.mts +63 -55
  161. package/src/number/branded-types/non-positive-safe-int.test.mts +7 -7
  162. package/src/number/branded-types/non-zero-finite-number.mts +62 -51
  163. package/src/number/branded-types/non-zero-int.mts +51 -38
  164. package/src/number/branded-types/non-zero-int16.mts +60 -55
  165. package/src/number/branded-types/non-zero-int32.mts +60 -56
  166. package/src/number/branded-types/non-zero-safe-int.mts +61 -56
  167. package/src/number/branded-types/non-zero-uint16.mts +60 -55
  168. package/src/number/branded-types/non-zero-uint32.mts +60 -55
  169. package/src/number/branded-types/positive-finite-number.mts +83 -65
  170. package/src/number/branded-types/positive-int.mts +54 -71
  171. package/src/number/branded-types/positive-int16.mts +69 -59
  172. package/src/number/branded-types/positive-int32.mts +69 -59
  173. package/src/number/branded-types/positive-safe-int.mts +73 -62
  174. package/src/number/branded-types/positive-uint16.mts +69 -59
  175. package/src/number/branded-types/positive-uint32.mts +69 -60
  176. package/src/number/branded-types/safe-int.mts +53 -67
  177. package/src/number/branded-types/safe-uint.mts +69 -59
  178. package/src/number/branded-types/uint.mts +73 -56
  179. package/src/number/branded-types/uint16.mts +67 -60
  180. package/src/number/branded-types/uint32.mts +67 -58
  181. package/src/number/enum/int8.mts +70 -73
  182. package/src/number/enum/int8.test.mts +7 -4
  183. package/src/number/enum/uint8.mts +74 -66
  184. package/src/number/enum/uint8.test.mts +7 -4
  185. package/src/number/refined-number-utils.mts +22 -19
@@ -1,19 +1,24 @@
1
1
  import { type NonPositiveSafeInt as TtfImported_NonPositiveSafeInt } from 'ts-type-forge';
2
2
  export type NonPositiveSafeInt = TtfImported_NonPositiveSafeInt;
3
3
  /**
4
- * Checks if a number is a NonPositiveSafeInt (non-positive safe integer in the
5
- * range [Number.MIN_SAFE_INTEGER, 0]).
4
+ * Type guard that checks if a value is a non-positive safe integer.
6
5
  *
7
- * @param value The value to check.
8
- * @returns `true` if the value is a NonPositiveSafeInt, `false` otherwise.
6
+ * Returns `true` for a non-positive safe integer — a value with no fractional
7
+ * component.
8
+ *
9
+ * @param value - The value to check
10
+ * @returns `true` if the value is a non-positive safe integer, `false` otherwise
9
11
  */
10
12
  export declare const isNonPositiveSafeInt: (a: number) => a is TtfImported_NonPositiveSafeInt;
11
13
  /**
12
- * Casts a number to a NonPositiveSafeInt type.
14
+ * Casts a `number` to the `NonPositiveSafeInt` branded type.
15
+ *
16
+ * Validates that the value is a non-positive safe integer and returns it with
17
+ * the `NonPositiveSafeInt` brand. Throws a `TypeError` otherwise.
13
18
  *
14
- * @param value The value to cast.
15
- * @returns The value as a NonPositiveSafeInt type.
16
- * @throws {TypeError} If the value is not a non-positive safe integer.
19
+ * @param value - The value to cast
20
+ * @returns The value as a `NonPositiveSafeInt`
21
+ * @throws {TypeError} If the value is not a non-positive safe integer
17
22
  */
18
23
  export declare const asNonPositiveSafeInt: <N extends number>(x: N) => number & {
19
24
  readonly "< 2^15": true;
@@ -29,90 +34,93 @@ export declare const asNonPositiveSafeInt: <N extends number>(x: N) => number &
29
34
  'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
30
35
  }> & N;
31
36
  /**
32
- * Namespace providing type-safe arithmetic operations for non-positive
33
- * safe integers.
37
+ * Namespace providing type-safe operations for the `NonPositiveSafeInt` branded
38
+ * type.
34
39
  *
35
- * All operations automatically clamp results to the valid NonPositiveSafeInt
36
- * range [Number.MIN_SAFE_INTEGER, 0]. This ensures that all arithmetic
37
- * maintains the non-positive safe integer constraint, with positive results
38
- * clamped to 0 and underflow results clamped to MIN_VALUE.
40
+ * The `NonPositiveSafeInt` type represents a non-positive safe integer.
41
+ * Division (`div`) uses floor division.
39
42
  */
40
43
  export declare const NonPositiveSafeInt: {
41
44
  /**
42
- * Type guard to check if a value is a NonPositiveSafeInt.
45
+ * Type guard that checks if a value is a non-positive safe integer.
43
46
  *
44
- * @param value The value to check.
45
- * @returns `true` if the value is a non-positive safe integer, `false`
46
- * otherwise.
47
+ * @param value - The value to check
48
+ * @returns `true` if the value is a non-positive safe integer, `false` otherwise
49
+ * @see {@link isNonPositiveSafeInt} for usage examples
47
50
  */
48
51
  readonly is: (a: number) => a is TtfImported_NonPositiveSafeInt;
49
52
  /**
50
- * The minimum value for a non-positive safe integer.
51
- *
52
- * @readonly
53
+ * The smallest value representable as `NonPositiveSafeInt` (the lower
54
+ * saturation target of `fromNumber`).
53
55
  */
54
56
  readonly MIN_VALUE: number;
55
57
  /**
56
- * The maximum value for a non-positive safe integer.
57
- *
58
- * @readonly
58
+ * The largest value representable as `NonPositiveSafeInt` (the upper
59
+ * saturation target of `fromNumber`).
59
60
  */
60
61
  readonly MAX_VALUE: 0;
61
62
  /**
62
- * Returns the smaller of two NonPositiveSafeInt values.
63
+ * Returns the smallest of the given non-positive safe integers.
63
64
  *
64
- * @param a The first NonPositiveSafeInt.
65
- * @param b The second NonPositiveSafeInt.
66
- * @returns The minimum value as a NonPositiveSafeInt.
65
+ * @param values - The non-positive safe integers to compare (at least one required)
66
+ * @returns The smallest value as a `NonPositiveSafeInt`
67
67
  */
68
68
  readonly min: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>[]) => TtfImported_NonPositiveSafeInt;
69
69
  /**
70
- * Returns the larger of two NonPositiveSafeInt values.
70
+ * Returns the largest of the given non-positive safe integers.
71
71
  *
72
- * @param a The first NonPositiveSafeInt.
73
- * @param b The second NonPositiveSafeInt.
74
- * @returns The maximum value as a NonPositiveSafeInt.
72
+ * @param values - The non-positive safe integers to compare (at least one required)
73
+ * @returns The largest value as a `NonPositiveSafeInt`
75
74
  */
76
75
  readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>[]) => TtfImported_NonPositiveSafeInt;
77
76
  /**
78
- * Clamps a number to the NonPositiveSafeInt range.
77
+ * Converts an arbitrary `number` into a `NonPositiveSafeInt`, rounding to the
78
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
79
+ * MAX_VALUE]`.
80
+ *
81
+ * Unlike `asNonPositiveSafeInt`, this is total: out-of-range inputs are
82
+ * clamped to the nearest representable `NonPositiveSafeInt` instead of
83
+ * throwing.
79
84
  *
80
- * @param value The number to clamp.
81
- * @returns The value clamped to [Number.MIN_SAFE_INTEGER, 0] as a
82
- * NonPositiveSafeInt.
85
+ * @param value - The value to convert
86
+ * @returns The value as a `NonPositiveSafeInt`
83
87
  */
84
- readonly clamp: (x: number) => TtfImported_NonPositiveSafeInt;
88
+ readonly fromNumber: (x: number) => TtfImported_NonPositiveSafeInt;
85
89
  /**
86
- * Generates a random NonPositiveSafeInt value within the valid range.
90
+ * Generates a random `NonPositiveSafeInt` within the given range.
91
+ *
92
+ * The range is inclusive on both ends.
87
93
  *
88
- * @returns A random NonPositiveSafeInt between Number.MIN_SAFE_INTEGER and 0.
94
+ * @param min - The minimum value (inclusive)
95
+ * @param max - The maximum value (inclusive)
96
+ * @returns A random `NonPositiveSafeInt` in `[min, max]`
89
97
  */
90
98
  readonly random: (min?: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt> | undefined, max?: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt> | undefined) => TtfImported_NonPositiveSafeInt;
91
99
  /**
92
- * Raises a NonPositiveSafeInt to the power of another NonPositiveSafeInt.
100
+ * Raises `a` to the power `b`, returning `a ** b` as a `NonPositiveSafeInt`
101
+ * (floored to an integer).
93
102
  *
94
- * @param a The base NonPositiveSafeInt.
95
- * @param b The exponent NonPositiveSafeInt.
96
- * @returns `a ** b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
97
- * NonPositiveSafeInt.
103
+ * @param a - The base non-positive safe integer
104
+ * @param b - The exponent non-positive safe integer
105
+ * @returns `a ** b` as a `NonPositiveSafeInt`
98
106
  */
99
107
  readonly pow: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>) => TtfImported_NonPositiveSafeInt;
100
108
  /**
101
- * Adds two NonPositiveSafeInt values.
109
+ * Adds two non-positive safe integers, returning `a + b` as a
110
+ * `NonPositiveSafeInt`.
102
111
  *
103
- * @param a The first NonPositiveSafeInt.
104
- * @param b The second NonPositiveSafeInt.
105
- * @returns `a + b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
106
- * NonPositiveSafeInt.
112
+ * @param a - The first non-positive safe integer
113
+ * @param b - The second non-positive safe integer
114
+ * @returns The sum of `a` and `b` as a `NonPositiveSafeInt`
107
115
  */
108
116
  readonly add: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>) => TtfImported_NonPositiveSafeInt;
109
117
  /**
110
- * Subtracts one NonPositiveSafeInt from another.
118
+ * Subtracts two non-positive safe integers, returning `a - b` as a
119
+ * `NonPositiveSafeInt`.
111
120
  *
112
- * @param a The minuend NonPositiveSafeInt.
113
- * @param b The subtrahend NonPositiveSafeInt.
114
- * @returns `a - b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
115
- * NonPositiveSafeInt (maximum 0).
121
+ * @param a - The first non-positive safe integer
122
+ * @param b - The second non-positive safe integer
123
+ * @returns The difference of `a` and `b` as a `NonPositiveSafeInt`
116
124
  */
117
125
  readonly sub: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>) => TtfImported_NonPositiveSafeInt;
118
126
  };
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,IAAI,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAG1F,MAAM,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AA6BhE;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,oDAAK,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;MAAW,CAAC;AAE7C;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;IAC7B;;;;;;OAMG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;OAIG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,IAAI,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAG1F,MAAM,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AA6BhE;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,oDAAK,CAAC;AAEvC;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;MAAW,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;IAC7B;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;;OAWG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
@@ -6,7 +6,7 @@ const {
6
6
  MIN_VALUE,
7
7
  add,
8
8
  castType,
9
- clamp,
9
+ fromNumber,
10
10
  is,
11
11
  max: max_,
12
12
  min: min_,
@@ -23,80 +23,85 @@ const isNonPositiveSafeInt = is;
23
23
  const asNonPositiveSafeInt = castType;
24
24
  const NonPositiveSafeInt = {
25
25
  /**
26
- * Type guard to check if a value is a NonPositiveSafeInt.
26
+ * Type guard that checks if a value is a non-positive safe integer.
27
27
  *
28
- * @param value The value to check.
29
- * @returns `true` if the value is a non-positive safe integer, `false`
30
- * otherwise.
28
+ * @param value - The value to check
29
+ * @returns `true` if the value is a non-positive safe integer, `false` otherwise
30
+ * @see {@link isNonPositiveSafeInt} for usage examples
31
31
  */
32
32
  is,
33
33
  /**
34
- * The minimum value for a non-positive safe integer.
35
- *
36
- * @readonly
34
+ * The smallest value representable as `NonPositiveSafeInt` (the lower
35
+ * saturation target of `fromNumber`).
37
36
  */
38
37
  MIN_VALUE,
39
38
  /**
40
- * The maximum value for a non-positive safe integer.
41
- *
42
- * @readonly
39
+ * The largest value representable as `NonPositiveSafeInt` (the upper
40
+ * saturation target of `fromNumber`).
43
41
  */
44
42
  MAX_VALUE,
45
43
  /**
46
- * Returns the smaller of two NonPositiveSafeInt values.
44
+ * Returns the smallest of the given non-positive safe integers.
47
45
  *
48
- * @param a The first NonPositiveSafeInt.
49
- * @param b The second NonPositiveSafeInt.
50
- * @returns The minimum value as a NonPositiveSafeInt.
46
+ * @param values - The non-positive safe integers to compare (at least one required)
47
+ * @returns The smallest value as a `NonPositiveSafeInt`
51
48
  */
52
49
  min: min_,
53
50
  /**
54
- * Returns the larger of two NonPositiveSafeInt values.
51
+ * Returns the largest of the given non-positive safe integers.
55
52
  *
56
- * @param a The first NonPositiveSafeInt.
57
- * @param b The second NonPositiveSafeInt.
58
- * @returns The maximum value as a NonPositiveSafeInt.
53
+ * @param values - The non-positive safe integers to compare (at least one required)
54
+ * @returns The largest value as a `NonPositiveSafeInt`
59
55
  */
60
56
  max: max_,
61
57
  /**
62
- * Clamps a number to the NonPositiveSafeInt range.
58
+ * Converts an arbitrary `number` into a `NonPositiveSafeInt`, rounding to the
59
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
60
+ * MAX_VALUE]`.
63
61
  *
64
- * @param value The number to clamp.
65
- * @returns The value clamped to [Number.MIN_SAFE_INTEGER, 0] as a
66
- * NonPositiveSafeInt.
62
+ * Unlike `asNonPositiveSafeInt`, this is total: out-of-range inputs are
63
+ * clamped to the nearest representable `NonPositiveSafeInt` instead of
64
+ * throwing.
65
+ *
66
+ * @param value - The value to convert
67
+ * @returns The value as a `NonPositiveSafeInt`
67
68
  */
68
- clamp,
69
+ fromNumber,
69
70
  /**
70
- * Generates a random NonPositiveSafeInt value within the valid range.
71
+ * Generates a random `NonPositiveSafeInt` within the given range.
72
+ *
73
+ * The range is inclusive on both ends.
71
74
  *
72
- * @returns A random NonPositiveSafeInt between Number.MIN_SAFE_INTEGER and 0.
75
+ * @param min - The minimum value (inclusive)
76
+ * @param max - The maximum value (inclusive)
77
+ * @returns A random `NonPositiveSafeInt` in `[min, max]`
73
78
  */
74
79
  random,
75
80
  /**
76
- * Raises a NonPositiveSafeInt to the power of another NonPositiveSafeInt.
81
+ * Raises `a` to the power `b`, returning `a ** b` as a `NonPositiveSafeInt`
82
+ * (floored to an integer).
77
83
  *
78
- * @param a The base NonPositiveSafeInt.
79
- * @param b The exponent NonPositiveSafeInt.
80
- * @returns `a ** b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
81
- * NonPositiveSafeInt.
84
+ * @param a - The base non-positive safe integer
85
+ * @param b - The exponent non-positive safe integer
86
+ * @returns `a ** b` as a `NonPositiveSafeInt`
82
87
  */
83
88
  pow,
84
89
  /**
85
- * Adds two NonPositiveSafeInt values.
90
+ * Adds two non-positive safe integers, returning `a + b` as a
91
+ * `NonPositiveSafeInt`.
86
92
  *
87
- * @param a The first NonPositiveSafeInt.
88
- * @param b The second NonPositiveSafeInt.
89
- * @returns `a + b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
90
- * NonPositiveSafeInt.
93
+ * @param a - The first non-positive safe integer
94
+ * @param b - The second non-positive safe integer
95
+ * @returns The sum of `a` and `b` as a `NonPositiveSafeInt`
91
96
  */
92
97
  add,
93
98
  /**
94
- * Subtracts one NonPositiveSafeInt from another.
99
+ * Subtracts two non-positive safe integers, returning `a - b` as a
100
+ * `NonPositiveSafeInt`.
95
101
  *
96
- * @param a The minuend NonPositiveSafeInt.
97
- * @param b The subtrahend NonPositiveSafeInt.
98
- * @returns `a - b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
99
- * NonPositiveSafeInt (maximum 0).
102
+ * @param a - The first non-positive safe integer
103
+ * @param b - The second non-positive safe integer
104
+ * @returns The difference of `a` and `b` as a `NonPositiveSafeInt`
100
105
  */
101
106
  sub
102
107
  };
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-safe-int.mjs","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"sourcesContent":["import { type NonPositiveSafeInt as TtfImported_NonPositiveSafeInt } from 'ts-type-forge';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type NonPositiveSafeInt = TtfImported_NonPositiveSafeInt;\n\ntype ElementType = NonPositiveSafeInt;\n\nconst typeNameInMessage = 'a non-positive safe integer';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n clamp,\n is,\n max: max_,\n min: min_,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n number,\n 0\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: Number.MIN_SAFE_INTEGER,\n MAX_VALUE: 0,\n typeNameInMessage,\n} as const);\n\n/**\n * Checks if a number is a NonPositiveSafeInt (non-positive safe integer in the\n * range [Number.MIN_SAFE_INTEGER, 0]).\n *\n * @param value The value to check.\n * @returns `true` if the value is a NonPositiveSafeInt, `false` otherwise.\n */\nexport const isNonPositiveSafeInt = is;\n\n/**\n * Casts a number to a NonPositiveSafeInt type.\n *\n * @param value The value to cast.\n * @returns The value as a NonPositiveSafeInt type.\n * @throws {TypeError} If the value is not a non-positive safe integer.\n */\nexport const asNonPositiveSafeInt = castType;\n\n/**\n * Namespace providing type-safe arithmetic operations for non-positive\n * safe integers.\n *\n * All operations automatically clamp results to the valid NonPositiveSafeInt\n * range [Number.MIN_SAFE_INTEGER, 0]. This ensures that all arithmetic\n * maintains the non-positive safe integer constraint, with positive results\n * clamped to 0 and underflow results clamped to MIN_VALUE.\n */\nexport const NonPositiveSafeInt = {\n /**\n * Type guard to check if a value is a NonPositiveSafeInt.\n *\n * @param value The value to check.\n * @returns `true` if the value is a non-positive safe integer, `false`\n * otherwise.\n */\n is,\n\n /**\n * The minimum value for a non-positive safe integer.\n *\n * @readonly\n */\n MIN_VALUE,\n\n /**\n * The maximum value for a non-positive safe integer.\n *\n * @readonly\n */\n MAX_VALUE,\n\n /**\n * Returns the smaller of two NonPositiveSafeInt values.\n *\n * @param a The first NonPositiveSafeInt.\n * @param b The second NonPositiveSafeInt.\n * @returns The minimum value as a NonPositiveSafeInt.\n */\n min: min_,\n\n /**\n * Returns the larger of two NonPositiveSafeInt values.\n *\n * @param a The first NonPositiveSafeInt.\n * @param b The second NonPositiveSafeInt.\n * @returns The maximum value as a NonPositiveSafeInt.\n */\n max: max_,\n\n /**\n * Clamps a number to the NonPositiveSafeInt range.\n *\n * @param value The number to clamp.\n * @returns The value clamped to [Number.MIN_SAFE_INTEGER, 0] as a\n * NonPositiveSafeInt.\n */\n clamp,\n\n /**\n * Generates a random NonPositiveSafeInt value within the valid range.\n *\n * @returns A random NonPositiveSafeInt between Number.MIN_SAFE_INTEGER and 0.\n */\n random,\n\n /**\n * Raises a NonPositiveSafeInt to the power of another NonPositiveSafeInt.\n *\n * @param a The base NonPositiveSafeInt.\n * @param b The exponent NonPositiveSafeInt.\n * @returns `a ** b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a\n * NonPositiveSafeInt.\n */\n pow,\n\n /**\n * Adds two NonPositiveSafeInt values.\n *\n * @param a The first NonPositiveSafeInt.\n * @param b The second NonPositiveSafeInt.\n * @returns `a + b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a\n * NonPositiveSafeInt.\n */\n add,\n\n /**\n * Subtracts one NonPositiveSafeInt from another.\n *\n * @param a The minuend NonPositiveSafeInt.\n * @param b The subtrahend NonPositiveSafeInt.\n * @returns `a - b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a\n * NonPositiveSafeInt (maximum 0).\n */\n sub,\n} as const;\n"],"names":[],"mappings":";;AAOA,MAAM,iBAAA,GAAoB,6BAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,WAAW,MAAA,CAAO,gBAAA;AAAA,EAClB,SAAA,EAAW,CAAA;AAAA,EACX;AACF,CAAU,CAAA;AASH,MAAM,oBAAA,GAAuB;AAS7B,MAAM,oBAAA,GAAuB;AAW7B,MAAM,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhC,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
1
+ {"version":3,"file":"non-positive-safe-int.mjs","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"sourcesContent":["import { type NonPositiveSafeInt as TtfImported_NonPositiveSafeInt } from 'ts-type-forge';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type NonPositiveSafeInt = TtfImported_NonPositiveSafeInt;\n\ntype ElementType = NonPositiveSafeInt;\n\nconst typeNameInMessage = 'a non-positive safe integer';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n fromNumber,\n is,\n max: max_,\n min: min_,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n number,\n 0\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: Number.MIN_SAFE_INTEGER,\n MAX_VALUE: 0,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a non-positive safe integer.\n *\n * Returns `true` for a non-positive safe integer — a value with no fractional\n * component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-positive safe integer, `false` otherwise\n */\nexport const isNonPositiveSafeInt = is;\n\n/**\n * Casts a `number` to the `NonPositiveSafeInt` branded type.\n *\n * Validates that the value is a non-positive safe integer and returns it with\n * the `NonPositiveSafeInt` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as a `NonPositiveSafeInt`\n * @throws {TypeError} If the value is not a non-positive safe integer\n */\nexport const asNonPositiveSafeInt = castType;\n\n/**\n * Namespace providing type-safe operations for the `NonPositiveSafeInt` branded\n * type.\n *\n * The `NonPositiveSafeInt` type represents a non-positive safe integer.\n * Division (`div`) uses floor division.\n */\nexport const NonPositiveSafeInt = {\n /**\n * Type guard that checks if a value is a non-positive safe integer.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-positive safe integer, `false` otherwise\n * @see {@link isNonPositiveSafeInt} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `NonPositiveSafeInt` (the lower\n * saturation target of `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `NonPositiveSafeInt` (the upper\n * saturation target of `fromNumber`).\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given non-positive safe integers.\n *\n * @param values - The non-positive safe integers to compare (at least one required)\n * @returns The smallest value as a `NonPositiveSafeInt`\n */\n min: min_,\n\n /**\n * Returns the largest of the given non-positive safe integers.\n *\n * @param values - The non-positive safe integers to compare (at least one required)\n * @returns The largest value as a `NonPositiveSafeInt`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into a `NonPositiveSafeInt`, rounding to the\n * nearest integer and saturating the result into the range `[MIN_VALUE,\n * MAX_VALUE]`.\n *\n * Unlike `asNonPositiveSafeInt`, this is total: out-of-range inputs are\n * clamped to the nearest representable `NonPositiveSafeInt` instead of\n * throwing.\n *\n * @param value - The value to convert\n * @returns The value as a `NonPositiveSafeInt`\n */\n fromNumber,\n\n /**\n * Generates a random `NonPositiveSafeInt` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `NonPositiveSafeInt` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a `NonPositiveSafeInt`\n * (floored to an integer).\n *\n * @param a - The base non-positive safe integer\n * @param b - The exponent non-positive safe integer\n * @returns `a ** b` as a `NonPositiveSafeInt`\n */\n pow,\n\n /**\n * Adds two non-positive safe integers, returning `a + b` as a\n * `NonPositiveSafeInt`.\n *\n * @param a - The first non-positive safe integer\n * @param b - The second non-positive safe integer\n * @returns The sum of `a` and `b` as a `NonPositiveSafeInt`\n */\n add,\n\n /**\n * Subtracts two non-positive safe integers, returning `a - b` as a\n * `NonPositiveSafeInt`.\n *\n * @param a - The first non-positive safe integer\n * @param b - The second non-positive safe integer\n * @returns The difference of `a` and `b` as a `NonPositiveSafeInt`\n */\n sub,\n} as const;\n"],"names":[],"mappings":";;AAOA,MAAM,iBAAA,GAAoB,6BAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,WAAW,MAAA,CAAO,gBAAA;AAAA,EAClB,SAAA,EAAW,CAAA;AAAA,EACX;AACF,CAAU,CAAA;AAWH,MAAM,oBAAA,GAAuB;AAY7B,MAAM,oBAAA,GAAuB;AAS7B,MAAM,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhC,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcL,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
@@ -3,18 +3,24 @@ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
3
3
  export type NonZeroFiniteNumber = TtfImported_NonZeroFiniteNumber;
4
4
  type ElementType = NonZeroFiniteNumber;
5
5
  /**
6
- * Checks if a number is a NonZeroFiniteNumber (a finite number that is not 0).
6
+ * Type guard that checks if a value is a non-zero finite number.
7
7
  *
8
- * @param value The value to check.
9
- * @returns `true` if the value is a NonZeroFiniteNumber, `false` otherwise.
8
+ * Returns `true` only for a finite value — never `NaN`, `Infinity`, or
9
+ * `-Infinity`.
10
+ *
11
+ * @param value - The value to check
12
+ * @returns `true` if the value is a non-zero finite number, `false` otherwise
10
13
  */
11
14
  export declare const isNonZeroFiniteNumber: (a: number) => a is TtfImported_NonZeroFiniteNumber;
12
15
  /**
13
- * Casts a number to a NonZeroFiniteNumber type.
16
+ * Casts a `number` to the `NonZeroFiniteNumber` branded type.
17
+ *
18
+ * Validates that the value is a non-zero finite number and returns it with the
19
+ * `NonZeroFiniteNumber` brand. Throws a `TypeError` otherwise.
14
20
  *
15
- * @param value The value to cast.
16
- * @returns The value as a NonZeroFiniteNumber type.
17
- * @throws {TypeError} If the value is not a non-zero finite number.
21
+ * @param value - The value to cast
22
+ * @returns The value as a `NonZeroFiniteNumber`
23
+ * @throws {TypeError} If the value is not a non-zero finite number
18
24
  */
19
25
  export declare const asNonZeroFiniteNumber: <N extends number>(x: N) => number & {
20
26
  readonly "!=0": true;
@@ -24,98 +30,105 @@ export declare const asNonZeroFiniteNumber: <N extends number>(x: N) => number &
24
30
  'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
25
31
  }> & N;
26
32
  /**
27
- * Namespace providing type-safe arithmetic operations for non-zero finite
28
- * numbers.
33
+ * Namespace providing type-safe operations for the `NonZeroFiniteNumber`
34
+ * branded type.
29
35
  *
30
- * All operations maintain the non-zero constraint while ensuring results remain
31
- * finite (excluding NaN and Infinity). This type is useful for values that must
32
- * never be zero, such as denominators, scaling factors, and ratios.
36
+ * The `NonZeroFiniteNumber` type represents a non-zero finite number.
33
37
  */
34
38
  export declare const NonZeroFiniteNumber: {
35
39
  /**
36
- * Type guard to check if a value is a NonZeroFiniteNumber.
40
+ * Type guard that checks if a value is a non-zero finite number.
37
41
  *
38
- * @param value The value to check.
39
- * @returns `true` if the value is a non-zero finite number, `false`
40
- * otherwise.
42
+ * @param value - The value to check
43
+ * @returns `true` if the value is a non-zero finite number, `false` otherwise
44
+ * @see {@link isNonZeroFiniteNumber} for usage examples
41
45
  */
42
46
  readonly is: (a: number) => a is TtfImported_NonZeroFiniteNumber;
43
47
  /**
44
48
  * Returns the absolute value of a non-zero finite number.
45
49
  *
46
- * @param a The NonZeroFiniteNumber.
47
- * @returns The absolute value as a NonZeroFiniteNumber.
50
+ * The result is non-negative and keeps the `NonZeroFiniteNumber` brand.
51
+ *
52
+ * @param a - The non-zero finite number value
53
+ * @returns The absolute value as a non-negative `NonZeroFiniteNumber`
48
54
  */
49
55
  readonly abs: (x: TtfImported_NonZeroFiniteNumber) => import("ts-type-forge").IntersectBrand<TtfImported_NonZeroFiniteNumber, import("ts-type-forge").PositiveNumber>;
50
56
  /**
51
- * Returns the smaller of two NonZeroFiniteNumber values.
57
+ * Returns the smallest of the given non-zero finite numbers.
52
58
  *
53
- * @param a The first NonZeroFiniteNumber.
54
- * @param b The second NonZeroFiniteNumber.
55
- * @returns The minimum value as a NonZeroFiniteNumber.
59
+ * @param values - The non-zero finite numbers to compare (at least one required)
60
+ * @returns The smallest value as a `NonZeroFiniteNumber`
56
61
  */
57
62
  readonly min: (...values: readonly TtfImported_NonZeroFiniteNumber[]) => TtfImported_NonZeroFiniteNumber;
58
63
  /**
59
- * Returns the larger of two NonZeroFiniteNumber values.
64
+ * Returns the largest of the given non-zero finite numbers.
60
65
  *
61
- * @param a The first NonZeroFiniteNumber.
62
- * @param b The second NonZeroFiniteNumber.
63
- * @returns The maximum value as a NonZeroFiniteNumber.
66
+ * @param values - The non-zero finite numbers to compare (at least one required)
67
+ * @returns The largest value as a `NonZeroFiniteNumber`
64
68
  */
65
69
  readonly max: (...values: readonly TtfImported_NonZeroFiniteNumber[]) => TtfImported_NonZeroFiniteNumber;
66
70
  /**
67
- * Rounds down a NonZeroFiniteNumber to the nearest integer.
71
+ * Returns the greatest integer less than or equal to a non-zero finite
72
+ * number.
68
73
  *
69
- * @param x The NonZeroFiniteNumber to round down.
70
- * @returns The floor value as a NonZeroInt.
74
+ * @param a - The non-zero finite number value
75
+ * @returns The floored value as an integer
71
76
  */
72
77
  readonly floor: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
73
78
  /**
74
- * Rounds up a NonZeroFiniteNumber to the nearest integer.
79
+ * Returns the smallest integer greater than or equal to a non-zero finite
80
+ * number.
75
81
  *
76
- * @param x The NonZeroFiniteNumber to round up.
77
- * @returns The ceiling value as a NonZeroInt.
82
+ * @param a - The non-zero finite number value
83
+ * @returns The ceiled value as an integer
78
84
  */
79
85
  readonly ceil: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
80
86
  /**
81
- * Rounds a NonZeroFiniteNumber to the nearest integer.
87
+ * Returns the value of a non-zero finite number rounded to the nearest
88
+ * integer.
82
89
  *
83
- * @param x The NonZeroFiniteNumber to round.
84
- * @returns The rounded value as a NonZeroInt.
90
+ * @param a - The non-zero finite number value
91
+ * @returns The rounded value as an integer
85
92
  */
86
93
  readonly round: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
87
94
  /**
88
- * Generates a random NonZeroFiniteNumber value.
95
+ * Generates a random `NonZeroFiniteNumber` within the given range.
96
+ *
97
+ * The range is inclusive on both ends.
89
98
  *
90
- * @returns A random non-zero finite number.
99
+ * @param min - The minimum value (inclusive)
100
+ * @param max - The maximum value (inclusive)
101
+ * @returns A random `NonZeroFiniteNumber` in `[min, max]`
91
102
  */
92
103
  readonly random: (min?: TtfImported_NonZeroFiniteNumber | undefined, max?: TtfImported_NonZeroFiniteNumber | undefined) => TtfImported_NonZeroFiniteNumber;
93
104
  /**
94
- * Raises a NonZeroFiniteNumber to the power of another NonZeroFiniteNumber.
105
+ * Raises `a` to the power `b`, returning `a ** b` as a `NonZeroFiniteNumber`.
95
106
  *
96
- * @param a The base NonZeroFiniteNumber.
97
- * @param b The exponent NonZeroFiniteNumber.
98
- * @returns `a ** b` as a NonZeroFiniteNumber.
107
+ * @param a - The base non-zero finite number
108
+ * @param b - The exponent non-zero finite number
109
+ * @returns `a ** b` as a `NonZeroFiniteNumber`
99
110
  */
100
111
  readonly pow: (x: TtfImported_NonZeroFiniteNumber, y: TtfImported_NonZeroFiniteNumber) => TtfImported_NonZeroFiniteNumber;
101
112
  /**
102
- * Multiplies two NonZeroFiniteNumber values.
113
+ * Multiplies two non-zero finite numbers, returning `a * b` as a
114
+ * `NonZeroFiniteNumber`.
103
115
  *
104
- * @param a The first NonZeroFiniteNumber.
105
- * @param b The second NonZeroFiniteNumber.
106
- * @returns `a * b` as a NonZeroFiniteNumber.
116
+ * @param a - The first non-zero finite number
117
+ * @param b - The second non-zero finite number
118
+ * @returns The product of `a` and `b` as a `NonZeroFiniteNumber`
107
119
  */
108
120
  readonly mul: (x: TtfImported_NonZeroFiniteNumber, y: TtfImported_NonZeroFiniteNumber) => TtfImported_NonZeroFiniteNumber;
109
121
  /**
110
- * Divides one NonZeroFiniteNumber by another.
122
+ * Divides two non-zero finite numbers, returning `a / b` as a
123
+ * `NonZeroFiniteNumber`.
111
124
  *
112
125
  * Exact (non-flooring) division of two non-zero finite numbers is always
113
126
  * non-zero, so this stays closed. For the non-closed operations (`add`/`sub`,
114
127
  * whose result may be `0`) use {@link Num.add}/{@link Num.sub}.
115
128
  *
116
- * @param a The dividend NonZeroFiniteNumber.
117
- * @param b The divisor NonZeroFiniteNumber.
118
- * @returns `a / b` as a NonZeroFiniteNumber.
129
+ * @param a - The dividend
130
+ * @param b - The divisor (must be non-zero)
131
+ * @returns `a / b` as a `NonZeroFiniteNumber`
119
132
  */
120
133
  readonly div: (x: TtfImported_NonZeroFiniteNumber, y: number & {
121
134
  readonly "!=0": true;
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mBAAmB,IAAI,+BAA+B,EAC5D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAElE,KAAK,WAAW,GAAG,mBAAmB,CAAC;AAyDvC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,qDAAK,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;MAAW,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;OAKG;wBA/FA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAiG3D;;;;;OAKG;uBAjGA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAmG3D;;;;;OAKG;wBAnGA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAqG3D;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;;;OAUG;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mBAAmB,IAAI,+BAA+B,EAC5D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAElE,KAAK,WAAW,GAAG,mBAAmB,CAAC;AAuDvC;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,qDAAK,CAAC;AAExC;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;;;;;MAAW,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;wBApGA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAsG3D;;;;;;OAMG;uBAvGA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAyG3D;;;;;;OAMG;wBA1GA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IA4G3D;;;;;;;;OAQG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;;;;OAWG;;;;;;;;CAEK,CAAC"}