ts-data-forge 6.13.1 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/README.md +2 -2
  2. package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-creation.mjs +1 -1
  4. package/dist/array/impl/array-utils-creation.mjs.map +1 -1
  5. package/dist/array/impl/array-utils-iterators.mjs +7 -1
  6. package/dist/array/impl/array-utils-iterators.mjs.map +1 -1
  7. package/dist/array/impl/array-utils-modification.mjs +6 -0
  8. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  9. package/dist/array/impl/array-utils-reducing-value.d.mts +1 -1
  10. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
  11. package/dist/array/impl/array-utils-reducing-value.mjs +6 -1
  12. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  13. package/dist/array/impl/array-utils-search.d.mts +0 -2
  14. package/dist/array/impl/array-utils-search.d.mts.map +1 -1
  15. package/dist/array/impl/array-utils-search.mjs +6 -0
  16. package/dist/array/impl/array-utils-search.mjs.map +1 -1
  17. package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
  18. package/dist/array/impl/array-utils-set-op.mjs +0 -1
  19. package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
  20. package/dist/array/impl/array-utils-slice-clamped.mjs +6 -0
  21. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
  22. package/dist/array/impl/array-utils-slicing.mjs +6 -0
  23. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  24. package/dist/array/impl/array-utils-transformation.d.mts +1 -1
  25. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
  26. package/dist/array/impl/array-utils-transformation.mjs +8 -4
  27. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  28. package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
  29. package/dist/array/impl/array-utils-validation.mjs +9 -9
  30. package/dist/array/impl/array-utils-validation.mjs.map +1 -1
  31. package/dist/collections/imap-mapped.d.mts +622 -3
  32. package/dist/collections/imap-mapped.d.mts.map +1 -1
  33. package/dist/collections/imap-mapped.mjs +117 -18
  34. package/dist/collections/imap-mapped.mjs.map +1 -1
  35. package/dist/collections/imap.d.mts +3 -3
  36. package/dist/collections/imap.d.mts.map +1 -1
  37. package/dist/collections/imap.mjs +12 -5
  38. package/dist/collections/imap.mjs.map +1 -1
  39. package/dist/collections/iset-mapped.d.mts +4 -4
  40. package/dist/collections/iset-mapped.d.mts.map +1 -1
  41. package/dist/collections/iset-mapped.mjs +14 -4
  42. package/dist/collections/iset-mapped.mjs.map +1 -1
  43. package/dist/collections/iset.d.mts +2 -2
  44. package/dist/collections/iset.d.mts.map +1 -1
  45. package/dist/collections/iset.mjs +11 -2
  46. package/dist/collections/iset.mjs.map +1 -1
  47. package/dist/collections/queue.mjs +26 -20
  48. package/dist/collections/queue.mjs.map +1 -1
  49. package/dist/collections/stack.mjs +23 -17
  50. package/dist/collections/stack.mjs.map +1 -1
  51. package/dist/entry-point.mjs +6 -0
  52. package/dist/entry-point.mjs.map +1 -1
  53. package/dist/functional/optional/impl/optional-flat-map.d.mts +2 -2
  54. package/dist/functional/pipe.d.mts.map +1 -1
  55. package/dist/functional/pipe.mjs.map +1 -1
  56. package/dist/functional/result/impl/result-flat-map.d.mts +2 -2
  57. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +5 -3
  58. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -1
  59. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
  60. package/dist/guard/has-key.d.mts.map +1 -1
  61. package/dist/guard/has-key.mjs +1 -3
  62. package/dist/guard/has-key.mjs.map +1 -1
  63. package/dist/guard/is-non-null-object.d.mts.map +1 -1
  64. package/dist/guard/is-non-null-object.mjs +1 -3
  65. package/dist/guard/is-non-null-object.mjs.map +1 -1
  66. package/dist/guard/key-is-in.d.mts.map +1 -1
  67. package/dist/guard/key-is-in.mjs +1 -3
  68. package/dist/guard/key-is-in.mjs.map +1 -1
  69. package/dist/index.mjs +6 -0
  70. package/dist/index.mjs.map +1 -1
  71. package/dist/iterator/range.mjs +6 -0
  72. package/dist/iterator/range.mjs.map +1 -1
  73. package/dist/json/json.mjs +11 -7
  74. package/dist/json/json.mjs.map +1 -1
  75. package/dist/number/branded-types/finite-number.d.mts +1 -1
  76. package/dist/number/branded-types/index.d.mts +6 -0
  77. package/dist/number/branded-types/index.d.mts.map +1 -1
  78. package/dist/number/branded-types/index.mjs +6 -0
  79. package/dist/number/branded-types/index.mjs.map +1 -1
  80. package/dist/number/branded-types/int.d.mts +1 -2
  81. package/dist/number/branded-types/int.d.mts.map +1 -1
  82. package/dist/number/branded-types/int16.d.mts +2 -3
  83. package/dist/number/branded-types/int16.d.mts.map +1 -1
  84. package/dist/number/branded-types/int32.d.mts +2 -3
  85. package/dist/number/branded-types/int32.d.mts.map +1 -1
  86. package/dist/number/branded-types/negative-finite-number.d.mts +143 -0
  87. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -0
  88. package/dist/number/branded-types/negative-finite-number.mjs +156 -0
  89. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -0
  90. package/dist/number/branded-types/negative-int.d.mts +120 -0
  91. package/dist/number/branded-types/negative-int.d.mts.map +1 -0
  92. package/dist/number/branded-types/negative-int.mjs +125 -0
  93. package/dist/number/branded-types/negative-int.mjs.map +1 -0
  94. package/dist/number/branded-types/negative-safe-int.d.mts +132 -0
  95. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -0
  96. package/dist/number/branded-types/negative-safe-int.mjs +136 -0
  97. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -0
  98. package/dist/number/branded-types/non-negative-finite-number.d.mts +1 -1
  99. package/dist/number/branded-types/non-negative-int16.d.mts +1 -1
  100. package/dist/number/branded-types/non-negative-int32.d.mts +1 -1
  101. package/dist/number/branded-types/non-positive-finite-number.d.mts +130 -0
  102. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -0
  103. package/dist/number/branded-types/non-positive-finite-number.mjs +134 -0
  104. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -0
  105. package/dist/number/branded-types/non-positive-int.d.mts +224 -0
  106. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -0
  107. package/dist/number/branded-types/non-positive-int.mjs +222 -0
  108. package/dist/number/branded-types/non-positive-int.mjs.map +1 -0
  109. package/dist/number/branded-types/non-positive-safe-int.d.mts +119 -0
  110. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -0
  111. package/dist/number/branded-types/non-positive-safe-int.mjs +116 -0
  112. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -0
  113. package/dist/number/branded-types/non-zero-finite-number.d.mts +5 -17
  114. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  115. package/dist/number/branded-types/non-zero-finite-number.mjs +5 -17
  116. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  117. package/dist/number/branded-types/non-zero-int.d.mts +5 -33
  118. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  119. package/dist/number/branded-types/non-zero-int.mjs +5 -25
  120. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  121. package/dist/number/branded-types/non-zero-int16.d.mts +6 -43
  122. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  123. package/dist/number/branded-types/non-zero-int16.mjs +5 -25
  124. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  125. package/dist/number/branded-types/non-zero-int32.d.mts +6 -39
  126. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  127. package/dist/number/branded-types/non-zero-int32.mjs +5 -25
  128. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  129. package/dist/number/branded-types/non-zero-safe-int.d.mts +5 -37
  130. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  131. package/dist/number/branded-types/non-zero-safe-int.mjs +7 -30
  132. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  133. package/dist/number/branded-types/non-zero-uint16.d.mts +6 -33
  134. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  135. package/dist/number/branded-types/non-zero-uint16.mjs +5 -17
  136. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  137. package/dist/number/branded-types/non-zero-uint32.d.mts +6 -31
  138. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  139. package/dist/number/branded-types/non-zero-uint32.mjs +5 -17
  140. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  141. package/dist/number/branded-types/positive-finite-number.d.mts +4 -2
  142. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  143. package/dist/number/branded-types/positive-int.d.mts +4 -2
  144. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  145. package/dist/number/branded-types/positive-int16.d.mts +4 -2
  146. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  147. package/dist/number/branded-types/positive-int32.d.mts +4 -2
  148. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  149. package/dist/number/branded-types/positive-safe-int.d.mts +4 -2
  150. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  151. package/dist/number/branded-types/positive-safe-int.mjs +1 -1
  152. package/dist/number/branded-types/positive-uint16.d.mts +4 -2
  153. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  154. package/dist/number/branded-types/positive-uint32.d.mts +4 -2
  155. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  156. package/dist/number/branded-types/safe-int.d.mts +1 -2
  157. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  158. package/dist/number/branded-types/safe-int.mjs +2 -2
  159. package/dist/number/branded-types/safe-uint.d.mts +1 -1
  160. package/dist/number/branded-types/safe-uint.mjs +1 -1
  161. package/dist/number/branded-types/uint.d.mts +1 -1
  162. package/dist/number/branded-types/uint16.d.mts +1 -1
  163. package/dist/number/branded-types/uint32.d.mts +1 -1
  164. package/dist/number/index.d.mts +1 -0
  165. package/dist/number/index.d.mts.map +1 -1
  166. package/dist/number/index.mjs +6 -0
  167. package/dist/number/index.mjs.map +1 -1
  168. package/dist/number/num-arithmetic-types.d.mts +74 -0
  169. package/dist/number/num-arithmetic-types.d.mts.map +1 -0
  170. package/dist/number/num-arithmetic-types.mjs +2 -0
  171. package/dist/number/num-arithmetic-types.mjs.map +1 -0
  172. package/dist/number/num.d.mts +53 -9
  173. package/dist/number/num.d.mts.map +1 -1
  174. package/dist/number/num.mjs +67 -15
  175. package/dist/number/num.mjs.map +1 -1
  176. package/dist/number/refined-number-utils.d.mts +12 -9
  177. package/dist/number/refined-number-utils.d.mts.map +1 -1
  178. package/dist/number/refined-number-utils.mjs.map +1 -1
  179. package/dist/object/object.mjs +7 -1
  180. package/dist/object/object.mjs.map +1 -1
  181. package/dist/others/fast-deep-equal.d.mts.map +1 -1
  182. package/dist/others/fast-deep-equal.mjs +0 -1
  183. package/dist/others/fast-deep-equal.mjs.map +1 -1
  184. package/dist/others/unknown-to-string.mjs +2 -2
  185. package/dist/others/unknown-to-string.mjs.map +1 -1
  186. package/package.json +6 -6
  187. package/src/array/impl/array-utils-creation.mts +1 -1
  188. package/src/array/impl/array-utils-iterators.mts +1 -1
  189. package/src/array/impl/array-utils-reducing-value.mts +1 -2
  190. package/src/array/impl/array-utils-search.mts +0 -2
  191. package/src/array/impl/array-utils-set-op.mts +0 -1
  192. package/src/array/impl/array-utils-transformation.mts +8 -6
  193. package/src/array/impl/array-utils-validation.mts +1 -5
  194. package/src/collections/imap-mapped.mts +696 -34
  195. package/src/collections/imap-mapped.test.mts +61 -13
  196. package/src/collections/imap.mts +20 -9
  197. package/src/collections/imap.test.mts +9 -8
  198. package/src/collections/iset-mapped.mts +18 -10
  199. package/src/collections/iset-mapped.test.mts +6 -1
  200. package/src/collections/iset.mts +11 -4
  201. package/src/collections/iset.test.mts +6 -8
  202. package/src/collections/queue.mts +32 -32
  203. package/src/collections/stack.mts +26 -26
  204. package/src/functional/optional/impl/optional-flat-map.mts +2 -2
  205. package/src/functional/optional.test.mts +6 -4
  206. package/src/functional/pipe.mts +0 -1
  207. package/src/functional/pipe.test.mts +2 -1
  208. package/src/functional/result/impl/result-flat-map.mts +2 -2
  209. package/src/functional/result.test.mts +3 -2
  210. package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +5 -3
  211. package/src/functional/ternary-result.test.mts +8 -3
  212. package/src/guard/has-key.mts +1 -3
  213. package/src/guard/is-non-null-object.mts +0 -1
  214. package/src/guard/key-is-in.mts +1 -3
  215. package/src/json/json.mts +5 -8
  216. package/src/json/json.test.mts +2 -2
  217. package/src/number/branded-types/index.mts +6 -0
  218. package/src/number/branded-types/negative-finite-number.mts +210 -0
  219. package/src/number/branded-types/negative-finite-number.test.mts +172 -0
  220. package/src/number/branded-types/negative-int.mts +160 -0
  221. package/src/number/branded-types/negative-int.test.mts +146 -0
  222. package/src/number/branded-types/negative-safe-int.mts +173 -0
  223. package/src/number/branded-types/negative-safe-int.test.mts +120 -0
  224. package/src/number/branded-types/non-positive-finite-number.mts +191 -0
  225. package/src/number/branded-types/non-positive-finite-number.test.mts +286 -0
  226. package/src/number/branded-types/non-positive-int.mts +251 -0
  227. package/src/number/branded-types/non-positive-int.test.mts +197 -0
  228. package/src/number/branded-types/non-positive-safe-int.mts +147 -0
  229. package/src/number/branded-types/non-positive-safe-int.test.mts +223 -0
  230. package/src/number/branded-types/non-zero-finite-number.mts +14 -22
  231. package/src/number/branded-types/non-zero-finite-number.test.mts +0 -12
  232. package/src/number/branded-types/non-zero-int.mts +10 -32
  233. package/src/number/branded-types/non-zero-int.test.mts +0 -20
  234. package/src/number/branded-types/non-zero-int16.mts +8 -32
  235. package/src/number/branded-types/non-zero-int16.test.mts +0 -30
  236. package/src/number/branded-types/non-zero-int32.mts +8 -32
  237. package/src/number/branded-types/non-zero-int32.test.mts +0 -30
  238. package/src/number/branded-types/non-zero-safe-int.mts +10 -37
  239. package/src/number/branded-types/non-zero-safe-int.test.mts +0 -32
  240. package/src/number/branded-types/non-zero-uint16.mts +8 -22
  241. package/src/number/branded-types/non-zero-uint16.test.mts +0 -16
  242. package/src/number/branded-types/non-zero-uint32.mts +8 -22
  243. package/src/number/branded-types/non-zero-uint32.test.mts +0 -16
  244. package/src/number/branded-types/positive-safe-int.mts +1 -1
  245. package/src/number/branded-types/safe-int.mts +2 -2
  246. package/src/number/branded-types/safe-uint.mts +1 -1
  247. package/src/number/index.mts +1 -0
  248. package/src/number/num-arithmetic-types.mts +265 -0
  249. package/src/number/num-arithmetic-types.test.mts +130 -0
  250. package/src/number/num-arithmetic.test.mts +102 -0
  251. package/src/number/num.mts +99 -18
  252. package/src/number/num.test.mts +2 -2
  253. package/src/number/refined-number-utils.mts +19 -9
  254. package/src/object/object.mts +2 -2
  255. package/src/others/fast-deep-equal.mts +0 -2
  256. package/src/others/map-nullable.test.mts +4 -3
  257. package/src/others/unknown-to-string.mts +2 -2
