ts-data-forge 11.0.1 → 12.1.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 (178) hide show
  1. package/README.md +2 -2
  2. package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts +65 -5
  3. package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts.map +1 -1
  4. package/dist/array/impl/array-utils-length-bounded-array-cast.mjs +69 -27
  5. package/dist/array/impl/array-utils-length-bounded-array-cast.mjs.map +1 -1
  6. package/dist/array/impl/index.mjs +1 -1
  7. package/dist/number/branded-types/int16.d.mts +12 -7
  8. package/dist/number/branded-types/int16.d.mts.map +1 -1
  9. package/dist/number/branded-types/int16.mjs +13 -8
  10. package/dist/number/branded-types/int16.mjs.map +1 -1
  11. package/dist/number/branded-types/int32.d.mts +12 -7
  12. package/dist/number/branded-types/int32.d.mts.map +1 -1
  13. package/dist/number/branded-types/int32.mjs +13 -8
  14. package/dist/number/branded-types/int32.mjs.map +1 -1
  15. package/dist/number/branded-types/negative-finite-number.d.mts +13 -6
  16. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  17. package/dist/number/branded-types/negative-finite-number.mjs +15 -8
  18. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  19. package/dist/number/branded-types/negative-int.d.mts +11 -6
  20. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  21. package/dist/number/branded-types/negative-int.mjs +13 -8
  22. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  23. package/dist/number/branded-types/negative-safe-int.d.mts +13 -7
  24. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  25. package/dist/number/branded-types/negative-safe-int.mjs +15 -9
  26. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  27. package/dist/number/branded-types/non-negative-finite-number.d.mts +11 -6
  28. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  29. package/dist/number/branded-types/non-negative-finite-number.mjs +12 -7
  30. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  31. package/dist/number/branded-types/non-negative-int16.d.mts +13 -7
  32. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  33. package/dist/number/branded-types/non-negative-int16.mjs +14 -8
  34. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  35. package/dist/number/branded-types/non-negative-int32.d.mts +13 -7
  36. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  37. package/dist/number/branded-types/non-negative-int32.mjs +14 -8
  38. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  39. package/dist/number/branded-types/non-positive-finite-number.d.mts +11 -6
  40. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  41. package/dist/number/branded-types/non-positive-finite-number.mjs +12 -7
  42. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  43. package/dist/number/branded-types/non-positive-int.d.mts +11 -6
  44. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  45. package/dist/number/branded-types/non-positive-int.mjs +12 -7
  46. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  47. package/dist/number/branded-types/non-positive-safe-int.d.mts +14 -7
  48. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  49. package/dist/number/branded-types/non-positive-safe-int.mjs +15 -8
  50. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  51. package/dist/number/branded-types/non-zero-int16.d.mts +13 -7
  52. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  53. package/dist/number/branded-types/non-zero-int16.mjs +14 -8
  54. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  55. package/dist/number/branded-types/non-zero-int32.d.mts +13 -7
  56. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  57. package/dist/number/branded-types/non-zero-int32.mjs +14 -8
  58. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  59. package/dist/number/branded-types/non-zero-safe-int.d.mts +13 -7
  60. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  61. package/dist/number/branded-types/non-zero-safe-int.mjs +14 -8
  62. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  63. package/dist/number/branded-types/non-zero-uint16.d.mts +13 -7
  64. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  65. package/dist/number/branded-types/non-zero-uint16.mjs +14 -8
  66. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  67. package/dist/number/branded-types/non-zero-uint32.d.mts +13 -7
  68. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  69. package/dist/number/branded-types/non-zero-uint32.mjs +14 -8
  70. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  71. package/dist/number/branded-types/positive-finite-number.d.mts +13 -6
  72. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  73. package/dist/number/branded-types/positive-finite-number.mjs +14 -7
  74. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  75. package/dist/number/branded-types/positive-int.d.mts +13 -8
  76. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  77. package/dist/number/branded-types/positive-int.mjs +14 -9
  78. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  79. package/dist/number/branded-types/positive-int16.d.mts +13 -7
  80. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  81. package/dist/number/branded-types/positive-int16.mjs +14 -8
  82. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  83. package/dist/number/branded-types/positive-int32.d.mts +13 -7
  84. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  85. package/dist/number/branded-types/positive-int32.mjs +14 -8
  86. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  87. package/dist/number/branded-types/positive-safe-int.d.mts +16 -10
  88. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  89. package/dist/number/branded-types/positive-safe-int.mjs +17 -11
  90. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  91. package/dist/number/branded-types/positive-uint16.d.mts +13 -7
  92. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  93. package/dist/number/branded-types/positive-uint16.mjs +14 -8
  94. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  95. package/dist/number/branded-types/positive-uint32.d.mts +13 -7
  96. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  97. package/dist/number/branded-types/positive-uint32.mjs +14 -8
  98. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  99. package/dist/number/branded-types/safe-int.d.mts +15 -10
  100. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  101. package/dist/number/branded-types/safe-int.mjs +16 -11
  102. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  103. package/dist/number/branded-types/safe-uint.d.mts +12 -7
  104. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  105. package/dist/number/branded-types/safe-uint.mjs +13 -8
  106. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  107. package/dist/number/branded-types/uint.d.mts +14 -10
  108. package/dist/number/branded-types/uint.d.mts.map +1 -1
  109. package/dist/number/branded-types/uint.mjs +15 -11
  110. package/dist/number/branded-types/uint.mjs.map +1 -1
  111. package/dist/number/branded-types/uint16.d.mts +12 -7
  112. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  113. package/dist/number/branded-types/uint16.mjs +13 -8
  114. package/dist/number/branded-types/uint16.mjs.map +1 -1
  115. package/dist/number/branded-types/uint32.d.mts +12 -7
  116. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  117. package/dist/number/branded-types/uint32.mjs +13 -8
  118. package/dist/number/branded-types/uint32.mjs.map +1 -1
  119. package/dist/number/enum/int8.d.mts +12 -7
  120. package/dist/number/enum/int8.d.mts.map +1 -1
  121. package/dist/number/enum/int8.mjs +19 -14
  122. package/dist/number/enum/int8.mjs.map +1 -1
  123. package/dist/number/enum/uint8.d.mts +12 -7
  124. package/dist/number/enum/uint8.d.mts.map +1 -1
  125. package/dist/number/enum/uint8.mjs +19 -14
  126. package/dist/number/enum/uint8.mjs.map +1 -1
  127. package/dist/number/refined-number-utils.d.mts +9 -9
  128. package/dist/number/refined-number-utils.d.mts.map +1 -1
  129. package/dist/number/refined-number-utils.mjs +7 -7
  130. package/dist/number/refined-number-utils.mjs.map +1 -1
  131. package/dist/string/str.d.mts +70 -5
  132. package/dist/string/str.d.mts.map +1 -1
  133. package/dist/string/str.mjs +72 -26
  134. package/dist/string/str.mjs.map +1 -1
  135. package/package.json +1 -1
  136. package/src/array/impl/array-utils-length-bounded-array-cast.mts +204 -39
  137. package/src/array/impl/array-utils-length-bounded-array-cast.test.mts +126 -0
  138. package/src/number/branded-types/int16.mts +13 -8
  139. package/src/number/branded-types/int32.mts +13 -8
  140. package/src/number/branded-types/negative-finite-number.mts +15 -8
  141. package/src/number/branded-types/negative-finite-number.test.mts +4 -4
  142. package/src/number/branded-types/negative-int.mts +13 -8
  143. package/src/number/branded-types/negative-int.test.mts +5 -5
  144. package/src/number/branded-types/negative-safe-int.mts +15 -9
  145. package/src/number/branded-types/negative-safe-int.test.mts +4 -4
  146. package/src/number/branded-types/non-negative-finite-number.mts +12 -7
  147. package/src/number/branded-types/non-negative-int16.mts +14 -8
  148. package/src/number/branded-types/non-negative-int32.mts +14 -8
  149. package/src/number/branded-types/non-positive-finite-number.mts +12 -7
  150. package/src/number/branded-types/non-positive-finite-number.test.mts +7 -7
  151. package/src/number/branded-types/non-positive-int.mts +12 -7
  152. package/src/number/branded-types/non-positive-int.test.mts +7 -7
  153. package/src/number/branded-types/non-positive-safe-int.mts +15 -8
  154. package/src/number/branded-types/non-positive-safe-int.test.mts +7 -7
  155. package/src/number/branded-types/non-zero-int16.mts +14 -8
  156. package/src/number/branded-types/non-zero-int32.mts +14 -8
  157. package/src/number/branded-types/non-zero-safe-int.mts +14 -8
  158. package/src/number/branded-types/non-zero-uint16.mts +14 -8
  159. package/src/number/branded-types/non-zero-uint32.mts +14 -8
  160. package/src/number/branded-types/positive-finite-number.mts +14 -7
  161. package/src/number/branded-types/positive-int.mts +14 -9
  162. package/src/number/branded-types/positive-int16.mts +14 -8
  163. package/src/number/branded-types/positive-int32.mts +14 -8
  164. package/src/number/branded-types/positive-safe-int.mts +17 -11
  165. package/src/number/branded-types/positive-uint16.mts +14 -8
  166. package/src/number/branded-types/positive-uint32.mts +14 -8
  167. package/src/number/branded-types/safe-int.mts +16 -11
  168. package/src/number/branded-types/safe-uint.mts +13 -8
  169. package/src/number/branded-types/uint.mts +15 -11
  170. package/src/number/branded-types/uint16.mts +13 -8
  171. package/src/number/branded-types/uint32.mts +13 -8
  172. package/src/number/enum/int8.mts +20 -14
  173. package/src/number/enum/int8.test.mts +7 -4
  174. package/src/number/enum/uint8.mts +20 -14
  175. package/src/number/enum/uint8.test.mts +7 -4
  176. package/src/number/refined-number-utils.mts +22 -19
  177. package/src/string/str.mts +201 -39
  178. package/src/string/str.test.mts +76 -0
