ts-data-forge 6.13.0 → 7.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 (181) hide show
  1. package/README.md +2 -2
  2. package/dist/array/impl/array-utils-iterators.mjs +6 -0
  3. package/dist/array/impl/array-utils-iterators.mjs.map +1 -1
  4. package/dist/array/impl/array-utils-modification.mjs +6 -0
  5. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  6. package/dist/array/impl/array-utils-reducing-value.mjs +6 -0
  7. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  8. package/dist/array/impl/array-utils-search.mjs +6 -0
  9. package/dist/array/impl/array-utils-search.mjs.map +1 -1
  10. package/dist/array/impl/array-utils-slice-clamped.mjs +6 -0
  11. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
  12. package/dist/array/impl/array-utils-slicing.mjs +6 -0
  13. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  14. package/dist/array/impl/array-utils-transformation.mjs +6 -0
  15. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  16. package/dist/array/impl/array-utils-validation.mjs +6 -0
  17. package/dist/array/impl/array-utils-validation.mjs.map +1 -1
  18. package/dist/collections/imap-mapped.mjs +6 -0
  19. package/dist/collections/imap-mapped.mjs.map +1 -1
  20. package/dist/collections/imap.mjs +6 -0
  21. package/dist/collections/imap.mjs.map +1 -1
  22. package/dist/collections/iset-mapped.mjs +6 -0
  23. package/dist/collections/iset-mapped.mjs.map +1 -1
  24. package/dist/collections/iset.mjs +6 -0
  25. package/dist/collections/iset.mjs.map +1 -1
  26. package/dist/collections/queue.mjs +6 -0
  27. package/dist/collections/queue.mjs.map +1 -1
  28. package/dist/collections/stack.mjs +6 -0
  29. package/dist/collections/stack.mjs.map +1 -1
  30. package/dist/entry-point.mjs +6 -0
  31. package/dist/entry-point.mjs.map +1 -1
  32. package/dist/functional/pipe.d.mts +6 -18
  33. package/dist/functional/pipe.d.mts.map +1 -1
  34. package/dist/functional/pipe.mjs +35 -15
  35. package/dist/functional/pipe.mjs.map +1 -1
  36. package/dist/index.mjs +6 -0
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/iterator/range.mjs +6 -0
  39. package/dist/iterator/range.mjs.map +1 -1
  40. package/dist/json/json.mjs +6 -0
  41. package/dist/json/json.mjs.map +1 -1
  42. package/dist/number/branded-types/finite-number.d.mts +1 -1
  43. package/dist/number/branded-types/index.d.mts +6 -0
  44. package/dist/number/branded-types/index.d.mts.map +1 -1
  45. package/dist/number/branded-types/index.mjs +6 -0
  46. package/dist/number/branded-types/index.mjs.map +1 -1
  47. package/dist/number/branded-types/int.d.mts +1 -2
  48. package/dist/number/branded-types/int.d.mts.map +1 -1
  49. package/dist/number/branded-types/int16.d.mts +2 -3
  50. package/dist/number/branded-types/int16.d.mts.map +1 -1
  51. package/dist/number/branded-types/int32.d.mts +2 -3
  52. package/dist/number/branded-types/int32.d.mts.map +1 -1
  53. package/dist/number/branded-types/negative-finite-number.d.mts +143 -0
  54. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -0
  55. package/dist/number/branded-types/negative-finite-number.mjs +156 -0
  56. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -0
  57. package/dist/number/branded-types/negative-int.d.mts +120 -0
  58. package/dist/number/branded-types/negative-int.d.mts.map +1 -0
  59. package/dist/number/branded-types/negative-int.mjs +125 -0
  60. package/dist/number/branded-types/negative-int.mjs.map +1 -0
  61. package/dist/number/branded-types/negative-safe-int.d.mts +132 -0
  62. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -0
  63. package/dist/number/branded-types/negative-safe-int.mjs +136 -0
  64. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -0
  65. package/dist/number/branded-types/non-negative-finite-number.d.mts +1 -1
  66. package/dist/number/branded-types/non-negative-int16.d.mts +1 -1
  67. package/dist/number/branded-types/non-negative-int32.d.mts +1 -1
  68. package/dist/number/branded-types/non-positive-finite-number.d.mts +130 -0
  69. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -0
  70. package/dist/number/branded-types/non-positive-finite-number.mjs +134 -0
  71. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -0
  72. package/dist/number/branded-types/non-positive-int.d.mts +224 -0
  73. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -0
  74. package/dist/number/branded-types/non-positive-int.mjs +222 -0
  75. package/dist/number/branded-types/non-positive-int.mjs.map +1 -0
  76. package/dist/number/branded-types/non-positive-safe-int.d.mts +119 -0
  77. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -0
  78. package/dist/number/branded-types/non-positive-safe-int.mjs +116 -0
  79. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -0
  80. package/dist/number/branded-types/non-zero-finite-number.d.mts +5 -17
  81. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  82. package/dist/number/branded-types/non-zero-finite-number.mjs +5 -17
  83. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  84. package/dist/number/branded-types/non-zero-int.d.mts +5 -33
  85. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  86. package/dist/number/branded-types/non-zero-int.mjs +5 -25
  87. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  88. package/dist/number/branded-types/non-zero-int16.d.mts +6 -43
  89. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  90. package/dist/number/branded-types/non-zero-int16.mjs +5 -25
  91. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  92. package/dist/number/branded-types/non-zero-int32.d.mts +6 -39
  93. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  94. package/dist/number/branded-types/non-zero-int32.mjs +5 -25
  95. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  96. package/dist/number/branded-types/non-zero-safe-int.d.mts +5 -37
  97. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  98. package/dist/number/branded-types/non-zero-safe-int.mjs +5 -28
  99. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  100. package/dist/number/branded-types/non-zero-uint16.d.mts +6 -33
  101. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  102. package/dist/number/branded-types/non-zero-uint16.mjs +5 -17
  103. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  104. package/dist/number/branded-types/non-zero-uint32.d.mts +6 -31
  105. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  106. package/dist/number/branded-types/non-zero-uint32.mjs +5 -17
  107. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  108. package/dist/number/branded-types/positive-finite-number.d.mts +4 -2
  109. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  110. package/dist/number/branded-types/positive-int.d.mts +4 -2
  111. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  112. package/dist/number/branded-types/positive-int16.d.mts +4 -2
  113. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  114. package/dist/number/branded-types/positive-int32.d.mts +4 -2
  115. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  116. package/dist/number/branded-types/positive-safe-int.d.mts +4 -2
  117. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  118. package/dist/number/branded-types/positive-uint16.d.mts +4 -2
  119. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  120. package/dist/number/branded-types/positive-uint32.d.mts +4 -2
  121. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  122. package/dist/number/branded-types/safe-int.d.mts +1 -2
  123. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  124. package/dist/number/branded-types/safe-uint.d.mts +1 -1
  125. package/dist/number/branded-types/uint.d.mts +1 -1
  126. package/dist/number/branded-types/uint16.d.mts +1 -1
  127. package/dist/number/branded-types/uint32.d.mts +1 -1
  128. package/dist/number/index.d.mts +1 -0
  129. package/dist/number/index.d.mts.map +1 -1
  130. package/dist/number/index.mjs +6 -0
  131. package/dist/number/index.mjs.map +1 -1
  132. package/dist/number/num-arithmetic-types.d.mts +74 -0
  133. package/dist/number/num-arithmetic-types.d.mts.map +1 -0
  134. package/dist/number/num-arithmetic-types.mjs +2 -0
  135. package/dist/number/num-arithmetic-types.mjs.map +1 -0
  136. package/dist/number/num.d.mts +53 -9
  137. package/dist/number/num.d.mts.map +1 -1
  138. package/dist/number/num.mjs +64 -12
  139. package/dist/number/num.mjs.map +1 -1
  140. package/dist/number/refined-number-utils.d.mts +12 -9
  141. package/dist/number/refined-number-utils.d.mts.map +1 -1
  142. package/dist/number/refined-number-utils.mjs.map +1 -1
  143. package/dist/object/object.mjs +6 -0
  144. package/dist/object/object.mjs.map +1 -1
  145. package/package.json +5 -2
  146. package/src/functional/pipe.mts +104 -78
  147. package/src/functional/pipe.test.mts +57 -1
  148. package/src/number/branded-types/index.mts +6 -0
  149. package/src/number/branded-types/negative-finite-number.mts +210 -0
  150. package/src/number/branded-types/negative-finite-number.test.mts +172 -0
  151. package/src/number/branded-types/negative-int.mts +160 -0
  152. package/src/number/branded-types/negative-int.test.mts +146 -0
  153. package/src/number/branded-types/negative-safe-int.mts +173 -0
  154. package/src/number/branded-types/negative-safe-int.test.mts +120 -0
  155. package/src/number/branded-types/non-positive-finite-number.mts +191 -0
  156. package/src/number/branded-types/non-positive-finite-number.test.mts +286 -0
  157. package/src/number/branded-types/non-positive-int.mts +251 -0
  158. package/src/number/branded-types/non-positive-int.test.mts +197 -0
  159. package/src/number/branded-types/non-positive-safe-int.mts +147 -0
  160. package/src/number/branded-types/non-positive-safe-int.test.mts +223 -0
  161. package/src/number/branded-types/non-zero-finite-number.mts +14 -22
  162. package/src/number/branded-types/non-zero-finite-number.test.mts +0 -12
  163. package/src/number/branded-types/non-zero-int.mts +10 -32
  164. package/src/number/branded-types/non-zero-int.test.mts +0 -20
  165. package/src/number/branded-types/non-zero-int16.mts +8 -32
  166. package/src/number/branded-types/non-zero-int16.test.mts +0 -30
  167. package/src/number/branded-types/non-zero-int32.mts +8 -32
  168. package/src/number/branded-types/non-zero-int32.test.mts +0 -30
  169. package/src/number/branded-types/non-zero-safe-int.mts +8 -35
  170. package/src/number/branded-types/non-zero-safe-int.test.mts +0 -32
  171. package/src/number/branded-types/non-zero-uint16.mts +8 -22
  172. package/src/number/branded-types/non-zero-uint16.test.mts +0 -16
  173. package/src/number/branded-types/non-zero-uint32.mts +8 -22
  174. package/src/number/branded-types/non-zero-uint32.test.mts +0 -16
  175. package/src/number/index.mts +1 -0
  176. package/src/number/num-arithmetic-types.mts +269 -0
  177. package/src/number/num-arithmetic-types.test.mts +130 -0
  178. package/src/number/num-arithmetic.test.mts +102 -0
  179. package/src/number/num.mts +96 -15
  180. package/src/number/refined-number-utils.mts +19 -9
  181. package/src/others/map-nullable.test.mts +3 -4