@@ -0,0 +1,224 @@
1
+ import { type NonPositiveInt as TtfImported_NonPositiveInt } from 'ts-type-forge';
2
+ export type NonPositiveInt = TtfImported_NonPositiveInt;
3
+ /**
4
+ * Type guard that checks if a value is a non-positive integer.
5
+ *
6
+ * A non-positive integer is any integer less than or equal to zero (<= 0).
7
+ * This includes zero and all negative integers, but excludes positive numbers
8
+ * and non-integers.
9
+ *
10
+ * @example
11
+ *
12
+ * ```ts
13
+ * assert.isTrue(isNonPositiveInt(0));
14
+ *
15
+ * assert.isTrue(isNonPositiveInt(-5));
16
+ *
17
+ * assert.isFalse(isNonPositiveInt(1));
18
+ * ```
19
+ *
20
+ * @param value - The value to check
21
+ * @returns `true` if the value is a non-positive integer, `false` otherwise
22
+ */
23
+ export declare const isNonPositiveInt: (a: number) => a is TtfImported_NonPositiveInt;
24
+ /**
25
+ * Casts a number to a NonPositiveInt branded type.
26
+ *
27
+ * This function validates that the input is a non-positive integer (<= 0) and
28
+ * returns it with the NonPositiveInt brand. This ensures type safety for
29
+ * operations that require non-positive integer values.
30
+ *
31
+ * @example
32
+ *
33
+ * ```ts
34
+ * const branded = asNonPositiveInt(-7);
35
+ *
36
+ * assert.isTrue(branded === -7);
37
+ *
38
+ * assert.isTrue(NonPositiveInt.is(branded));
39
+ * ```
40
+ *
41
+ * @param value - The value to cast
42
+ * @returns The value as a NonPositiveInt branded type
43
+ * @throws {TypeError} If the value is not a non-positive integer
44
+ */
45
+ export declare const asNonPositiveInt: <N extends number>(x: N) => number & {
46
+ readonly NaNValue: false;
47
+ readonly Finite: true;
48
+ readonly Int: true;
49
+ readonly "<=0": true;
50
+ readonly "< 2^15": true;
51
+ readonly "< 2^16": true;
52
+ readonly "< 2^31": true;
53
+ readonly "< 2^32": true;
54
+ } & Readonly<{
55
+ 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
56
+ }> & N;
57
+ /**
58
+ * Namespace providing type-safe operations for NonPositiveInt branded types.
59
+ *
60
+ * NonPositiveInt represents integers that are less than or equal to zero (<= 0).
61
+ * All operations automatically clamp results to maintain the non-positive
62
+ * constraint, ensuring that arithmetic operations never produce positive values.
63
+ *
64
+ * This type is essential for:
65
+ *
66
+ * - Debts and negative balances
67
+ * - Penalties and reductions
68
+ * - Offsets and adjustments (downward)
69
+ * - Negative counts or differences
70
+ * - Depth or altitude below a reference point
71
+ */
72
+ export declare const NonPositiveInt: {
73
+ /**
74
+ * Type guard that checks if a value is a non-positive integer.
75
+ *
76
+ * @example
77
+ *
78
+ * ```ts
79
+ * const value: number = -42;
80
+ *
81
+ * if (NonPositiveInt.is(value)) {
82
+ * // value is now typed as NonPositiveInt
83
+ * const debt = value;
84
+ * }
85
+ * ```
86
+ *
87
+ * @param value - The value to check
88
+ * @returns `true` if the value is a non-positive integer, `false` otherwise
89
+ */
90
+ readonly is: (a: number) => a is TtfImported_NonPositiveInt;
91
+ /**
92
+ * The maximum value for a non-positive integer.
93
+ *
94
+ * @readonly
95
+ */
96
+ readonly MAX_VALUE: 0;
97
+ /**
98
+ * Returns the smaller of two non-positive integers.
99
+ *
100
+ * Since non-positive integers range from negative infinity to 0, the smaller
101
+ * value is the one further from zero (more negative).
102
+ *
103
+ * @example
104
+ *
105
+ * ```ts
106
+ * const result = NonPositiveInt.min(-5, -10);
107
+ *
108
+ * assert.strictEqual(result, -10);
109
+ * ```
110
+ *
111
+ * @param a - The first non-positive integer
112
+ * @param b - The second non-positive integer
113
+ * @returns The minimum value as a non-positive integer
114
+ */
115
+ readonly min: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>[]) => TtfImported_NonPositiveInt;
116
+ /**
117
+ * Returns the larger of two non-positive integers.
118
+ *
119
+ * Since non-positive integers range from negative infinity to 0, the larger
120
+ * value is the one closer to zero (less negative).
121
+ *
122
+ * @example
123
+ *
124
+ * ```ts
125
+ * const result = NonPositiveInt.max(-5, -10);
126
+ *
127
+ * assert.strictEqual(result, -5);
128
+ * ```
129
+ *
130
+ * @param a - The first non-positive integer
131
+ * @param b - The second non-positive integer
132
+ * @returns The maximum value as a non-positive integer
133
+ */
134
+ readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>[]) => TtfImported_NonPositiveInt;
135
+ /**
136
+ * Clamps a number to the non-positive integer range.
137
+ *
138
+ * Any positive value is clamped to 0 (the maximum non-positive integer).
139
+ * Negative values are preserved as long as they are valid integers.
140
+ *
141
+ * @example
142
+ *
143
+ * ```ts
144
+ * assert.strictEqual(NonPositiveInt.clamp(5), 0);
145
+ *
146
+ * assert.strictEqual(NonPositiveInt.clamp(-5), -5);
147
+ *
148
+ * assert.strictEqual(NonPositiveInt.clamp(0), 0);
149
+ * ```
150
+ *
151
+ * @param value - The number to clamp
152
+ * @returns The value clamped to the non-positive integer range
153
+ */
154
+ readonly clamp: (x: number) => TtfImported_NonPositiveInt;
155
+ /**
156
+ * Generates a random non-positive integer value.
157
+ *
158
+ * @example
159
+ *
160
+ * ```ts
161
+ * const randomValue = NonPositiveInt.random();
162
+ *
163
+ * assert.isTrue(NonPositiveInt.is(randomValue));
164
+ * ```
165
+ *
166
+ * @returns A random non-positive integer
167
+ */
168
+ readonly random: (min?: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt> | undefined, max?: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt> | undefined) => TtfImported_NonPositiveInt;
169
+ /**
170
+ * Raises a non-positive integer to the power of another non-positive integer.
171
+ *
172
+ * The result is clamped to the non-positive integer range.
173
+ *
174
+ * @example
175
+ *
176
+ * ```ts
177
+ * const result = NonPositiveInt.pow(-2, -1);
178
+ * ```
179
+ *
180
+ * @param a - The base non-positive integer
181
+ * @param b - The exponent non-positive integer
182
+ * @returns `a ** b` clamped to the non-positive integer range
183
+ */
184
+ readonly pow: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>) => TtfImported_NonPositiveInt;
185
+ /**
186
+ * Adds two non-positive integers.
187
+ *
188
+ * The result is clamped to the non-positive integer range. If the sum is
189
+ * positive, it is clamped to 0.
190
+ *
191
+ * @example
192
+ *
193
+ * ```ts
194
+ * assert.strictEqual(NonPositiveInt.add(-5, -3), -8);
195
+ *
196
+ * assert.strictEqual(NonPositiveInt.add(-5, 10), 0);
197
+ * ```
198
+ *
199
+ * @param a - The first non-positive integer
200
+ * @param b - The second non-positive integer
201
+ * @returns `a + b` clamped to the non-positive integer range
202
+ */
203
+ readonly add: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>) => TtfImported_NonPositiveInt;
204
+ /**
205
+ * Subtracts one non-positive integer from another.
206
+ *
207
+ * The result is clamped to the non-positive integer range. If the result is
208
+ * positive, it is clamped to 0.
209
+ *
210
+ * @example
211
+ *
212
+ * ```ts
213
+ * assert.strictEqual(NonPositiveInt.sub(-10, -3), -7);
214
+ *
215
+ * assert.strictEqual(NonPositiveInt.sub(-10, 5), 0);
216
+ * ```
217
+ *
218
+ * @param a - The minuend non-positive integer
219
+ * @param b - The subtrahend non-positive integer
220
+ * @returns `a - b` clamped to the non-positive integer range
221
+ */
222
+ readonly sub: (x: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>, y: import("ts-type-forge").WithSmallInt<TtfImported_NonPositiveInt>) => TtfImported_NonPositiveInt;
223
+ };
224
+ //# sourceMappingURL=non-positive-int.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAGlF,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC;AA4BxD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB,gDAAK,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;MAAW,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc;IACzB;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;OAIG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;OAYG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;CAEK,CAAC"}
@@ -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;;;;;"}