@@ -1 +1 @@
1
- {"version":3,"file":"positive-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,IAAI,gCAAgC,EAE9D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;AAqExC;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,sDAAK,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;MAAW,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;;OAMG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;wBApHA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAC3D;IAoHC;;;;;;OAMG;uBAjHA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IAmH3D;;;;;;OAMG;wBApHA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAC3D;IAoHC;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"positive-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,IAAI,gCAAgC,EAE9D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;AAqExC;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,sDAAK,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;MAAW,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;OAMG;wBA3HA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAC3D;IA2HC;;;;;;OAMG;uBAxHA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IA0H3D;;;;;;OAMG;wBA3HA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAC3D;IA2HC;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;CAEK,CAAC"}
@@ -5,8 +5,8 @@ const {
5
5
  MIN_VALUE,
6
6
  add,
7
7
  castType,
8
- clamp,
9
8
  div,
9
+ fromNumber,
10
10
  is,
11
11
  max: max_,
12
12
  min: min_,
@@ -47,7 +47,10 @@ const PositiveFiniteNumber = {
47
47
  */
48
48
  is,
49
49
  /**
50
- * The smallest value representable as `PositiveFiniteNumber`.
50
+ * The smallest value representable as `PositiveFiniteNumber` (the lower
51
+ * saturation target of `fromNumber`). The domain is open at `0` (excluded),
52
+ * so this is `Number.MIN_VALUE` — the smallest positive double — rather than
53
+ * `0`.
51
54
  */
52
55
  MIN_VALUE,
53
56
  /**
@@ -65,13 +68,17 @@ const PositiveFiniteNumber = {
65
68
  */
66
69
  max: max_,
67
70
  /**
68
- * Clamps a `number` into the `PositiveFiniteNumber` range `[MIN_VALUE,
69
- * MAX_VALUE]`.
71
+ * Converts an arbitrary `number` into a `PositiveFiniteNumber`, saturating it
72
+ * into the range `[MIN_VALUE, MAX_VALUE]`.
70
73
  *
71
- * @param value - The value to clamp
72
- * @returns The clamped value as a `PositiveFiniteNumber`
74
+ * Unlike `asPositiveFiniteNumber`, this is total: out-of-range inputs are
75
+ * clamped to the nearest representable `PositiveFiniteNumber` instead of
76
+ * throwing.
77
+ *
78
+ * @param value - The value to convert
79
+ * @returns The value as a `PositiveFiniteNumber`
73
80
  */
74
- clamp,
81
+ fromNumber,
75
82
  /**
76
83
  * Returns the greatest integer less than or equal to a positive finite
77
84
  * number.
@@ -1 +1 @@
1
- {"version":3,"file":"positive-finite-number.mjs","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"sourcesContent":["import {\n type PositiveInt,\n type PositiveFiniteNumber as TtfImported_PositiveFiniteNumber,\n type Uint,\n} from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveFiniteNumber = TtfImported_PositiveFiniteNumber;\n\ntype ElementType = PositiveFiniteNumber;\n\nconst typeNameInMessage = 'a positive finite number';\n\nconst {\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat<\n ElementType,\n number,\n number\n>({\n MIN_VALUE: Number.MIN_VALUE,\n MAX_VALUE: Number.MAX_VALUE,\n typeNameInMessage,\n} as const);\n\nconst floor = (\n x: ElementType,\n): TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.floor(\n x,\n ) as TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n >;\n\nconst ceil = (\n x: ElementType,\n): TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.ceil(x) as TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;\n\nconst round = (\n x: ElementType,\n): TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.round(\n x,\n ) as TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n >;\n\nexpectType<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>,\n PositiveInt\n>('=');\n\nexpectType<\n TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n >,\n Uint\n>('=');\n\n/**\n * Type guard that checks if a value is a positive finite number.\n *\n * Returns `true` only for a finite value — never `NaN`, `Infinity`, or\n * `-Infinity`.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive finite number, `false` otherwise\n */\nexport const isPositiveFiniteNumber = is;\n\n/**\n * Casts a `number` to the `PositiveFiniteNumber` branded type.\n *\n * Validates that the value is a positive finite number and returns it with the\n * `PositiveFiniteNumber` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveFiniteNumber`\n * @throws {TypeError} If the value is not a positive finite number\n */\nexport const asPositiveFiniteNumber = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveFiniteNumber`\n * branded type.\n *\n * The `PositiveFiniteNumber` type represents a positive finite number.\n */\nexport const PositiveFiniteNumber = {\n /**\n * Type guard that checks if a value is a positive finite number.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive finite number, `false` otherwise\n * @see {@link isPositiveFiniteNumber} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveFiniteNumber`.\n */\n MIN_VALUE,\n\n /**\n * Returns the smallest of the given positive finite numbers.\n *\n * @param values - The positive finite numbers to compare (at least one required)\n * @returns The smallest value as a `PositiveFiniteNumber`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive finite numbers.\n *\n * @param values - The positive finite numbers to compare (at least one required)\n * @returns The largest value as a `PositiveFiniteNumber`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `PositiveFiniteNumber` range `[MIN_VALUE,\n * MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as a `PositiveFiniteNumber`\n */\n clamp,\n\n /**\n * Returns the greatest integer less than or equal to a positive finite\n * number.\n *\n * @param a - The positive finite number value\n * @returns The floored value as an integer\n */\n floor,\n\n /**\n * Returns the smallest integer greater than or equal to a positive finite\n * number.\n *\n * @param a - The positive finite number value\n * @returns The ceiled value as an integer\n */\n ceil,\n\n /**\n * Returns the value of a positive finite number rounded to the nearest\n * integer.\n *\n * @param a - The positive finite number value\n * @returns The rounded value as an integer\n */\n round,\n\n /**\n * Generates a random `PositiveFiniteNumber` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveFiniteNumber` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The base positive finite number\n * @param b - The exponent positive finite number\n * @returns `a ** b` as a `PositiveFiniteNumber`\n */\n pow,\n\n /**\n * Adds two positive finite numbers, returning `a + b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The first positive finite number\n * @param b - The second positive finite number\n * @returns The sum of `a` and `b` as a `PositiveFiniteNumber`\n */\n add,\n\n /**\n * Subtracts two positive finite numbers, returning `a - b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The first positive finite number\n * @param b - The second positive finite number\n * @returns The difference of `a` and `b` as a `PositiveFiniteNumber`\n */\n sub,\n\n /**\n * Multiplies two positive finite numbers, returning `a * b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The first positive finite number\n * @param b - The second positive finite number\n * @returns The product of `a` and `b` as a `PositiveFiniteNumber`\n */\n mul,\n\n /**\n * Divides two positive finite numbers, returning `a / b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns `a / b` as a `PositiveFiniteNumber`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveFiniteNumber,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'positive'\n >\n>('=');\n\nexpectType<\n typeof PositiveFiniteNumber,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<ElementType, 'positive'>\n>('<=');\n"],"names":[],"mappings":";;AAYA,MAAM,iBAAA,GAAoB,0BAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,iBAAA,CAI1C;AAAA,EACA,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB;AACF,CAAU,CAAA;AAEV,MAAM,QAAQ,CACZ,CAAA;AAAA;AAAA,EAKA,IAAA,CAAK,KAAA;AAAA,IACH;AAAA;AACF,CAAA;AAIF,MAAM,OAAO,CACX,CAAA;AAAA;AAAA,EAGA,IAAA,CAAK,KAAK,CAAC;AAAA,CAAA;AAEb,MAAM,QAAQ,CACZ,CAAA;AAAA;AAAA,EAKA,IAAA,CAAK,KAAA;AAAA,IACH;AAAA;AACF,CAAA;AAyBK,MAAM,sBAAA,GAAyB;AAY/B,MAAM,sBAAA,GAAyB;AAQ/B,MAAM,oBAAA,GAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlC,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
1
+ {"version":3,"file":"positive-finite-number.mjs","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"sourcesContent":["import {\n type PositiveInt,\n type PositiveFiniteNumber as TtfImported_PositiveFiniteNumber,\n type Uint,\n} from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveFiniteNumber = TtfImported_PositiveFiniteNumber;\n\ntype ElementType = PositiveFiniteNumber;\n\nconst typeNameInMessage = 'a positive finite number';\n\nconst {\n MIN_VALUE,\n add,\n castType,\n div,\n fromNumber,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat<\n ElementType,\n number,\n number\n>({\n MIN_VALUE: Number.MIN_VALUE,\n MAX_VALUE: Number.MAX_VALUE,\n typeNameInMessage,\n} as const);\n\nconst floor = (\n x: ElementType,\n): TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.floor(\n x,\n ) as TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n >;\n\nconst ceil = (\n x: ElementType,\n): TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.ceil(x) as TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;\n\nconst round = (\n x: ElementType,\n): TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.round(\n x,\n ) as TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n >;\n\nexpectType<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>,\n PositiveInt\n>('=');\n\nexpectType<\n TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<\n TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>\n >,\n Uint\n>('=');\n\n/**\n * Type guard that checks if a value is a positive finite number.\n *\n * Returns `true` only for a finite value — never `NaN`, `Infinity`, or\n * `-Infinity`.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive finite number, `false` otherwise\n */\nexport const isPositiveFiniteNumber = is;\n\n/**\n * Casts a `number` to the `PositiveFiniteNumber` branded type.\n *\n * Validates that the value is a positive finite number and returns it with the\n * `PositiveFiniteNumber` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveFiniteNumber`\n * @throws {TypeError} If the value is not a positive finite number\n */\nexport const asPositiveFiniteNumber = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveFiniteNumber`\n * branded type.\n *\n * The `PositiveFiniteNumber` type represents a positive finite number.\n */\nexport const PositiveFiniteNumber = {\n /**\n * Type guard that checks if a value is a positive finite number.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive finite number, `false` otherwise\n * @see {@link isPositiveFiniteNumber} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveFiniteNumber` (the lower\n * saturation target of `fromNumber`). The domain is open at `0` (excluded),\n * so this is `Number.MIN_VALUE` — the smallest positive double — rather than\n * `0`.\n */\n MIN_VALUE,\n\n /**\n * Returns the smallest of the given positive finite numbers.\n *\n * @param values - The positive finite numbers to compare (at least one required)\n * @returns The smallest value as a `PositiveFiniteNumber`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive finite numbers.\n *\n * @param values - The positive finite numbers to compare (at least one required)\n * @returns The largest value as a `PositiveFiniteNumber`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into a `PositiveFiniteNumber`, saturating it\n * into the range `[MIN_VALUE, MAX_VALUE]`.\n *\n * Unlike `asPositiveFiniteNumber`, this is total: out-of-range inputs are\n * clamped to the nearest representable `PositiveFiniteNumber` instead of\n * throwing.\n *\n * @param value - The value to convert\n * @returns The value as a `PositiveFiniteNumber`\n */\n fromNumber,\n\n /**\n * Returns the greatest integer less than or equal to a positive finite\n * number.\n *\n * @param a - The positive finite number value\n * @returns The floored value as an integer\n */\n floor,\n\n /**\n * Returns the smallest integer greater than or equal to a positive finite\n * number.\n *\n * @param a - The positive finite number value\n * @returns The ceiled value as an integer\n */\n ceil,\n\n /**\n * Returns the value of a positive finite number rounded to the nearest\n * integer.\n *\n * @param a - The positive finite number value\n * @returns The rounded value as an integer\n */\n round,\n\n /**\n * Generates a random `PositiveFiniteNumber` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveFiniteNumber` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The base positive finite number\n * @param b - The exponent positive finite number\n * @returns `a ** b` as a `PositiveFiniteNumber`\n */\n pow,\n\n /**\n * Adds two positive finite numbers, returning `a + b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The first positive finite number\n * @param b - The second positive finite number\n * @returns The sum of `a` and `b` as a `PositiveFiniteNumber`\n */\n add,\n\n /**\n * Subtracts two positive finite numbers, returning `a - b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The first positive finite number\n * @param b - The second positive finite number\n * @returns The difference of `a` and `b` as a `PositiveFiniteNumber`\n */\n sub,\n\n /**\n * Multiplies two positive finite numbers, returning `a * b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The first positive finite number\n * @param b - The second positive finite number\n * @returns The product of `a` and `b` as a `PositiveFiniteNumber`\n */\n mul,\n\n /**\n * Divides two positive finite numbers, returning `a / b` as a\n * `PositiveFiniteNumber`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns `a / b` as a `PositiveFiniteNumber`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveFiniteNumber,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'positive'\n >\n>('=');\n\nexpectType<\n typeof PositiveFiniteNumber,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<ElementType, 'positive'>\n>('<=');\n"],"names":[],"mappings":";;AAYA,MAAM,iBAAA,GAAoB,0BAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA,UAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,iBAAA,CAI1C;AAAA,EACA,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB;AACF,CAAU,CAAA;AAEV,MAAM,QAAQ,CACZ,CAAA;AAAA;AAAA,EAKA,IAAA,CAAK,KAAA;AAAA,IACH;AAAA;AACF,CAAA;AAIF,MAAM,OAAO,CACX,CAAA;AAAA;AAAA,EAGA,IAAA,CAAK,KAAK,CAAC;AAAA,CAAA;AAEb,MAAM,QAAQ,CACZ,CAAA;AAAA;AAAA,EAKA,IAAA,CAAK,KAAA;AAAA,IACH;AAAA;AACF,CAAA;AAyBK,MAAM,sBAAA,GAAyB;AAY/B,MAAM,sBAAA,GAAyB;AAQ/B,MAAM,oBAAA,GAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlC,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaL,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
@@ -84,7 +84,8 @@ export declare const PositiveInt: {
84
84
  */
85
85
  readonly is: (a: number) => a is TtfImported_PositiveInt;
86
86
  /**
87
- * The smallest value representable as `PositiveInt`.
87
+ * The smallest value representable as `PositiveInt` (the lower saturation
88
+ * target of `fromNumber`).
88
89
  */
89
90
  readonly MIN_VALUE: 1;
90
91
  /**
@@ -126,25 +127,29 @@ export declare const PositiveInt: {
126
127
  */
127
128
  readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_PositiveInt>[]) => TtfImported_PositiveInt;
128
129
  /**
129
- * Clamps a `number` into the `PositiveInt` range, rounding to the nearest
130
- * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
130
+ * Converts an arbitrary `number` into a `PositiveInt`, rounding to the
131
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
132
+ * MAX_VALUE]`.
133
+ *
134
+ * Unlike `asPositiveInt`, this is total: out-of-range inputs are clamped to
135
+ * the nearest representable `PositiveInt` instead of throwing.
131
136
  *
132
137
  * @example
133
138
  *
134
139
  * ```ts
135
- * const belowRange = PositiveInt.clamp(0);
140
+ * const belowRange = PositiveInt.fromNumber(0);
136
141
  *
137
- * const withinRange = PositiveInt.clamp(10);
142
+ * const withinRange = PositiveInt.fromNumber(10);
138
143
  *
139
144
  * assert.isTrue(belowRange === 1);
140
145
  *
141
146
  * assert.isTrue(withinRange === 10);
142
147
  * ```
143
148
  *
144
- * @param value - The value to clamp
145
- * @returns The clamped value as a `PositiveInt`
149
+ * @param value - The value to convert
150
+ * @returns The value as a `PositiveInt`
146
151
  */
147
- readonly clamp: (x: number) => TtfImported_PositiveInt;
152
+ readonly fromNumber: (x: number) => TtfImported_PositiveInt;
148
153
  /**
149
154
  * Generates a random `PositiveInt` within the given range.
150
155
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,IAAI,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAI5E,MAAM,MAAM,WAAW,GAAG,uBAAuB,CAAC;AA8BlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,6CAAK,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;MAAW,CAAC;AAEtC;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW;IACtB;;;;;;;;;;;;;;;;OAgBG;;IAGH;;OAEG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,IAAI,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAI5E,MAAM,MAAM,WAAW,GAAG,uBAAuB,CAAC;AA8BlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,6CAAK,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;MAAW,CAAC;AAEtC;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW;IACtB;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;OAGG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;;;;;;;;;;;;;;CAEK,CAAC"}
@@ -5,8 +5,8 @@ const {
5
5
  MIN_VALUE,
6
6
  add,
7
7
  castType,
8
- clamp,
9
8
  div,
9
+ fromNumber,
10
10
  is,
11
11
  max: max_,
12
12
  min: min_,
@@ -42,7 +42,8 @@ const PositiveInt = {
42
42
  */
43
43
  is,
44
44
  /**
45
- * The smallest value representable as `PositiveInt`.
45
+ * The smallest value representable as `PositiveInt` (the lower saturation
46
+ * target of `fromNumber`).
46
47
  */
47
48
  MIN_VALUE,
48
49
  /**
@@ -84,25 +85,29 @@ const PositiveInt = {
84
85
  */
85
86
  max: max_,
86
87
  /**
87
- * Clamps a `number` into the `PositiveInt` range, rounding to the nearest
88
- * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
88
+ * Converts an arbitrary `number` into a `PositiveInt`, rounding to the
89
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
90
+ * MAX_VALUE]`.
91
+ *
92
+ * Unlike `asPositiveInt`, this is total: out-of-range inputs are clamped to
93
+ * the nearest representable `PositiveInt` instead of throwing.
89
94
  *
90
95
  * @example
91
96
  *
92
97
  * ```ts
93
- * const belowRange = PositiveInt.clamp(0);
98
+ * const belowRange = PositiveInt.fromNumber(0);
94
99
  *
95
- * const withinRange = PositiveInt.clamp(10);
100
+ * const withinRange = PositiveInt.fromNumber(10);
96
101
  *
97
102
  * assert.isTrue(belowRange === 1);
98
103
  *
99
104
  * assert.isTrue(withinRange === 10);
100
105
  * ```
101
106
  *
102
- * @param value - The value to clamp
103
- * @returns The clamped value as a `PositiveInt`
107
+ * @param value - The value to convert
108
+ * @returns The value as a `PositiveInt`
104
109
  */
105
- clamp,
110
+ fromNumber,
106
111
  /**
107
112
  * Generates a random `PositiveInt` within the given range.
108
113
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int.mjs","sources":["../../../src/number/branded-types/positive-int.mts"],"sourcesContent":["import { type PositiveInt as TtfImported_PositiveInt } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt = TtfImported_PositiveInt;\n\ntype ElementType = PositiveInt;\n\nconst typeNameInMessage = 'a positive integer';\n\nconst {\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'Integer',\n MIN_VALUE: 1,\n MAX_VALUE: Number.MAX_VALUE,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a positive integer.\n *\n * Returns `true` for a positive integer — a value with no fractional component,\n * including values outside the safe integer range (unlike `SafeInt`).\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isPositiveInt(5));\n *\n * assert.isFalse(isPositiveInt(0));\n *\n * assert.isTrue(PositiveInt.is(10));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer, `false` otherwise\n */\nexport const isPositiveInt = is;\n\n/**\n * Casts a `number` to the `PositiveInt` branded type.\n *\n * Validates that the value is a positive integer and returns it with the\n * `PositiveInt` brand. Throws a `TypeError` otherwise.\n *\n * @example\n *\n * ```ts\n * const branded = asPositiveInt(7);\n *\n * assert.isTrue(branded === 7);\n *\n * assert.isTrue(PositiveInt.is(branded));\n * ```\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveInt`\n * @throws {TypeError} If the value is not a positive integer\n */\nexport const asPositiveInt = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveInt` branded type.\n *\n * The `PositiveInt` type represents a positive integer. Division (`div`) uses\n * floor division.\n *\n * Unlike `SafeInt`, `PositiveInt` allows values outside the safe integer range\n * (±2^53 − 1), so very large magnitudes may lose precision in JavaScript's\n * `number` type.\n */\nexport const PositiveInt = {\n /**\n * Type guard that checks if a value is a positive integer.\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isPositiveInt(5));\n *\n * assert.isFalse(isPositiveInt(0));\n *\n * assert.isTrue(PositiveInt.is(10));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer, `false` otherwise\n * @see {@link isPositiveInt} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveInt`.\n */\n MIN_VALUE,\n\n /**\n * Returns the smallest of the given positive integers.\n *\n * @example\n *\n * ```ts\n * const smallest = PositiveInt.min(\n * asPositiveInt(9),\n * asPositiveInt(3),\n * asPositiveInt(12),\n * );\n *\n * assert.isTrue(smallest === 3);\n * ```\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The smallest value as a `PositiveInt`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive integers.\n *\n * @example\n *\n * ```ts\n * const largest = PositiveInt.max(\n * asPositiveInt(9),\n * asPositiveInt(3),\n * asPositiveInt(12),\n * );\n *\n * assert.isTrue(largest === 12);\n * ```\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The largest value as a `PositiveInt`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `PositiveInt` range, rounding to the nearest\n * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @example\n *\n * ```ts\n * const belowRange = PositiveInt.clamp(0);\n *\n * const withinRange = PositiveInt.clamp(10);\n *\n * assert.isTrue(belowRange === 1);\n *\n * assert.isTrue(withinRange === 10);\n * ```\n *\n * @param value - The value to clamp\n * @returns The clamped value as a `PositiveInt`\n */\n clamp,\n\n /**\n * Generates a random `PositiveInt` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @example\n *\n * ```ts\n * const min = asPositiveInt(3);\n *\n * const max = asPositiveInt(6);\n *\n * const randomValue = PositiveInt.random(min, max);\n *\n * assert.isTrue(PositiveInt.is(randomValue));\n *\n * assert.isTrue(randomValue >= 3 && randomValue <= 6);\n * ```\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveInt` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a `PositiveInt` (floored\n * to an integer).\n *\n * @example\n *\n * ```ts\n * const base = asPositiveInt(2);\n *\n * const exponent = asPositiveInt(4);\n *\n * const power = PositiveInt.pow(base, exponent);\n *\n * assert.isTrue(power === 16);\n * ```\n *\n * @param a - The base positive integer\n * @param b - The exponent positive integer\n * @returns `a ** b` as a `PositiveInt`\n */\n pow,\n\n /**\n * Adds two positive integers, returning `a + b` as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const sum = PositiveInt.add(asPositiveInt(4), asPositiveInt(5));\n *\n * assert.isTrue(sum === 9);\n * ```\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The sum of `a` and `b` as a `PositiveInt`\n */\n add,\n\n /**\n * Subtracts two positive integers, returning `a - b` as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const difference = PositiveInt.sub(asPositiveInt(5), asPositiveInt(7));\n *\n * assert.isTrue(difference === 1);\n * ```\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The difference of `a` and `b` as a `PositiveInt`\n */\n sub,\n\n /**\n * Multiplies two positive integers, returning `a * b` as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const product = PositiveInt.mul(asPositiveInt(3), asPositiveInt(7));\n *\n * assert.isTrue(product === 21);\n * ```\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The product of `a` and `b` as a `PositiveInt`\n */\n mul,\n\n /**\n * Divides two positive integers using floor division (`⌊a / b⌋`): the result\n * is `a / b` rounded toward negative infinity, as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const quotient = PositiveInt.div(asPositiveInt(9), asPositiveInt(2));\n *\n * const clamped = PositiveInt.div(asPositiveInt(3), asPositiveInt(10));\n *\n * assert.isTrue(quotient === 4);\n *\n * assert.isTrue(clamped === 1);\n * ```\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as a `PositiveInt`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,oBAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,SAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB;AACF,CAAU,CAAA;AAqBH,MAAM,aAAA,GAAgB;AAsBtB,MAAM,aAAA,GAAgB;AAYtB,MAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBzB,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA;AACF;;;;"}
1
+ {"version":3,"file":"positive-int.mjs","sources":["../../../src/number/branded-types/positive-int.mts"],"sourcesContent":["import { type PositiveInt as TtfImported_PositiveInt } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt = TtfImported_PositiveInt;\n\ntype ElementType = PositiveInt;\n\nconst typeNameInMessage = 'a positive integer';\n\nconst {\n MIN_VALUE,\n add,\n castType,\n div,\n fromNumber,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'Integer',\n MIN_VALUE: 1,\n MAX_VALUE: Number.MAX_VALUE,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a positive integer.\n *\n * Returns `true` for a positive integer — a value with no fractional component,\n * including values outside the safe integer range (unlike `SafeInt`).\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isPositiveInt(5));\n *\n * assert.isFalse(isPositiveInt(0));\n *\n * assert.isTrue(PositiveInt.is(10));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer, `false` otherwise\n */\nexport const isPositiveInt = is;\n\n/**\n * Casts a `number` to the `PositiveInt` branded type.\n *\n * Validates that the value is a positive integer and returns it with the\n * `PositiveInt` brand. Throws a `TypeError` otherwise.\n *\n * @example\n *\n * ```ts\n * const branded = asPositiveInt(7);\n *\n * assert.isTrue(branded === 7);\n *\n * assert.isTrue(PositiveInt.is(branded));\n * ```\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveInt`\n * @throws {TypeError} If the value is not a positive integer\n */\nexport const asPositiveInt = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveInt` branded type.\n *\n * The `PositiveInt` type represents a positive integer. Division (`div`) uses\n * floor division.\n *\n * Unlike `SafeInt`, `PositiveInt` allows values outside the safe integer range\n * (±2^53 − 1), so very large magnitudes may lose precision in JavaScript's\n * `number` type.\n */\nexport const PositiveInt = {\n /**\n * Type guard that checks if a value is a positive integer.\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isPositiveInt(5));\n *\n * assert.isFalse(isPositiveInt(0));\n *\n * assert.isTrue(PositiveInt.is(10));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer, `false` otherwise\n * @see {@link isPositiveInt} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveInt` (the lower saturation\n * target of `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * Returns the smallest of the given positive integers.\n *\n * @example\n *\n * ```ts\n * const smallest = PositiveInt.min(\n * asPositiveInt(9),\n * asPositiveInt(3),\n * asPositiveInt(12),\n * );\n *\n * assert.isTrue(smallest === 3);\n * ```\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The smallest value as a `PositiveInt`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive integers.\n *\n * @example\n *\n * ```ts\n * const largest = PositiveInt.max(\n * asPositiveInt(9),\n * asPositiveInt(3),\n * asPositiveInt(12),\n * );\n *\n * assert.isTrue(largest === 12);\n * ```\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The largest value as a `PositiveInt`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into a `PositiveInt`, rounding to the\n * nearest integer and saturating the result into the range `[MIN_VALUE,\n * MAX_VALUE]`.\n *\n * Unlike `asPositiveInt`, this is total: out-of-range inputs are clamped to\n * the nearest representable `PositiveInt` instead of throwing.\n *\n * @example\n *\n * ```ts\n * const belowRange = PositiveInt.fromNumber(0);\n *\n * const withinRange = PositiveInt.fromNumber(10);\n *\n * assert.isTrue(belowRange === 1);\n *\n * assert.isTrue(withinRange === 10);\n * ```\n *\n * @param value - The value to convert\n * @returns The value as a `PositiveInt`\n */\n fromNumber,\n\n /**\n * Generates a random `PositiveInt` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @example\n *\n * ```ts\n * const min = asPositiveInt(3);\n *\n * const max = asPositiveInt(6);\n *\n * const randomValue = PositiveInt.random(min, max);\n *\n * assert.isTrue(PositiveInt.is(randomValue));\n *\n * assert.isTrue(randomValue >= 3 && randomValue <= 6);\n * ```\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveInt` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a `PositiveInt` (floored\n * to an integer).\n *\n * @example\n *\n * ```ts\n * const base = asPositiveInt(2);\n *\n * const exponent = asPositiveInt(4);\n *\n * const power = PositiveInt.pow(base, exponent);\n *\n * assert.isTrue(power === 16);\n * ```\n *\n * @param a - The base positive integer\n * @param b - The exponent positive integer\n * @returns `a ** b` as a `PositiveInt`\n */\n pow,\n\n /**\n * Adds two positive integers, returning `a + b` as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const sum = PositiveInt.add(asPositiveInt(4), asPositiveInt(5));\n *\n * assert.isTrue(sum === 9);\n * ```\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The sum of `a` and `b` as a `PositiveInt`\n */\n add,\n\n /**\n * Subtracts two positive integers, returning `a - b` as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const difference = PositiveInt.sub(asPositiveInt(5), asPositiveInt(7));\n *\n * assert.isTrue(difference === 1);\n * ```\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The difference of `a` and `b` as a `PositiveInt`\n */\n sub,\n\n /**\n * Multiplies two positive integers, returning `a * b` as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const product = PositiveInt.mul(asPositiveInt(3), asPositiveInt(7));\n *\n * assert.isTrue(product === 21);\n * ```\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The product of `a` and `b` as a `PositiveInt`\n */\n mul,\n\n /**\n * Divides two positive integers using floor division (`⌊a / b⌋`): the result\n * is `a / b` rounded toward negative infinity, as a `PositiveInt`.\n *\n * @example\n *\n * ```ts\n * const quotient = PositiveInt.div(asPositiveInt(9), asPositiveInt(2));\n *\n * const clamped = PositiveInt.div(asPositiveInt(3), asPositiveInt(10));\n *\n * assert.isTrue(quotient === 4);\n *\n * assert.isTrue(clamped === 1);\n * ```\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as a `PositiveInt`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,oBAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA,UAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,SAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB;AACF,CAAU,CAAA;AAqBH,MAAM,aAAA,GAAgB;AAsBtB,MAAM,aAAA,GAAgB;AAYtB,MAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBzB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBL,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA;AACF;;;;"}
@@ -56,11 +56,13 @@ export declare const PositiveInt16: {
56
56
  */
57
57
  readonly is: (a: number) => a is TtfImported_PositiveInt16;
58
58
  /**
59
- * The smallest value representable as `PositiveInt16`.
59
+ * The smallest value representable as `PositiveInt16` (the lower saturation
60
+ * target of `fromNumber`).
60
61
  */
61
62
  readonly MIN_VALUE: 1;
62
63
  /**
63
- * The largest value representable as `PositiveInt16`.
64
+ * The largest value representable as `PositiveInt16` (the upper saturation
65
+ * target of `fromNumber`).
64
66
  */
65
67
  readonly MAX_VALUE: number;
66
68
  /**
@@ -78,13 +80,17 @@ export declare const PositiveInt16: {
78
80
  */
79
81
  readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_PositiveInt16>[]) => TtfImported_PositiveInt16;
80
82
  /**
81
- * Clamps a `number` into the `PositiveInt16` range, rounding to the nearest
82
- * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
83
+ * Converts an arbitrary `number` into a `PositiveInt16`, rounding to the
84
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
85
+ * MAX_VALUE]`.
83
86
  *
84
- * @param value - The value to clamp
85
- * @returns The clamped value as a `PositiveInt16`
87
+ * Unlike `asPositiveInt16`, this is total: out-of-range inputs are clamped to
88
+ * the nearest representable `PositiveInt16` instead of throwing.
89
+ *
90
+ * @param value - The value to convert
91
+ * @returns The value as a `PositiveInt16`
86
92
  */
87
- readonly clamp: (x: number) => TtfImported_PositiveInt16;
93
+ readonly fromNumber: (x: number) => TtfImported_PositiveInt16;
88
94
  /**
89
95
  * Generates a random `PositiveInt16` within the given range.
90
96
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int16.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAIhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AA+BtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,+CAAK,CAAC;AAElC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;MAAW,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;IACxB;;;;;;OAMG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"positive-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int16.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAIhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AA+BtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,+CAAK,CAAC;AAElC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;MAAW,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;IACxB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;CAEK,CAAC"}
@@ -6,8 +6,8 @@ const {
6
6
  MIN_VALUE,
7
7
  add,
8
8
  castType,
9
- clamp,
10
9
  div,
10
+ fromNumber,
11
11
  is,
12
12
  max: max_,
13
13
  min: min_,
@@ -33,11 +33,13 @@ const PositiveInt16 = {
33
33
  */
34
34
  is,
35
35
  /**
36
- * The smallest value representable as `PositiveInt16`.
36
+ * The smallest value representable as `PositiveInt16` (the lower saturation
37
+ * target of `fromNumber`).
37
38
  */
38
39
  MIN_VALUE,
39
40
  /**
40
- * The largest value representable as `PositiveInt16`.
41
+ * The largest value representable as `PositiveInt16` (the upper saturation
42
+ * target of `fromNumber`).
41
43
  */
42
44
  MAX_VALUE,
43
45
  /**
@@ -55,13 +57,17 @@ const PositiveInt16 = {
55
57
  */
56
58
  max: max_,
57
59
  /**
58
- * Clamps a `number` into the `PositiveInt16` range, rounding to the nearest
59
- * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
60
+ * Converts an arbitrary `number` into a `PositiveInt16`, rounding to the
61
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
62
+ * MAX_VALUE]`.
60
63
  *
61
- * @param value - The value to clamp
62
- * @returns The clamped value as a `PositiveInt16`
64
+ * Unlike `asPositiveInt16`, this is total: out-of-range inputs are clamped to
65
+ * the nearest representable `PositiveInt16` instead of throwing.
66
+ *
67
+ * @param value - The value to convert
68
+ * @returns The value as a `PositiveInt16`
63
69
  */
64
- clamp,
70
+ fromNumber,
65
71
  /**
66
72
  * Generates a random `PositiveInt16` within the given range.
67
73
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int16.mjs","sources":["../../../src/number/branded-types/positive-int16.mts"],"sourcesContent":["import { type PositiveInt16 as TtfImported_PositiveInt16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt16 = TtfImported_PositiveInt16;\n\ntype ElementType = PositiveInt16;\n\nconst typeNameInMessage = 'a positive integer in [1, 2^15)';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 1,\n MAX_VALUE: 2 ** 15 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a positive integer in [1, 2^15).\n *\n * Returns `true` for a positive integer in [1, 2^15) — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^15), `false` otherwise\n */\nexport const isPositiveInt16 = is;\n\n/**\n * Casts a `number` to the `PositiveInt16` branded type.\n *\n * Validates that the value is a positive integer in [1, 2^15) and returns it\n * with the `PositiveInt16` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveInt16`\n * @throws {TypeError} If the value is not a positive integer in [1, 2^15)\n */\nexport const asPositiveInt16 = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveInt16` branded\n * type.\n *\n * The `PositiveInt16` type represents a positive integer in [1, 2^15). Division\n * (`div`) uses floor division.\n */\nexport const PositiveInt16 = {\n /**\n * Type guard that checks if a value is a positive integer in [1, 2^15).\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^15), `false` otherwise\n * @see {@link isPositiveInt16} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveInt16`.\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `PositiveInt16`.\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The smallest value as a `PositiveInt16`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The largest value as a `PositiveInt16`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `PositiveInt16` range, rounding to the nearest\n * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as a `PositiveInt16`\n */\n clamp,\n\n /**\n * Generates a random `PositiveInt16` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveInt16` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a `PositiveInt16`\n * (floored to an integer).\n *\n * @param a - The base positive integer\n * @param b - The exponent positive integer\n * @returns `a ** b` as a `PositiveInt16`\n */\n pow,\n\n /**\n * Adds two positive integers, returning `a + b` as a `PositiveInt16`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The sum of `a` and `b` as a `PositiveInt16`\n */\n add,\n\n /**\n * Subtracts two positive integers, returning `a - b` as a `PositiveInt16`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The difference of `a` and `b` as a `PositiveInt16`\n */\n sub,\n\n /**\n * Multiplies two positive integers, returning `a * b` as a `PositiveInt16`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The product of `a` and `b` as a `PositiveInt16`\n */\n mul,\n\n /**\n * Divides two positive integers using floor division (`⌊a / b⌋`): the result\n * is `a / b` rounded toward negative infinity, as a `PositiveInt16`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as a `PositiveInt16`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt16,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt16,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,iCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,EAAW,KAAK,EAAA,GAAK,CAAA;AAAA,EACrB;AACF,CAAU,CAAA;AAWH,MAAM,eAAA,GAAkB;AAYxB,MAAM,eAAA,GAAkB;AASxB,MAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3B,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
1
+ {"version":3,"file":"positive-int16.mjs","sources":["../../../src/number/branded-types/positive-int16.mts"],"sourcesContent":["import { type PositiveInt16 as TtfImported_PositiveInt16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt16 = TtfImported_PositiveInt16;\n\ntype ElementType = PositiveInt16;\n\nconst typeNameInMessage = 'a positive integer in [1, 2^15)';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n div,\n fromNumber,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 1,\n MAX_VALUE: 2 ** 15 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a positive integer in [1, 2^15).\n *\n * Returns `true` for a positive integer in [1, 2^15) — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^15), `false` otherwise\n */\nexport const isPositiveInt16 = is;\n\n/**\n * Casts a `number` to the `PositiveInt16` branded type.\n *\n * Validates that the value is a positive integer in [1, 2^15) and returns it\n * with the `PositiveInt16` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveInt16`\n * @throws {TypeError} If the value is not a positive integer in [1, 2^15)\n */\nexport const asPositiveInt16 = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveInt16` branded\n * type.\n *\n * The `PositiveInt16` type represents a positive integer in [1, 2^15). Division\n * (`div`) uses floor division.\n */\nexport const PositiveInt16 = {\n /**\n * Type guard that checks if a value is a positive integer in [1, 2^15).\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^15), `false` otherwise\n * @see {@link isPositiveInt16} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveInt16` (the lower saturation\n * target of `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `PositiveInt16` (the upper saturation\n * target of `fromNumber`).\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The smallest value as a `PositiveInt16`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The largest value as a `PositiveInt16`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into a `PositiveInt16`, rounding to the\n * nearest integer and saturating the result into the range `[MIN_VALUE,\n * MAX_VALUE]`.\n *\n * Unlike `asPositiveInt16`, this is total: out-of-range inputs are clamped to\n * the nearest representable `PositiveInt16` instead of throwing.\n *\n * @param value - The value to convert\n * @returns The value as a `PositiveInt16`\n */\n fromNumber,\n\n /**\n * Generates a random `PositiveInt16` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveInt16` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a `PositiveInt16`\n * (floored to an integer).\n *\n * @param a - The base positive integer\n * @param b - The exponent positive integer\n * @returns `a ** b` as a `PositiveInt16`\n */\n pow,\n\n /**\n * Adds two positive integers, returning `a + b` as a `PositiveInt16`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The sum of `a` and `b` as a `PositiveInt16`\n */\n add,\n\n /**\n * Subtracts two positive integers, returning `a - b` as a `PositiveInt16`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The difference of `a` and `b` as a `PositiveInt16`\n */\n sub,\n\n /**\n * Multiplies two positive integers, returning `a * b` as a `PositiveInt16`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The product of `a` and `b` as a `PositiveInt16`\n */\n mul,\n\n /**\n * Divides two positive integers using floor division (`⌊a / b⌋`): the result\n * is `a / b` rounded toward negative infinity, as a `PositiveInt16`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as a `PositiveInt16`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt16,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt16,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,iCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA,UAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,EAAW,KAAK,EAAA,GAAK,CAAA;AAAA,EACrB;AACF,CAAU,CAAA;AAWH,MAAM,eAAA,GAAkB;AAYxB,MAAM,eAAA,GAAkB;AASxB,MAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3B,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaL,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
@@ -54,11 +54,13 @@ export declare const PositiveInt32: {
54
54
  */
55
55
  readonly is: (a: number) => a is TtfImported_PositiveInt32;
56
56
  /**
57
- * The smallest value representable as `PositiveInt32`.
57
+ * The smallest value representable as `PositiveInt32` (the lower saturation
58
+ * target of `fromNumber`).
58
59
  */
59
60
  readonly MIN_VALUE: 1;
60
61
  /**
61
- * The largest value representable as `PositiveInt32`.
62
+ * The largest value representable as `PositiveInt32` (the upper saturation
63
+ * target of `fromNumber`).
62
64
  */
63
65
  readonly MAX_VALUE: number;
64
66
  /**
@@ -76,13 +78,17 @@ export declare const PositiveInt32: {
76
78
  */
77
79
  readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_PositiveInt32>[]) => TtfImported_PositiveInt32;
78
80
  /**
79
- * Clamps a `number` into the `PositiveInt32` range, rounding to the nearest
80
- * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
81
+ * Converts an arbitrary `number` into a `PositiveInt32`, rounding to the
82
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
83
+ * MAX_VALUE]`.
81
84
  *
82
- * @param value - The value to clamp
83
- * @returns The clamped value as a `PositiveInt32`
85
+ * Unlike `asPositiveInt32`, this is total: out-of-range inputs are clamped to
86
+ * the nearest representable `PositiveInt32` instead of throwing.
87
+ *
88
+ * @param value - The value to convert
89
+ * @returns The value as a `PositiveInt32`
84
90
  */
85
- readonly clamp: (x: number) => TtfImported_PositiveInt32;
91
+ readonly fromNumber: (x: number) => TtfImported_PositiveInt32;
86
92
  /**
87
93
  * Generates a random `PositiveInt32` within the given range.
88
94
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int32.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAIhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AA+BtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,+CAAK,CAAC;AAElC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;MAAW,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;IACxB;;;;;;OAMG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"positive-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int32.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAIhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AA+BtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,+CAAK,CAAC;AAElC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;MAAW,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;IACxB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;CAEK,CAAC"}
@@ -6,8 +6,8 @@ const {
6
6
  MIN_VALUE,
7
7
  add,
8
8
  castType,
9
- clamp,
10
9
  div,
10
+ fromNumber,
11
11
  is,
12
12
  max: max_,
13
13
  min: min_,
@@ -33,11 +33,13 @@ const PositiveInt32 = {
33
33
  */
34
34
  is,
35
35
  /**
36
- * The smallest value representable as `PositiveInt32`.
36
+ * The smallest value representable as `PositiveInt32` (the lower saturation
37
+ * target of `fromNumber`).
37
38
  */
38
39
  MIN_VALUE,
39
40
  /**
40
- * The largest value representable as `PositiveInt32`.
41
+ * The largest value representable as `PositiveInt32` (the upper saturation
42
+ * target of `fromNumber`).
41
43
  */
42
44
  MAX_VALUE,
43
45
  /**
@@ -55,13 +57,17 @@ const PositiveInt32 = {
55
57
  */
56
58
  max: max_,
57
59
  /**
58
- * Clamps a `number` into the `PositiveInt32` range, rounding to the nearest
59
- * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
60
+ * Converts an arbitrary `number` into a `PositiveInt32`, rounding to the
61
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
62
+ * MAX_VALUE]`.
60
63
  *
61
- * @param value - The value to clamp
62
- * @returns The clamped value as a `PositiveInt32`
64
+ * Unlike `asPositiveInt32`, this is total: out-of-range inputs are clamped to
65
+ * the nearest representable `PositiveInt32` instead of throwing.
66
+ *
67
+ * @param value - The value to convert
68
+ * @returns The value as a `PositiveInt32`
63
69
  */
64
- clamp,
70
+ fromNumber,
65
71
  /**
66
72
  * Generates a random `PositiveInt32` within the given range.
67
73
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int32.mjs","sources":["../../../src/number/branded-types/positive-int32.mts"],"sourcesContent":["import { type PositiveInt32 as TtfImported_PositiveInt32 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt32 = TtfImported_PositiveInt32;\n\ntype ElementType = PositiveInt32;\n\nconst typeNameInMessage = 'a positive integer in [1, 2^31)';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 1,\n MAX_VALUE: 2 ** 31 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a positive integer in [1, 2^31).\n *\n * Returns `true` for a positive integer in [1, 2^31) — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^31), `false` otherwise\n */\nexport const isPositiveInt32 = is;\n\n/**\n * Casts a `number` to the `PositiveInt32` branded type.\n *\n * Validates that the value is a positive integer in [1, 2^31) and returns it\n * with the `PositiveInt32` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveInt32`\n * @throws {TypeError} If the value is not a positive integer in [1, 2^31)\n */\nexport const asPositiveInt32 = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveInt32` branded\n * type.\n *\n * The `PositiveInt32` type represents a positive integer in [1, 2^31). Division\n * (`div`) uses floor division.\n */\nexport const PositiveInt32 = {\n /**\n * Type guard that checks if a value is a positive integer in [1, 2^31).\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^31), `false` otherwise\n * @see {@link isPositiveInt32} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveInt32`.\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `PositiveInt32`.\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The smallest value as a `PositiveInt32`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The largest value as a `PositiveInt32`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `PositiveInt32` range, rounding to the nearest\n * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as a `PositiveInt32`\n */\n clamp,\n\n /**\n * Generates a random `PositiveInt32` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveInt32` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a `PositiveInt32`\n * (floored to an integer).\n *\n * @param a - The base positive integer\n * @param b - The exponent positive integer\n * @returns `a ** b` as a `PositiveInt32`\n */\n pow,\n\n /**\n * Adds two positive integers, returning `a + b` as a `PositiveInt32`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The sum of `a` and `b` as a `PositiveInt32`\n */\n add,\n\n /**\n * Subtracts two positive integers, returning `a - b` as a `PositiveInt32`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The difference of `a` and `b` as a `PositiveInt32`\n */\n sub,\n\n /**\n * Multiplies two positive integers, returning `a * b` as a `PositiveInt32`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The product of `a` and `b` as a `PositiveInt32`\n */\n mul,\n\n /**\n * Divides two positive integers using floor division (`⌊a / b⌋`): the result\n * is `a / b` rounded toward negative infinity, as a `PositiveInt32`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as a `PositiveInt32`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt32,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt32,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,iCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,EAAW,KAAK,EAAA,GAAK,CAAA;AAAA,EACrB;AACF,CAAU,CAAA;AAWH,MAAM,eAAA,GAAkB;AAYxB,MAAM,eAAA,GAAkB;AASxB,MAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3B,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
1
+ {"version":3,"file":"positive-int32.mjs","sources":["../../../src/number/branded-types/positive-int32.mts"],"sourcesContent":["import { type PositiveInt32 as TtfImported_PositiveInt32 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt32 = TtfImported_PositiveInt32;\n\ntype ElementType = PositiveInt32;\n\nconst typeNameInMessage = 'a positive integer in [1, 2^31)';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n div,\n fromNumber,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 1,\n MAX_VALUE: 2 ** 31 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a positive integer in [1, 2^31).\n *\n * Returns `true` for a positive integer in [1, 2^31) — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^31), `false` otherwise\n */\nexport const isPositiveInt32 = is;\n\n/**\n * Casts a `number` to the `PositiveInt32` branded type.\n *\n * Validates that the value is a positive integer in [1, 2^31) and returns it\n * with the `PositiveInt32` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as a `PositiveInt32`\n * @throws {TypeError} If the value is not a positive integer in [1, 2^31)\n */\nexport const asPositiveInt32 = castType;\n\n/**\n * Namespace providing type-safe operations for the `PositiveInt32` branded\n * type.\n *\n * The `PositiveInt32` type represents a positive integer in [1, 2^31). Division\n * (`div`) uses floor division.\n */\nexport const PositiveInt32 = {\n /**\n * Type guard that checks if a value is a positive integer in [1, 2^31).\n *\n * @param value - The value to check\n * @returns `true` if the value is a positive integer in [1, 2^31), `false` otherwise\n * @see {@link isPositiveInt32} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `PositiveInt32` (the lower saturation\n * target of `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `PositiveInt32` (the upper saturation\n * target of `fromNumber`).\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The smallest value as a `PositiveInt32`\n */\n min: min_,\n\n /**\n * Returns the largest of the given positive integers.\n *\n * @param values - The positive integers to compare (at least one required)\n * @returns The largest value as a `PositiveInt32`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into a `PositiveInt32`, rounding to the\n * nearest integer and saturating the result into the range `[MIN_VALUE,\n * MAX_VALUE]`.\n *\n * Unlike `asPositiveInt32`, this is total: out-of-range inputs are clamped to\n * the nearest representable `PositiveInt32` instead of throwing.\n *\n * @param value - The value to convert\n * @returns The value as a `PositiveInt32`\n */\n fromNumber,\n\n /**\n * Generates a random `PositiveInt32` within the given range.\n *\n * The range is inclusive on both ends.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random `PositiveInt32` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as a `PositiveInt32`\n * (floored to an integer).\n *\n * @param a - The base positive integer\n * @param b - The exponent positive integer\n * @returns `a ** b` as a `PositiveInt32`\n */\n pow,\n\n /**\n * Adds two positive integers, returning `a + b` as a `PositiveInt32`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The sum of `a` and `b` as a `PositiveInt32`\n */\n add,\n\n /**\n * Subtracts two positive integers, returning `a - b` as a `PositiveInt32`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The difference of `a` and `b` as a `PositiveInt32`\n */\n sub,\n\n /**\n * Multiplies two positive integers, returning `a * b` as a `PositiveInt32`.\n *\n * @param a - The first positive integer\n * @param b - The second positive integer\n * @returns The product of `a` and `b` as a `PositiveInt32`\n */\n mul,\n\n /**\n * Divides two positive integers using floor division (`⌊a / b⌋`): the result\n * is `a / b` rounded toward negative infinity, as a `PositiveInt32`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as a `PositiveInt32`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt32,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt32,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,iCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA,UAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,EAAW,KAAK,EAAA,GAAK,CAAA;AAAA,EACrB;AACF,CAAU,CAAA;AAWH,MAAM,eAAA,GAAkB;AAYxB,MAAM,eAAA,GAAkB;AASxB,MAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3B,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaL,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
@@ -86,11 +86,13 @@ export declare const PositiveSafeInt: {
86
86
  */
87
87
  readonly is: (a: number) => a is TtfImported_PositiveSafeInt;
88
88
  /**
89
- * The smallest value representable as `PositiveSafeInt`.
89
+ * The smallest value representable as `PositiveSafeInt` (the lower saturation
90
+ * target of `fromNumber`).
90
91
  */
91
92
  readonly MIN_VALUE: 1;
92
93
  /**
93
- * The largest value representable as `PositiveSafeInt`.
94
+ * The largest value representable as `PositiveSafeInt` (the upper saturation
95
+ * target of `fromNumber`).
94
96
  */
95
97
  readonly MAX_VALUE: SafeUint;
96
98
  /**
@@ -130,17 +132,21 @@ export declare const PositiveSafeInt: {
130
132
  */
131
133
  readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_PositiveSafeInt>[]) => TtfImported_PositiveSafeInt;
132
134
  /**
133
- * Clamps a `number` into the `PositiveSafeInt` range, rounding to the nearest
134
- * integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
135
+ * Converts an arbitrary `number` into a `PositiveSafeInt`, rounding to the
136
+ * nearest integer and saturating the result into the range `[MIN_VALUE,
137
+ * MAX_VALUE]`.
138
+ *
139
+ * Unlike `asPositiveSafeInt`, this is total: out-of-range inputs are clamped
140
+ * to the nearest representable `PositiveSafeInt` instead of throwing.
135
141
  *
136
142
  * @example
137
143
  *
138
144
  * ```ts
139
- * const belowRange = PositiveSafeInt.clamp(0);
145
+ * const belowRange = PositiveSafeInt.fromNumber(0);
140
146
  *
141
- * const withinRange = PositiveSafeInt.clamp(123);
147
+ * const withinRange = PositiveSafeInt.fromNumber(123);
142
148
  *
143
- * const aboveRange = PositiveSafeInt.clamp(Number.MAX_SAFE_INTEGER + 10);
149
+ * const aboveRange = PositiveSafeInt.fromNumber(Number.MAX_SAFE_INTEGER + 10);
144
150
  *
145
151
  * assert.isTrue(belowRange === 1);
146
152
  *
@@ -149,10 +155,10 @@ export declare const PositiveSafeInt: {
149
155
  * assert.isTrue(aboveRange === Number.MAX_SAFE_INTEGER);
150
156
  * ```
151
157
  *
152
- * @param value - The value to clamp
153
- * @returns The clamped value as a `PositiveSafeInt`
158
+ * @param value - The value to convert
159
+ * @returns The value as a `PositiveSafeInt`
154
160
  */
155
- readonly clamp: (x: number) => TtfImported_PositiveSafeInt;
161
+ readonly fromNumber: (x: number) => TtfImported_PositiveSafeInt;
156
162
  /**
157
163
  * Generates a random `PositiveSafeInt` within the given range.
158
164
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,IAAI,2BAA2B,EACpD,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,eAAe,GAAG,2BAA2B,CAAC;AAgC1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,iDAAK,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;MAAW,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;;;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,IAAI,2BAA2B,EACpD,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,eAAe,GAAG,2BAA2B,CAAC;AAgC1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,iDAAK,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;MAAW,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;;;;;;;;;;;;;;;;CAEK,CAAC"}