@@ -0,0 +1,222 @@
1
+ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+
3
+ const typeNameInMessage = 'a non-positive integer';
4
+ const { MAX_VALUE, add, castType, clamp, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
+ integerOrSafeInteger: 'Integer',
6
+ MIN_VALUE: -Number.MAX_VALUE,
7
+ MAX_VALUE: 0,
8
+ typeNameInMessage,
9
+ });
10
+ /**
11
+ * Type guard that checks if a value is a non-positive integer.
12
+ *
13
+ * A non-positive integer is any integer less than or equal to zero (<= 0).
14
+ * This includes zero and all negative integers, but excludes positive numbers
15
+ * and non-integers.
16
+ *
17
+ * @example
18
+ *
19
+ * ```ts
20
+ * assert.isTrue(isNonPositiveInt(0));
21
+ *
22
+ * assert.isTrue(isNonPositiveInt(-5));
23
+ *
24
+ * assert.isFalse(isNonPositiveInt(1));
25
+ * ```
26
+ *
27
+ * @param value - The value to check
28
+ * @returns `true` if the value is a non-positive integer, `false` otherwise
29
+ */
30
+ const isNonPositiveInt = is;
31
+ /**
32
+ * Casts a number to a NonPositiveInt branded type.
33
+ *
34
+ * This function validates that the input is a non-positive integer (<= 0) and
35
+ * returns it with the NonPositiveInt brand. This ensures type safety for
36
+ * operations that require non-positive integer values.
37
+ *
38
+ * @example
39
+ *
40
+ * ```ts
41
+ * const branded = asNonPositiveInt(-7);
42
+ *
43
+ * assert.isTrue(branded === -7);
44
+ *
45
+ * assert.isTrue(NonPositiveInt.is(branded));
46
+ * ```
47
+ *
48
+ * @param value - The value to cast
49
+ * @returns The value as a NonPositiveInt branded type
50
+ * @throws {TypeError} If the value is not a non-positive integer
51
+ */
52
+ const asNonPositiveInt = castType;
53
+ /**
54
+ * Namespace providing type-safe operations for NonPositiveInt branded types.
55
+ *
56
+ * NonPositiveInt represents integers that are less than or equal to zero (<= 0).
57
+ * All operations automatically clamp results to maintain the non-positive
58
+ * constraint, ensuring that arithmetic operations never produce positive values.
59
+ *
60
+ * This type is essential for:
61
+ *
62
+ * - Debts and negative balances
63
+ * - Penalties and reductions
64
+ * - Offsets and adjustments (downward)
65
+ * - Negative counts or differences
66
+ * - Depth or altitude below a reference point
67
+ */
68
+ const NonPositiveInt = {
69
+ /**
70
+ * Type guard that checks if a value is a non-positive integer.
71
+ *
72
+ * @example
73
+ *
74
+ * ```ts
75
+ * const value: number = -42;
76
+ *
77
+ * if (NonPositiveInt.is(value)) {
78
+ * // value is now typed as NonPositiveInt
79
+ * const debt = value;
80
+ * }
81
+ * ```
82
+ *
83
+ * @param value - The value to check
84
+ * @returns `true` if the value is a non-positive integer, `false` otherwise
85
+ */
86
+ is,
87
+ /**
88
+ * The maximum value for a non-positive integer.
89
+ *
90
+ * @readonly
91
+ */
92
+ MAX_VALUE,
93
+ /**
94
+ * Returns the smaller of two non-positive integers.
95
+ *
96
+ * Since non-positive integers range from negative infinity to 0, the smaller
97
+ * value is the one further from zero (more negative).
98
+ *
99
+ * @example
100
+ *
101
+ * ```ts
102
+ * const result = NonPositiveInt.min(-5, -10);
103
+ *
104
+ * assert.strictEqual(result, -10);
105
+ * ```
106
+ *
107
+ * @param a - The first non-positive integer
108
+ * @param b - The second non-positive integer
109
+ * @returns The minimum value as a non-positive integer
110
+ */
111
+ min: min_,
112
+ /**
113
+ * Returns the larger of two non-positive integers.
114
+ *
115
+ * Since non-positive integers range from negative infinity to 0, the larger
116
+ * value is the one closer to zero (less negative).
117
+ *
118
+ * @example
119
+ *
120
+ * ```ts
121
+ * const result = NonPositiveInt.max(-5, -10);
122
+ *
123
+ * assert.strictEqual(result, -5);
124
+ * ```
125
+ *
126
+ * @param a - The first non-positive integer
127
+ * @param b - The second non-positive integer
128
+ * @returns The maximum value as a non-positive integer
129
+ */
130
+ max: max_,
131
+ /**
132
+ * Clamps a number to the non-positive integer range.
133
+ *
134
+ * Any positive value is clamped to 0 (the maximum non-positive integer).
135
+ * Negative values are preserved as long as they are valid integers.
136
+ *
137
+ * @example
138
+ *
139
+ * ```ts
140
+ * assert.strictEqual(NonPositiveInt.clamp(5), 0);
141
+ *
142
+ * assert.strictEqual(NonPositiveInt.clamp(-5), -5);
143
+ *
144
+ * assert.strictEqual(NonPositiveInt.clamp(0), 0);
145
+ * ```
146
+ *
147
+ * @param value - The number to clamp
148
+ * @returns The value clamped to the non-positive integer range
149
+ */
150
+ clamp,
151
+ /**
152
+ * Generates a random non-positive integer value.
153
+ *
154
+ * @example
155
+ *
156
+ * ```ts
157
+ * const randomValue = NonPositiveInt.random();
158
+ *
159
+ * assert.isTrue(NonPositiveInt.is(randomValue));
160
+ * ```
161
+ *
162
+ * @returns A random non-positive integer
163
+ */
164
+ random,
165
+ /**
166
+ * Raises a non-positive integer to the power of another non-positive integer.
167
+ *
168
+ * The result is clamped to the non-positive integer range.
169
+ *
170
+ * @example
171
+ *
172
+ * ```ts
173
+ * const result = NonPositiveInt.pow(-2, -1);
174
+ * ```
175
+ *
176
+ * @param a - The base non-positive integer
177
+ * @param b - The exponent non-positive integer
178
+ * @returns `a ** b` clamped to the non-positive integer range
179
+ */
180
+ pow,
181
+ /**
182
+ * Adds two non-positive integers.
183
+ *
184
+ * The result is clamped to the non-positive integer range. If the sum is
185
+ * positive, it is clamped to 0.
186
+ *
187
+ * @example
188
+ *
189
+ * ```ts
190
+ * assert.strictEqual(NonPositiveInt.add(-5, -3), -8);
191
+ *
192
+ * assert.strictEqual(NonPositiveInt.add(-5, 10), 0);
193
+ * ```
194
+ *
195
+ * @param a - The first non-positive integer
196
+ * @param b - The second non-positive integer
197
+ * @returns `a + b` clamped to the non-positive integer range
198
+ */
199
+ add,
200
+ /**
201
+ * Subtracts one non-positive integer from another.
202
+ *
203
+ * The result is clamped to the non-positive integer range. If the result is
204
+ * positive, it is clamped to 0.
205
+ *
206
+ * @example
207
+ *
208
+ * ```ts
209
+ * assert.strictEqual(NonPositiveInt.sub(-10, -3), -7);
210
+ *
211
+ * assert.strictEqual(NonPositiveInt.sub(-10, 5), 0);
212
+ * ```
213
+ *
214
+ * @param a - The minuend non-positive integer
215
+ * @param b - The subtrahend non-positive integer
216
+ * @returns `a - b` clamped to the non-positive integer range
217
+ */
218
+ sub,
219
+ };
220
+
221
+ export { NonPositiveInt, asNonPositiveInt, isNonPositiveInt };
222
+ //# sourceMappingURL=non-positive-int.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-positive-int.mjs","sources":["../../../src/number/branded-types/non-positive-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAOA,MAAM,iBAAiB,GAAG,wBAAwB;AAElD,MAAM,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,KAAK,EACL,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;AACA,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;AAC5B,IAAA,SAAS,EAAE,CAAC;IACZ,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;;;;;;;;;;;;AAmBG;AACI,MAAM,gBAAgB,GAAG;AAEhC;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,gBAAgB,GAAG;AAEhC;;;;;;;;;;;;;;AAcG;AACI,MAAM,cAAc,GAAG;AAC5B;;;;;;;;;;;;;;;;AAgBG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;;;;;;;;;;;;;;AAiBG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;AAiBG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;;AAkBG;IACH,KAAK;AAEL;;;;;;;;;;;;AAYG;IACH,MAAM;AAEN;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;AAiBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;AAiBG;IACH,GAAG;;;;;"}
@@ -0,0 +1,119 @@
1
+ import { type NonPositiveSafeInt as TtfImported_NonPositiveSafeInt } from 'ts-type-forge';
2
+ export type NonPositiveSafeInt = TtfImported_NonPositiveSafeInt;
3
+ /**
4
+ * Checks if a number is a NonPositiveSafeInt (non-positive safe integer in the
5
+ * range [Number.MIN_SAFE_INTEGER, 0]).
6
+ *
7
+ * @param value The value to check.
8
+ * @returns `true` if the value is a NonPositiveSafeInt, `false` otherwise.
9
+ */
10
+ export declare const isNonPositiveSafeInt: (a: number) => a is TtfImported_NonPositiveSafeInt;
11
+ /**
12
+ * Casts a number to a NonPositiveSafeInt type.
13
+ *
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.
17
+ */
18
+ export declare const asNonPositiveSafeInt: <N extends number>(x: N) => number & {
19
+ readonly NaNValue: false;
20
+ readonly Finite: true;
21
+ readonly Int: true;
22
+ readonly "<=0": true;
23
+ readonly "< 2^15": true;
24
+ readonly "< 2^16": true;
25
+ readonly "< 2^31": true;
26
+ readonly "< 2^32": true;
27
+ readonly SafeInt: true;
28
+ } & Readonly<{
29
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
30
+ }> & N;
31
+ /**
32
+ * Namespace providing type-safe arithmetic operations for non-positive
33
+ * safe integers.
34
+ *
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.
39
+ */
40
+ export declare const NonPositiveSafeInt: {
41
+ /**
42
+ * Type guard to check if a value is a NonPositiveSafeInt.
43
+ *
44
+ * @param value The value to check.
45
+ * @returns `true` if the value is a non-positive safe integer, `false`
46
+ * otherwise.
47
+ */
48
+ readonly is: (a: number) => a is TtfImported_NonPositiveSafeInt;
49
+ /**
50
+ * The minimum value for a non-positive safe integer.
51
+ *
52
+ * @readonly
53
+ */
54
+ readonly MIN_VALUE: number;
55
+ /**
56
+ * The maximum value for a non-positive safe integer.
57
+ *
58
+ * @readonly
59
+ */
60
+ readonly MAX_VALUE: 0;
61
+ /**
62
+ * Returns the smaller of two NonPositiveSafeInt values.
63
+ *
64
+ * @param a The first NonPositiveSafeInt.
65
+ * @param b The second NonPositiveSafeInt.
66
+ * @returns The minimum value as a NonPositiveSafeInt.
67
+ */
68
+ readonly min: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>[]) => TtfImported_NonPositiveSafeInt;
69
+ /**
70
+ * Returns the larger of two NonPositiveSafeInt values.
71
+ *
72
+ * @param a The first NonPositiveSafeInt.
73
+ * @param b The second NonPositiveSafeInt.
74
+ * @returns The maximum value as a NonPositiveSafeInt.
75
+ */
76
+ readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>[]) => TtfImported_NonPositiveSafeInt;
77
+ /**
78
+ * Clamps a number to the NonPositiveSafeInt range.
79
+ *
80
+ * @param value The number to clamp.
81
+ * @returns The value clamped to [Number.MIN_SAFE_INTEGER, 0] as a
82
+ * NonPositiveSafeInt.
83
+ */
84
+ readonly clamp: (x: number) => TtfImported_NonPositiveSafeInt;
85
+ /**
86
+ * Generates a random NonPositiveSafeInt value within the valid range.
87
+ *
88
+ * @returns A random NonPositiveSafeInt between Number.MIN_SAFE_INTEGER and 0.
89
+ */
90
+ readonly random: (min?: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt> | undefined, max?: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt> | undefined) => TtfImported_NonPositiveSafeInt;
91
+ /**
92
+ * Raises a NonPositiveSafeInt to the power of another NonPositiveSafeInt.
93
+ *
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.
98
+ */
99
+ readonly pow: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>) => TtfImported_NonPositiveSafeInt;
100
+ /**
101
+ * Adds two NonPositiveSafeInt values.
102
+ *
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.
107
+ */
108
+ readonly add: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>) => TtfImported_NonPositiveSafeInt;
109
+ /**
110
+ * Subtracts one NonPositiveSafeInt from another.
111
+ *
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).
116
+ */
117
+ readonly sub: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveSafeInt>) => TtfImported_NonPositiveSafeInt;
118
+ };
119
+ //# sourceMappingURL=non-positive-safe-int.d.mts.map
@@ -0,0 +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"}
@@ -0,0 +1,116 @@
1
+ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+
3
+ const typeNameInMessage = 'a non-positive safe integer';
4
+ const { MAX_VALUE, MIN_VALUE, add, castType, clamp, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
+ integerOrSafeInteger: 'SafeInteger',
6
+ MIN_VALUE: Number.MIN_SAFE_INTEGER,
7
+ MAX_VALUE: 0,
8
+ typeNameInMessage,
9
+ });
10
+ /**
11
+ * Checks if a number is a NonPositiveSafeInt (non-positive safe integer in the
12
+ * range [Number.MIN_SAFE_INTEGER, 0]).
13
+ *
14
+ * @param value The value to check.
15
+ * @returns `true` if the value is a NonPositiveSafeInt, `false` otherwise.
16
+ */
17
+ const isNonPositiveSafeInt = is;
18
+ /**
19
+ * Casts a number to a NonPositiveSafeInt type.
20
+ *
21
+ * @param value The value to cast.
22
+ * @returns The value as a NonPositiveSafeInt type.
23
+ * @throws {TypeError} If the value is not a non-positive safe integer.
24
+ */
25
+ const asNonPositiveSafeInt = castType;
26
+ /**
27
+ * Namespace providing type-safe arithmetic operations for non-positive
28
+ * safe integers.
29
+ *
30
+ * All operations automatically clamp results to the valid NonPositiveSafeInt
31
+ * range [Number.MIN_SAFE_INTEGER, 0]. This ensures that all arithmetic
32
+ * maintains the non-positive safe integer constraint, with positive results
33
+ * clamped to 0 and underflow results clamped to MIN_VALUE.
34
+ */
35
+ const NonPositiveSafeInt = {
36
+ /**
37
+ * Type guard to check if a value is a NonPositiveSafeInt.
38
+ *
39
+ * @param value The value to check.
40
+ * @returns `true` if the value is a non-positive safe integer, `false`
41
+ * otherwise.
42
+ */
43
+ is,
44
+ /**
45
+ * The minimum value for a non-positive safe integer.
46
+ *
47
+ * @readonly
48
+ */
49
+ MIN_VALUE,
50
+ /**
51
+ * The maximum value for a non-positive safe integer.
52
+ *
53
+ * @readonly
54
+ */
55
+ MAX_VALUE,
56
+ /**
57
+ * Returns the smaller of two NonPositiveSafeInt values.
58
+ *
59
+ * @param a The first NonPositiveSafeInt.
60
+ * @param b The second NonPositiveSafeInt.
61
+ * @returns The minimum value as a NonPositiveSafeInt.
62
+ */
63
+ min: min_,
64
+ /**
65
+ * Returns the larger of two NonPositiveSafeInt values.
66
+ *
67
+ * @param a The first NonPositiveSafeInt.
68
+ * @param b The second NonPositiveSafeInt.
69
+ * @returns The maximum value as a NonPositiveSafeInt.
70
+ */
71
+ max: max_,
72
+ /**
73
+ * Clamps a number to the NonPositiveSafeInt range.
74
+ *
75
+ * @param value The number to clamp.
76
+ * @returns The value clamped to [Number.MIN_SAFE_INTEGER, 0] as a
77
+ * NonPositiveSafeInt.
78
+ */
79
+ clamp,
80
+ /**
81
+ * Generates a random NonPositiveSafeInt value within the valid range.
82
+ *
83
+ * @returns A random NonPositiveSafeInt between Number.MIN_SAFE_INTEGER and 0.
84
+ */
85
+ random,
86
+ /**
87
+ * Raises a NonPositiveSafeInt to the power of another NonPositiveSafeInt.
88
+ *
89
+ * @param a The base NonPositiveSafeInt.
90
+ * @param b The exponent NonPositiveSafeInt.
91
+ * @returns `a ** b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
92
+ * NonPositiveSafeInt.
93
+ */
94
+ pow,
95
+ /**
96
+ * Adds two NonPositiveSafeInt values.
97
+ *
98
+ * @param a The first NonPositiveSafeInt.
99
+ * @param b The second NonPositiveSafeInt.
100
+ * @returns `a + b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
101
+ * NonPositiveSafeInt.
102
+ */
103
+ add,
104
+ /**
105
+ * Subtracts one NonPositiveSafeInt from another.
106
+ *
107
+ * @param a The minuend NonPositiveSafeInt.
108
+ * @param b The subtrahend NonPositiveSafeInt.
109
+ * @returns `a - b` clamped to [Number.MIN_SAFE_INTEGER, 0] as a
110
+ * NonPositiveSafeInt (maximum 0).
111
+ */
112
+ sub,
113
+ };
114
+
115
+ export { NonPositiveSafeInt, asNonPositiveSafeInt, isNonPositiveSafeInt };
116
+ //# sourceMappingURL=non-positive-safe-int.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-positive-safe-int.mjs","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAOA,MAAM,iBAAiB,GAAG,6BAA6B;AAEvD,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,QAAQ,EACR,KAAK,EACL,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;AACA,IAAA,oBAAoB,EAAE,aAAa;IACnC,SAAS,EAAE,MAAM,CAAC,gBAAgB;AAClC,IAAA,SAAS,EAAE,CAAC;IACZ,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;AAMG;AACI,MAAM,oBAAoB,GAAG;AAEpC;;;;;;AAMG;AACI,MAAM,oBAAoB,GAAG;AAEpC;;;;;;;;AAQG;AACI,MAAM,kBAAkB,GAAG;AAChC;;;;;;AAMG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;AAIG;IACH,SAAS;AAET;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;AAMG;IACH,KAAK;AAEL;;;;AAIG;IACH,MAAM;AAEN;;;;;;;AAOG;IACH,GAAG;AAEH;;;;;;;AAOG;IACH,GAAG;AAEH;;;;;;;AAOG;IACH,GAAG;;;;;"}
@@ -46,7 +46,7 @@ export declare const NonZeroFiniteNumber: {
46
46
  * @param a The NonZeroFiniteNumber.
47
47
  * @returns The absolute value as a NonZeroFiniteNumber.
48
48
  */
49
- readonly abs: (x: TtfImported_NonZeroFiniteNumber) => TsDataForgeInternals.RefinedNumberUtils.ToNonNegative<TtfImported_NonZeroFiniteNumber>;
49
+ readonly abs: (x: TtfImported_NonZeroFiniteNumber) => import("ts-type-forge").IntersectBrand<TtfImported_NonZeroFiniteNumber, import("ts-type-forge").PositiveNumber>;
50
50
  /**
51
51
  * Returns the smaller of two NonZeroFiniteNumber values.
52
52
  *
@@ -98,22 +98,6 @@ export declare const NonZeroFiniteNumber: {
98
98
  * @returns `a ** b` as a NonZeroFiniteNumber.
99
99
  */
100
100
  readonly pow: (x: TtfImported_NonZeroFiniteNumber, y: TtfImported_NonZeroFiniteNumber) => TtfImported_NonZeroFiniteNumber;
101
- /**
102
- * Adds two NonZeroFiniteNumber values.
103
- *
104
- * @param a The first NonZeroFiniteNumber.
105
- * @param b The second NonZeroFiniteNumber.
106
- * @returns `a + b` as a NonZeroFiniteNumber.
107
- */
108
- readonly add: (x: TtfImported_NonZeroFiniteNumber, y: TtfImported_NonZeroFiniteNumber) => TtfImported_NonZeroFiniteNumber;
109
- /**
110
- * Subtracts one NonZeroFiniteNumber from another.
111
- *
112
- * @param a The minuend NonZeroFiniteNumber.
113
- * @param b The subtrahend NonZeroFiniteNumber.
114
- * @returns `a - b` as a NonZeroFiniteNumber.
115
- */
116
- readonly sub: (x: TtfImported_NonZeroFiniteNumber, y: TtfImported_NonZeroFiniteNumber) => TtfImported_NonZeroFiniteNumber;
117
101
  /**
118
102
  * Multiplies two NonZeroFiniteNumber values.
119
103
  *
@@ -125,6 +109,10 @@ export declare const NonZeroFiniteNumber: {
125
109
  /**
126
110
  * Divides one NonZeroFiniteNumber by another.
127
111
  *
112
+ * Exact (non-flooring) division of two non-zero finite numbers is always
113
+ * non-zero, so this stays closed. For the non-closed operations (`add`/`sub`,
114
+ * whose result may be `0`) use {@link Num.add}/{@link Num.sub}.
115
+ *
128
116
  * @param a The dividend NonZeroFiniteNumber.
129
117
  * @param b The divisor NonZeroFiniteNumber.
130
118
  * @returns `a / b` as a NonZeroFiniteNumber.
@@ -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;AA2DvC;;;;;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;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;;;;;;;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;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,7 +1,7 @@
1
1
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
2
 
3
3
  const typeNameInMessage = 'a non-zero finite number';
4
- const { abs, add, castType, div, is, max: max_, min: min_, mul, pow, randomNonZero: random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
4
+ const { abs, castType, div, is, max: max_, min: min_, mul, pow, randomNonZero: random, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
5
5
  nonZero: true,
6
6
  MIN_VALUE: -Number.MAX_VALUE,
7
7
  MAX_VALUE: Number.MAX_VALUE,
@@ -107,22 +107,6 @@ const NonZeroFiniteNumber = {
107
107
  * @returns `a ** b` as a NonZeroFiniteNumber.
108
108
  */
109
109
  pow,
110
- /**
111
- * Adds two NonZeroFiniteNumber values.
112
- *
113
- * @param a The first NonZeroFiniteNumber.
114
- * @param b The second NonZeroFiniteNumber.
115
- * @returns `a + b` as a NonZeroFiniteNumber.
116
- */
117
- add,
118
- /**
119
- * Subtracts one NonZeroFiniteNumber from another.
120
- *
121
- * @param a The minuend NonZeroFiniteNumber.
122
- * @param b The subtrahend NonZeroFiniteNumber.
123
- * @returns `a - b` as a NonZeroFiniteNumber.
124
- */
125
- sub,
126
110
  /**
127
111
  * Multiplies two NonZeroFiniteNumber values.
128
112
  *
@@ -134,6 +118,10 @@ const NonZeroFiniteNumber = {
134
118
  /**
135
119
  * Divides one NonZeroFiniteNumber by another.
136
120
  *
121
+ * Exact (non-flooring) division of two non-zero finite numbers is always
122
+ * non-zero, so this stays closed. For the non-closed operations (`add`/`sub`,
123
+ * whose result may be `0`) use {@link Num.add}/{@link Num.sub}.
124
+ *
137
125
  * @param a The dividend NonZeroFiniteNumber.
138
126
  * @param b The divisor NonZeroFiniteNumber.
139
127
  * @returns `a / b` as a NonZeroFiniteNumber.
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-finite-number.mjs","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAaA,MAAM,iBAAiB,GAAG,0BAA0B;AAEpD,MAAM,EACJ,GAAG,EACH,GAAG,EACH,QAAQ,EACR,GAAG,EACH,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,iBAAiB,CAI3D;AACA,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;AACT,CAAA,CAAC;AAEX;AAEA,MAAM,KAAK,GAAG,CACZ,CAAc;AAEd;AACA,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D;AAE7E,MAAM,IAAI,GAAG,CACX,CAAc;AAEd;AACA,IAAI,CAAC,IAAI,CAAC,CAAC,CAA+D;AAE5E,MAAM,KAAK,GAAG,CACZ,CAAc;AAEd;AACA,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D;AAc7E;;;;;AAKG;AACI,MAAM,qBAAqB,GAAG;AAErC;;;;;;AAMG;AACI,MAAM,qBAAqB,GAAG;AAErC;;;;;;;AAOG;AACI,MAAM,mBAAmB,GAAG;AACjC;;;;;;AAMG;IACH,EAAE;AAEF;;;;;AAKG;IACH,GAAG;AAEH;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;AAKG;IACH,KAAK;AAEL;;;;;AAKG;IACH,IAAI;AAEJ;;;;;AAKG;IACH,KAAK;AAEL;;;;AAIG;IACH,MAAM;AAEN;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;AAMG;IACH,GAAG;;;;;"}
1
+ {"version":3,"file":"non-zero-finite-number.mjs","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAaA,MAAM,iBAAiB,GAAG,0BAA0B;AAEpD,MAAM,EACJ,GAAG,EACH,QAAQ,EACR,GAAG,EACH,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,GACtB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,iBAAiB,CAI3D;AACA,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;AACT,CAAA,CAAC;AAEX;AAEA,MAAM,KAAK,GAAG,CACZ,CAAc;AAEd;AACA,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D;AAE7E,MAAM,IAAI,GAAG,CACX,CAAc;AAEd;AACA,IAAI,CAAC,IAAI,CAAC,CAAC,CAA+D;AAE5E,MAAM,KAAK,GAAG,CACZ,CAAc;AAEd;AACA,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D;AAc7E;;;;;AAKG;AACI,MAAM,qBAAqB,GAAG;AAErC;;;;;;AAMG;AACI,MAAM,qBAAqB,GAAG;AAErC;;;;;;;AAOG;AACI,MAAM,mBAAmB,GAAG;AACjC;;;;;;AAMG;IACH,EAAE;AAEF;;;;;AAKG;IACH,GAAG;AAEH;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;AAKG;IACH,KAAK;AAEL;;;;;AAKG;IACH,IAAI;AAEJ;;;;;AAKG;IACH,KAAK;AAEL;;;;AAIG;IACH,MAAM;AAEN;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;;;;;AAUG;IACH,GAAG;;;;;"}
@@ -1,5 +1,4 @@
1
1
  import { type NonZeroInt as TtfImported_NonZeroInt } from 'ts-type-forge';
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
3
2
  export type NonZeroInt = TtfImported_NonZeroInt;
4
3
  /**
5
4
  * Checks if a number is a NonZeroInt.
@@ -44,7 +43,7 @@ export declare const NonZeroInt: {
44
43
  * @param a The non-zero integer.
45
44
  * @returns The absolute value as a NonZeroInt.
46
45
  */
47
- readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>) => TsDataForgeInternals.RefinedNumberUtils.ToNonNegative<TtfImported_NonZeroInt>;
46
+ readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>) => import("ts-type-forge").IntersectBrand<TtfImported_NonZeroInt, import("ts-type-forge").PositiveNumber>;
48
47
  /**
49
48
  * Returns the smaller of two non-zero integers.
50
49
  *
@@ -75,44 +74,17 @@ export declare const NonZeroInt: {
75
74
  * @returns `a ** b` as a NonZeroInt.
76
75
  */
