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,156 @@
1
+ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { PositiveFiniteNumber } from './positive-finite-number.mjs';
3
+
4
+ const typeNameInMessage = 'a negative finite number';
5
+ const { MAX_VALUE, add, castType, clamp, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
6
+ nonZero: true,
7
+ MIN_VALUE: -Number.MAX_VALUE,
8
+ MAX_VALUE: -Number.MIN_VALUE,
9
+ typeNameInMessage,
10
+ });
11
+ /**
12
+ * Returns the absolute value of a negative finite number.
13
+ *
14
+ * The absolute value of a negative finite number is always a positive finite
15
+ * number, so the result is typed as a {@link PositiveFiniteNumber}.
16
+ *
17
+ * @param x - The negative finite number.
18
+ * @returns `|x|` as a PositiveFiniteNumber.
19
+ */
20
+ const abs = (x) => PositiveFiniteNumber.clamp(Math.abs(x));
21
+ const floor = (x) =>
22
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
23
+ Math.floor(x);
24
+ const ceil = (x) =>
25
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
26
+ Math.ceil(x);
27
+ const round = (x) =>
28
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
29
+ Math.round(x);
30
+ /**
31
+ * Checks if a number is a NegativeFiniteNumber (a finite number `< 0`).
32
+ *
33
+ * @param value The value to check.
34
+ * @returns `true` if the value is a NegativeFiniteNumber, `false` otherwise.
35
+ */
36
+ const isNegativeFiniteNumber = is;
37
+ /**
38
+ * Casts a number to a NegativeFiniteNumber type.
39
+ *
40
+ * @param value The value to cast.
41
+ * @returns The value as a NegativeFiniteNumber type.
42
+ * @throws {TypeError} If the value is not a negative finite number.
43
+ */
44
+ const asNegativeFiniteNumber = castType;
45
+ /**
46
+ * Namespace providing type-safe arithmetic operations for negative finite
47
+ * numbers.
48
+ *
49
+ * All operations keep results finite (excluding NaN and Infinity). Operations
50
+ * that stay within the negative finite numbers clamp their results to the valid
51
+ * range, while operations whose result leaves the set (`mul`, `div`, `abs`) are
52
+ * typed to reflect the actual sign of the result.
53
+ */
54
+ const NegativeFiniteNumber = {
55
+ /**
56
+ * Type guard to check if a value is a NegativeFiniteNumber.
57
+ *
58
+ * @param value The value to check.
59
+ * @returns `true` if the value is a negative finite number, `false`
60
+ * otherwise.
61
+ */
62
+ is,
63
+ /**
64
+ * The maximum value for a negative finite number.
65
+ *
66
+ * @readonly
67
+ */
68
+ MAX_VALUE,
69
+ /**
70
+ * Returns the absolute value of a negative finite number.
71
+ *
72
+ * @param a The negative finite number.
73
+ * @returns The absolute value as a PositiveFiniteNumber.
74
+ */
75
+ abs,
76
+ /**
77
+ * Returns the smaller of two NegativeFiniteNumber values.
78
+ *
79
+ * @param a The first NegativeFiniteNumber.
80
+ * @param b The second NegativeFiniteNumber.
81
+ * @returns The minimum value as a NegativeFiniteNumber.
82
+ */
83
+ min: min_,
84
+ /**
85
+ * Returns the larger of two NegativeFiniteNumber values.
86
+ *
87
+ * @param a The first NegativeFiniteNumber.
88
+ * @param b The second NegativeFiniteNumber.
89
+ * @returns The maximum value as a NegativeFiniteNumber.
90
+ */
91
+ max: max_,
92
+ /**
93
+ * Clamps a number to the negative finite range.
94
+ *
95
+ * @param value The number to clamp.
96
+ * @returns The value clamped to `(-∞, 0)` as a NegativeFiniteNumber.
97
+ */
98
+ clamp,
99
+ /**
100
+ * Rounds down a NegativeFiniteNumber to the nearest integer.
101
+ *
102
+ * @param x The NegativeFiniteNumber to round down.
103
+ * @returns The floor value as a NegativeInt (always `<= -1`).
104
+ */
105
+ floor,
106
+ /**
107
+ * Rounds up a NegativeFiniteNumber to the nearest integer.
108
+ *
109
+ * @param x The NegativeFiniteNumber to round up.
110
+ * @returns The ceiling value as a NonPositiveInt (can be 0).
111
+ */
112
+ ceil,
113
+ /**
114
+ * Rounds a NegativeFiniteNumber to the nearest integer.
115
+ *
116
+ * @param x The NegativeFiniteNumber to round.
117
+ * @returns The rounded value as a NonPositiveInt (can be 0 if x > -0.5).
118
+ */
119
+ round,
120
+ /**
121
+ * Generates a random NegativeFiniteNumber value.
122
+ *
123
+ * @returns A random negative finite number.
124
+ */
125
+ random,
126
+ /**
127
+ * Raises a NegativeFiniteNumber to the power of another NegativeFiniteNumber.
128
+ *
129
+ * @param a The base NegativeFiniteNumber.
130
+ * @param b The exponent NegativeFiniteNumber.
131
+ * @returns `a ** b` clamped to `(-∞, 0)` as a NegativeFiniteNumber.
132
+ */
133
+ pow,
134
+ /**
135
+ * Adds two NegativeFiniteNumber values.
136
+ *
137
+ * @param a The first NegativeFiniteNumber.
138
+ * @param b The second NegativeFiniteNumber.
139
+ * @returns `a + b` as a NegativeFiniteNumber.
140
+ */
141
+ add,
142
+ /**
143
+ * Subtracts one NegativeFiniteNumber from another.
144
+ *
145
+ * The mathematical result can be positive, so it is clamped to the negative
146
+ * finite range (maximum `-Number.MIN_VALUE`).
147
+ *
148
+ * @param a The minuend NegativeFiniteNumber.
149
+ * @param b The subtrahend NegativeFiniteNumber.
150
+ * @returns `a - b` clamped to `(-∞, 0)` as a NegativeFiniteNumber.
151
+ */
152
+ sub,
153
+ };
154
+
155
+ export { NegativeFiniteNumber, asNegativeFiniteNumber, isNegativeFiniteNumber };
156
+ //# sourceMappingURL=negative-finite-number.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negative-finite-number.mjs","sources":["../../../src/number/branded-types/negative-finite-number.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAQA,MAAM,iBAAiB,GAAG,0BAA0B;AAEpD,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,iBAAiB,CAI3D;AACA,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;AAC5B,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;AAQG;AACH,MAAM,GAAG,GAAG,CAAC,CAAc,KACzB,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEzC,MAAM,KAAK,GAAG,CACZ,CAAc;AAEd;AACA,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D;AAE7E,MAAM,IAAI,GAAG,CACX,CAAc;AAId;AACA,IAAI,CAAC,IAAI,CAAC,CAAC,CAEV;AAEH,MAAM,KAAK,GAAG,CACZ,CAAc;AAId;AACA,IAAI,CAAC,KAAK,CACR,CAAC,CAGF;AAEH;;;;;AAKG;AACI,MAAM,sBAAsB,GAAG;AAEtC;;;;;;AAMG;AACI,MAAM,sBAAsB,GAAG;AAEtC;;;;;;;;AAQG;AACI,MAAM,oBAAoB,GAAG;AAClC;;;;;;AAMG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;;AAKG;IACH,GAAG;AAEH;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;AAKG;IACH,KAAK;AAEL;;;;;AAKG;IACH,KAAK;AAEL;;;;;AAKG;IACH,IAAI;AAEJ;;;;;AAKG;IACH,KAAK;AAEL;;;;AAIG;IACH,MAAM;AAEN;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;;;;AASG;IACH,GAAG;;;;;"}
@@ -0,0 +1,120 @@
1
+ import { type NegativeInt as TtfImported_NegativeInt, type WithSmallInt } from 'ts-type-forge';
2
+ import { PositiveInt } from './positive-int.mjs';
3
+ export type NegativeInt = TtfImported_NegativeInt;
4
+ type ElementType = NegativeInt;
5
+ /**
6
+ * Checks if a number is a NegativeInt (a negative integer `<= -1`).
7
+ *
8
+ * @param value The value to check.
9
+ * @returns `true` if the value is a NegativeInt, `false` otherwise.
10
+ */
11
+ export declare const isNegativeInt: (a: number) => a is TtfImported_NegativeInt;
12
+ /**
13
+ * Casts a number to a NegativeInt type.
14
+ *
15
+ * @param value The value to cast.
16
+ * @returns The value as a NegativeInt type.
17
+ * @throws {TypeError} If the value is not a negative integer.
18
+ */
19
+ export declare const asNegativeInt: <N extends number>(x: N) => number & {
20
+ readonly NaNValue: false;
21
+ readonly Finite: true;
22
+ readonly Int: true;
23
+ readonly ">=0": false;
24
+ readonly "!=0": true;
25
+ readonly "<=0": true;
26
+ readonly "< 2^15": true;
27
+ readonly "< 2^16": true;
28
+ readonly "< 2^31": true;
29
+ readonly "< 2^32": true;
30
+ } & Readonly<{
31
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
32
+ }> & N;
33
+ /**
34
+ * Namespace providing type-safe arithmetic operations for negative integers.
35
+ *
36
+ * NegativeInt represents integers that are strictly less than zero (`<= -1`).
37
+ * Operations that stay within the negative integers (such as `add`) clamp their
38
+ * results to the valid range, while operations whose result leaves the set
39
+ * (`mul`, `div`, `abs`) are typed to reflect the actual sign of the result.
40
+ */
41
+ export declare const NegativeInt: {
42
+ /**
43
+ * Type guard to check if a value is a NegativeInt.
44
+ *
45
+ * @param value The value to check.
46
+ * @returns `true` if the value is a negative integer, `false` otherwise.
47
+ */
48
+ readonly is: (a: number) => a is TtfImported_NegativeInt;
49
+ /**
50
+ * The maximum value for a negative integer.
51
+ *
52
+ * @readonly
53
+ */
54
+ readonly MAX_VALUE: -1;
55
+ /**
56
+ * Returns the absolute value of a negative integer.
57
+ *
58
+ * @param a The negative integer.
59
+ * @returns The absolute value as a PositiveInt.
60
+ */
61
+ readonly abs: (x: WithSmallInt<ElementType>) => PositiveInt;
62
+ /**
63
+ * Returns the smaller of two negative integers.
64
+ *
65
+ * @param a The first negative integer.
66
+ * @param b The second negative integer.
67
+ * @returns The minimum value as a NegativeInt.
68
+ */
69
+ readonly min: (...values: readonly WithSmallInt<TtfImported_NegativeInt>[]) => TtfImported_NegativeInt;
70
+ /**
71
+ * Returns the larger of two negative integers.
72
+ *
73
+ * @param a The first negative integer.
74
+ * @param b The second negative integer.
75
+ * @returns The maximum value as a NegativeInt.
76
+ */
77
+ readonly max: (...values: readonly WithSmallInt<TtfImported_NegativeInt>[]) => TtfImported_NegativeInt;
78
+ /**
79
+ * Clamps a number to the negative integer range.
80
+ *
81
+ * @param value The number to clamp.
82
+ * @returns The value clamped to `[-∞, -1]` as a NegativeInt.
83
+ */
84
+ readonly clamp: (x: number) => TtfImported_NegativeInt;
85
+ /**
86
+ * Generates a random NegativeInt value within the valid range.
87
+ *
88
+ * @returns A random negative integer.
89
+ */
90
+ readonly random: (min?: WithSmallInt<TtfImported_NegativeInt> | undefined, max?: WithSmallInt<TtfImported_NegativeInt> | undefined) => TtfImported_NegativeInt;
91
+ /**
92
+ * Raises a negative integer to the power of another negative integer.
93
+ *
94
+ * @param a The base negative integer.
95
+ * @param b The exponent negative integer.
96
+ * @returns `a ** b` clamped to the negative integer range.
97
+ */
98
+ readonly pow: (x: WithSmallInt<TtfImported_NegativeInt>, y: WithSmallInt<TtfImported_NegativeInt>) => TtfImported_NegativeInt;
99
+ /**
100
+ * Adds two negative integers.
101
+ *
102
+ * @param a The first negative integer.
103
+ * @param b The second negative integer.
104
+ * @returns `a + b` as a NegativeInt.
105
+ */
106
+ readonly add: (x: WithSmallInt<TtfImported_NegativeInt>, y: WithSmallInt<TtfImported_NegativeInt>) => TtfImported_NegativeInt;
107
+ /**
108
+ * Subtracts one negative integer from another.
109
+ *
110
+ * The mathematical result can be positive, so it is clamped to the negative
111
+ * integer range (maximum `-1`).
112
+ *
113
+ * @param a The minuend negative integer.
114
+ * @param b The subtrahend negative integer.
115
+ * @returns `a - b` clamped to the negative integer range.
116
+ */
117
+ readonly sub: (x: WithSmallInt<TtfImported_NegativeInt>, y: WithSmallInt<TtfImported_NegativeInt>) => TtfImported_NegativeInt;
118
+ };
119
+ export {};
120
+ //# sourceMappingURL=negative-int.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negative-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/negative-int.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,IAAI,uBAAuB,EAC3C,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAElD,KAAK,WAAW,GAAG,WAAW,CAAC;AAuC/B;;;;;GAKG;AACH,eAAO,MAAM,aAAa,6CAAK,CAAC;AAEhC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;MAAW,CAAC;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;IACtB;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;sBAjDW,YAAY,CAAC,WAAW,CAAC,KAAG,WAAW;IAoDrD;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;;OASG;;CAEK,CAAC"}
@@ -0,0 +1,125 @@
1
+ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { PositiveInt } from './positive-int.mjs';
3
+
4
+ const typeNameInMessage = 'a negative integer';
5
+ const { MAX_VALUE, add, castType, clamp, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
6
+ integerOrSafeInteger: 'Integer',
7
+ nonZero: true,
8
+ MIN_VALUE: -Number.MAX_VALUE,
9
+ MAX_VALUE: -1,
10
+ typeNameInMessage,
11
+ });
12
+ /**
13
+ * Returns the absolute value of a negative integer.
14
+ *
15
+ * The absolute value of a negative integer is always a positive integer
16
+ * (`>= 1`), so the result is typed as a {@link PositiveInt}.
17
+ *
18
+ * @param x - The negative integer.
19
+ * @returns `|x|` as a PositiveInt.
20
+ */
21
+ const abs = (x) => PositiveInt.clamp(Math.abs(x));
22
+ /**
23
+ * Checks if a number is a NegativeInt (a negative integer `<= -1`).
24
+ *
25
+ * @param value The value to check.
26
+ * @returns `true` if the value is a NegativeInt, `false` otherwise.
27
+ */
28
+ const isNegativeInt = is;
29
+ /**
30
+ * Casts a number to a NegativeInt type.
31
+ *
32
+ * @param value The value to cast.
33
+ * @returns The value as a NegativeInt type.
34
+ * @throws {TypeError} If the value is not a negative integer.
35
+ */
36
+ const asNegativeInt = castType;
37
+ /**
38
+ * Namespace providing type-safe arithmetic operations for negative integers.
39
+ *
40
+ * NegativeInt represents integers that are strictly less than zero (`<= -1`).
41
+ * Operations that stay within the negative integers (such as `add`) clamp their
42
+ * results to the valid range, while operations whose result leaves the set
43
+ * (`mul`, `div`, `abs`) are typed to reflect the actual sign of the result.
44
+ */
45
+ const NegativeInt = {
46
+ /**
47
+ * Type guard to check if a value is a NegativeInt.
48
+ *
49
+ * @param value The value to check.
50
+ * @returns `true` if the value is a negative integer, `false` otherwise.
51
+ */
52
+ is,
53
+ /**
54
+ * The maximum value for a negative integer.
55
+ *
56
+ * @readonly
57
+ */
58
+ MAX_VALUE,
59
+ /**
60
+ * Returns the absolute value of a negative integer.
61
+ *
62
+ * @param a The negative integer.
63
+ * @returns The absolute value as a PositiveInt.
64
+ */
65
+ abs,
66
+ /**
67
+ * Returns the smaller of two negative integers.
68
+ *
69
+ * @param a The first negative integer.
70
+ * @param b The second negative integer.
71
+ * @returns The minimum value as a NegativeInt.
72
+ */
73
+ min: min_,
74
+ /**
75
+ * Returns the larger of two negative integers.
76
+ *
77
+ * @param a The first negative integer.
78
+ * @param b The second negative integer.
79
+ * @returns The maximum value as a NegativeInt.
80
+ */
81
+ max: max_,
82
+ /**
83
+ * Clamps a number to the negative integer range.
84
+ *
85
+ * @param value The number to clamp.
86
+ * @returns The value clamped to `[-∞, -1]` as a NegativeInt.
87
+ */
88
+ clamp,
89
+ /**
90
+ * Generates a random NegativeInt value within the valid range.
91
+ *
92
+ * @returns A random negative integer.
93
+ */
94
+ random,
95
+ /**
96
+ * Raises a negative integer to the power of another negative integer.
97
+ *
98
+ * @param a The base negative integer.
99
+ * @param b The exponent negative integer.
100
+ * @returns `a ** b` clamped to the negative integer range.
101
+ */
102
+ pow,
103
+ /**
104
+ * Adds two negative integers.
105
+ *
106
+ * @param a The first negative integer.
107
+ * @param b The second negative integer.
108
+ * @returns `a + b` as a NegativeInt.
109
+ */
110
+ add,
111
+ /**
112
+ * Subtracts one negative integer from another.
113
+ *
114
+ * The mathematical result can be positive, so it is clamped to the negative
115
+ * integer range (maximum `-1`).
116
+ *
117
+ * @param a The minuend negative integer.
118
+ * @param b The subtrahend negative integer.
119
+ * @returns `a - b` clamped to the negative integer range.
120
+ */
121
+ sub,
122
+ };
123
+
124
+ export { NegativeInt, asNegativeInt, isNegativeInt };
125
+ //# sourceMappingURL=negative-int.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negative-int.mjs","sources":["../../../src/number/branded-types/negative-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAWA,MAAM,iBAAiB,GAAG,oBAAoB;AAE9C,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,OAAO,EAAE,IAAI;AACb,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,EAAE;IACb,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;AAQG;AACH,MAAM,GAAG,GAAG,CAAC,CAA4B,KACvC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhC;;;;;AAKG;AACI,MAAM,aAAa,GAAG;AAE7B;;;;;;AAMG;AACI,MAAM,aAAa,GAAG;AAE7B;;;;;;;AAOG;AACI,MAAM,WAAW,GAAG;AACzB;;;;;AAKG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;;AAKG;IACH,GAAG;AAEH;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;AAMG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;AAKG;IACH,KAAK;AAEL;;;;AAIG;IACH,MAAM;AAEN;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;;;;AASG;IACH,GAAG;;;;;"}
@@ -0,0 +1,132 @@
1
+ import { type NegativeSafeInt as TtfImported_NegativeSafeInt, type WithSmallInt } from 'ts-type-forge';
2
+ import { PositiveSafeInt } from './positive-safe-int.mjs';
3
+ export type NegativeSafeInt = TtfImported_NegativeSafeInt;
4
+ type ElementType = NegativeSafeInt;
5
+ /**
6
+ * Checks if a number is a NegativeSafeInt (a negative safe integer in the range
7
+ * `[Number.MIN_SAFE_INTEGER, -1]`).
8
+ *
9
+ * @param value The value to check.
10
+ * @returns `true` if the value is a NegativeSafeInt, `false` otherwise.
11
+ */
12
+ export declare const isNegativeSafeInt: (a: number) => a is TtfImported_NegativeSafeInt;
13
+ /**
14
+ * Casts a number to a NegativeSafeInt type.
15
+ *
16
+ * @param value The value to cast.
17
+ * @returns The value as a NegativeSafeInt type.
18
+ * @throws {TypeError} If the value is not a negative safe integer.
19
+ */
20
+ export declare const asNegativeSafeInt: <N extends number>(x: N) => number & {
21
+ readonly NaNValue: false;
22
+ readonly Finite: true;
23
+ readonly Int: true;
24
+ readonly ">=0": false;
25
+ readonly "!=0": true;
26
+ readonly "<=0": true;
27
+ readonly "< 2^15": true;
28
+ readonly "< 2^16": true;
29
+ readonly "< 2^31": true;
30
+ readonly "< 2^32": true;
31
+ readonly SafeInt: true;
32
+ } & Readonly<{
33
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
34
+ }> & N;
35
+ /**
36
+ * Namespace providing type-safe arithmetic operations for negative safe
37
+ * integers.
38
+ *
39
+ * NegativeSafeInt represents safe integers that are strictly less than zero
40
+ * (`[Number.MIN_SAFE_INTEGER, -1]`). Operations that stay within the negative
41
+ * safe integers clamp their results to the valid range, while operations whose
42
+ * result leaves the set (`mul`, `div`, `abs`) are typed to reflect the actual
43
+ * sign of the result.
44
+ */
45
+ export declare const NegativeSafeInt: {
46
+ /**
47
+ * Type guard to check if a value is a NegativeSafeInt.
48
+ *
49
+ * @param value The value to check.
50
+ * @returns `true` if the value is a negative safe integer, `false` otherwise.
51
+ */
52
+ readonly is: (a: number) => a is TtfImported_NegativeSafeInt;
53
+ /**
54
+ * The minimum value for a negative safe integer.
55
+ *
56
+ * @readonly
57
+ */
58
+ readonly MIN_VALUE: number;
59
+ /**
60
+ * The maximum value for a negative safe integer.
61
+ *
62
+ * @readonly
63
+ */
64
+ readonly MAX_VALUE: -1;
65
+ /**
66
+ * Returns the absolute value of a negative safe integer.
67
+ *
68
+ * @param a The negative safe integer.
69
+ * @returns The absolute value as a PositiveSafeInt.
70
+ */
71
+ readonly abs: (x: WithSmallInt<ElementType>) => PositiveSafeInt;
72
+ /**
73
+ * Returns the smaller of two negative safe integers.
74
+ *
75
+ * @param a The first negative safe integer.
76
+ * @param b The second negative safe integer.
77
+ * @returns The minimum value as a NegativeSafeInt.
78
+ */
79
+ readonly min: (...values: readonly WithSmallInt<TtfImported_NegativeSafeInt>[]) => TtfImported_NegativeSafeInt;
80
+ /**
81
+ * Returns the larger of two negative safe integers.
82
+ *
83
+ * @param a The first negative safe integer.
84
+ * @param b The second negative safe integer.
85
+ * @returns The maximum value as a NegativeSafeInt.
86
+ */
87
+ readonly max: (...values: readonly WithSmallInt<TtfImported_NegativeSafeInt>[]) => TtfImported_NegativeSafeInt;
88
+ /**
89
+ * Clamps a number to the NegativeSafeInt range.
90
+ *
91
+ * @param value The number to clamp.
92
+ * @returns The value clamped to `[Number.MIN_SAFE_INTEGER, -1]` as a
93
+ * NegativeSafeInt.
94
+ */
95
+ readonly clamp: (x: number) => TtfImported_NegativeSafeInt;
96
+ /**
97
+ * Generates a random NegativeSafeInt value within the valid range.
98
+ *
99
+ * @returns A random NegativeSafeInt between Number.MIN_SAFE_INTEGER and -1.
100
+ */
101
+ readonly random: (min?: WithSmallInt<TtfImported_NegativeSafeInt> | undefined, max?: WithSmallInt<TtfImported_NegativeSafeInt> | undefined) => TtfImported_NegativeSafeInt;
102
+ /**
103
+ * Raises a negative safe integer to the power of another negative safe
104
+ * integer.
105
+ *
106
+ * @param a The base negative safe integer.
107
+ * @param b The exponent negative safe integer.
108
+ * @returns `a ** b` clamped to the NegativeSafeInt range.
109
+ */
110
+ readonly pow: (x: WithSmallInt<TtfImported_NegativeSafeInt>, y: WithSmallInt<TtfImported_NegativeSafeInt>) => TtfImported_NegativeSafeInt;
111
+ /**
112
+ * Adds two negative safe integers.
113
+ *
114
+ * @param a The first negative safe integer.
115
+ * @param b The second negative safe integer.
116
+ * @returns `a + b` clamped to the NegativeSafeInt range.
117
+ */
118
+ readonly add: (x: WithSmallInt<TtfImported_NegativeSafeInt>, y: WithSmallInt<TtfImported_NegativeSafeInt>) => TtfImported_NegativeSafeInt;
119
+ /**
120
+ * Subtracts one negative safe integer from another.
121
+ *
122
+ * The mathematical result can be positive, so it is clamped to the
123
+ * NegativeSafeInt range (maximum `-1`).
124
+ *
125
+ * @param a The minuend negative safe integer.
126
+ * @param b The subtrahend negative safe integer.
127
+ * @returns `a - b` clamped to the NegativeSafeInt range.
128
+ */
129
+ readonly sub: (x: WithSmallInt<TtfImported_NegativeSafeInt>, y: WithSmallInt<TtfImported_NegativeSafeInt>) => TtfImported_NegativeSafeInt;
130
+ };
131
+ export {};
132
+ //# sourceMappingURL=negative-safe-int.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negative-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/negative-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,IAAI,2BAA2B,EACnD,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,2BAA2B,CAAC;AAE1D,KAAK,WAAW,GAAG,eAAe,CAAC;AAwCnC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,iDAAK,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;MAAW,CAAC;AAE1C;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;sBA3DW,YAAY,CAAC,WAAW,CAAC,KAAG,eAAe;IA8DzD;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;OAIG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;;OASG;;CAEK,CAAC"}
@@ -0,0 +1,136 @@
1
+ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { PositiveSafeInt } from './positive-safe-int.mjs';
3
+
4
+ const typeNameInMessage = 'a negative safe integer';
5
+ const { MAX_VALUE, MIN_VALUE, add, castType, clamp, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
6
+ integerOrSafeInteger: 'SafeInteger',
7
+ nonZero: true,
8
+ MIN_VALUE: Number.MIN_SAFE_INTEGER,
9
+ MAX_VALUE: -1,
10
+ typeNameInMessage,
11
+ });
12
+ /**
13
+ * Returns the absolute value of a negative safe integer.
14
+ *
15
+ * The absolute value of a negative safe integer is always a positive safe
16
+ * integer (`>= 1`), so the result is typed as a {@link PositiveSafeInt}.
17
+ *
18
+ * @param x - The negative safe integer.
19
+ * @returns `|x|` as a PositiveSafeInt.
20
+ */
21
+ const abs = (x) => PositiveSafeInt.clamp(Math.abs(x));
22
+ /**
23
+ * Checks if a number is a NegativeSafeInt (a negative safe integer in the range
24
+ * `[Number.MIN_SAFE_INTEGER, -1]`).
25
+ *
26
+ * @param value The value to check.
27
+ * @returns `true` if the value is a NegativeSafeInt, `false` otherwise.
28
+ */
29
+ const isNegativeSafeInt = is;
30
+ /**
31
+ * Casts a number to a NegativeSafeInt type.
32
+ *
33
+ * @param value The value to cast.
34
+ * @returns The value as a NegativeSafeInt type.
35
+ * @throws {TypeError} If the value is not a negative safe integer.
36
+ */
37
+ const asNegativeSafeInt = castType;
38
+ /**
39
+ * Namespace providing type-safe arithmetic operations for negative safe
40
+ * integers.
41
+ *
42
+ * NegativeSafeInt represents safe integers that are strictly less than zero
43
+ * (`[Number.MIN_SAFE_INTEGER, -1]`). Operations that stay within the negative
44
+ * safe integers clamp their results to the valid range, while operations whose
45
+ * result leaves the set (`mul`, `div`, `abs`) are typed to reflect the actual
46
+ * sign of the result.
47
+ */
48
+ const NegativeSafeInt = {
49
+ /**
50
+ * Type guard to check if a value is a NegativeSafeInt.
51
+ *
52
+ * @param value The value to check.
53
+ * @returns `true` if the value is a negative safe integer, `false` otherwise.
54
+ */
55
+ is,
56
+ /**
57
+ * The minimum value for a negative safe integer.
58
+ *
59
+ * @readonly
60
+ */
61
+ MIN_VALUE,
62
+ /**
63
+ * The maximum value for a negative safe integer.
64
+ *
65
+ * @readonly
66
+ */
67
+ MAX_VALUE,
68
+ /**
69
+ * Returns the absolute value of a negative safe integer.
70
+ *
71
+ * @param a The negative safe integer.
72
+ * @returns The absolute value as a PositiveSafeInt.
73
+ */
74
+ abs,
75
+ /**
76
+ * Returns the smaller of two negative safe integers.
77
+ *
78
+ * @param a The first negative safe integer.
79
+ * @param b The second negative safe integer.
80
+ * @returns The minimum value as a NegativeSafeInt.
81
+ */
82
+ min: min_,
83
+ /**
84
+ * Returns the larger of two negative safe integers.
85
+ *
86
+ * @param a The first negative safe integer.
87
+ * @param b The second negative safe integer.
88
+ * @returns The maximum value as a NegativeSafeInt.
89
+ */
90
+ max: max_,
91
+ /**
92
+ * Clamps a number to the NegativeSafeInt range.
93
+ *
94
+ * @param value The number to clamp.
95
+ * @returns The value clamped to `[Number.MIN_SAFE_INTEGER, -1]` as a
96
+ * NegativeSafeInt.
97
+ */
98
+ clamp,
99
+ /**
100
+ * Generates a random NegativeSafeInt value within the valid range.
101
+ *
102
+ * @returns A random NegativeSafeInt between Number.MIN_SAFE_INTEGER and -1.
103
+ */
104
+ random,
105
+ /**
106
+ * Raises a negative safe integer to the power of another negative safe
107
+ * integer.
108
+ *
109
+ * @param a The base negative safe integer.
110
+ * @param b The exponent negative safe integer.
111
+ * @returns `a ** b` clamped to the NegativeSafeInt range.
112
+ */
113
+ pow,
114
+ /**
115
+ * Adds two negative safe integers.
116
+ *
117
+ * @param a The first negative safe integer.
118
+ * @param b The second negative safe integer.
119
+ * @returns `a + b` clamped to the NegativeSafeInt range.
120
+ */
121
+ add,
122
+ /**
123
+ * Subtracts one negative safe integer from another.
124
+ *
125
+ * The mathematical result can be positive, so it is clamped to the
126
+ * NegativeSafeInt range (maximum `-1`).
127
+ *
128
+ * @param a The minuend negative safe integer.
129
+ * @param b The subtrahend negative safe integer.
130
+ * @returns `a - b` clamped to the NegativeSafeInt range.
131
+ */
132
+ sub,
133
+ };
134
+
135
+ export { NegativeSafeInt, asNegativeSafeInt, isNegativeSafeInt };
136
+ //# sourceMappingURL=negative-safe-int.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negative-safe-int.mjs","sources":["../../../src/number/branded-types/negative-safe-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAWA,MAAM,iBAAiB,GAAG,yBAAyB;AAEnD,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;AACnC,IAAA,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB;IAClC,SAAS,EAAE,EAAE;IACb,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;AAQG;AACH,MAAM,GAAG,GAAG,CAAC,CAA4B,KACvC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEpC;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG;AAEjC;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG;AAEjC;;;;;;;;;AASG;AACI,MAAM,eAAe,GAAG;AAC7B;;;;;AAKG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;AAIG;IACH,SAAS;AAET;;;;;AAKG;IACH,GAAG;AAEH;;;;;;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;;;;;;AAMG;IACH,GAAG;AAEH;;;;;;;;;AASG;IACH,GAAG;;;;;"}