77
76
  readonly pow: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>) => TtfImported_NonZeroInt;
78
- /**
79
- * Adds two non-zero integers.
80
- *
81
- * @param a The first non-zero integer.
82
- * @param b The second non-zero integer.
83
- * @returns `a + b` as a NonZeroInt.
84
- */
85
- readonly add: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>) => TtfImported_NonZeroInt;
86
- /**
87
- * Subtracts one non-zero integer from another.
88
- *
89
- * @param a The minuend non-zero integer.
90
- * @param b The subtrahend non-zero integer.
91
- * @returns `a - b` as a NonZeroInt.
92
- */
93
- readonly sub: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>) => TtfImported_NonZeroInt;
94
77
  /**
95
78
  * Multiplies two non-zero integers.
96
79
  *
80
+ * The product of two non-zero integers is always non-zero, so this stays
81
+ * closed; for the non-closed operations (`add`/`sub`/`div`, whose result may
82
+ * be `0`) use {@link Num.add}/{@link Num.sub}/{@link Num.divInt}.
83
+ *
97
84
  * @param a The first non-zero integer.
98
85
  * @param b The second non-zero integer.
99
86
  * @returns `a * b` as a NonZeroInt.
100
87
  */
101
88
  readonly mul: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>) => TtfImported_NonZeroInt;
102
- /**
103
- * Divides one non-zero integer by another using floor division.
104
- *
105
- * @param a The dividend non-zero integer.
106
- * @param b The divisor non-zero integer.
107
- * @returns `⌊a / b⌋` as a NonZeroInt.
108
- */
109
- readonly div: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonZeroInt>, y: 1 | 2 | 3 | 32 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 10 | 20 | 30 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -1 | -2 | -3 | -32 | -40 | -4 | -5 | -6 | -7 | -8 | -9 | -11 | -10 | -20 | -30 | -12 | -13 | -14 | -15 | -16 | -17 | -18 | -19 | -21 | -22 | -23 | -24 | -25 | -26 | -27 | -28 | -29 | -31 | -33 | -34 | -35 | -36 | -37 | -38 | -39 | import("ts-type-forge").NormalizeBrandUnion<number & {
110
- readonly NaNValue: false;
111
- readonly Finite: true;
112
- readonly Int: true;
113
- readonly "!=0": true;
114
- } & Readonly<{
115
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
116
- }>>) => TtfImported_NonZeroInt;
117
89
  };
118
90
  //# sourceMappingURL=non-zero-int.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,IAAI,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,UAAU,GAAG,sBAAsB,CAAC;AA8BhD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,4CAAK,CAAC;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;MAAW,CAAC;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,IAAI,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAI1E,MAAM,MAAM,UAAU,GAAG,sBAAsB,CAAC;AA2BhD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,4CAAK,CAAC;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;MAAW,CAAC;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;;;OAUG;;CAEK,CAAC"}