ts-data-forge 11.0.1 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +2 -2
  2. package/dist/number/branded-types/int16.d.mts +12 -7
  3. package/dist/number/branded-types/int16.d.mts.map +1 -1
  4. package/dist/number/branded-types/int16.mjs +13 -8
  5. package/dist/number/branded-types/int16.mjs.map +1 -1
  6. package/dist/number/branded-types/int32.d.mts +12 -7
  7. package/dist/number/branded-types/int32.d.mts.map +1 -1
  8. package/dist/number/branded-types/int32.mjs +13 -8
  9. package/dist/number/branded-types/int32.mjs.map +1 -1
  10. package/dist/number/branded-types/negative-finite-number.d.mts +13 -6
  11. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  12. package/dist/number/branded-types/negative-finite-number.mjs +15 -8
  13. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  14. package/dist/number/branded-types/negative-int.d.mts +11 -6
  15. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  16. package/dist/number/branded-types/negative-int.mjs +13 -8
  17. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  18. package/dist/number/branded-types/negative-safe-int.d.mts +13 -7
  19. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  20. package/dist/number/branded-types/negative-safe-int.mjs +15 -9
  21. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  22. package/dist/number/branded-types/non-negative-finite-number.d.mts +11 -6
  23. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  24. package/dist/number/branded-types/non-negative-finite-number.mjs +12 -7
  25. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  26. package/dist/number/branded-types/non-negative-int16.d.mts +13 -7
  27. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  28. package/dist/number/branded-types/non-negative-int16.mjs +14 -8
  29. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  30. package/dist/number/branded-types/non-negative-int32.d.mts +13 -7
  31. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  32. package/dist/number/branded-types/non-negative-int32.mjs +14 -8
  33. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  34. package/dist/number/branded-types/non-positive-finite-number.d.mts +11 -6
  35. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  36. package/dist/number/branded-types/non-positive-finite-number.mjs +12 -7
  37. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  38. package/dist/number/branded-types/non-positive-int.d.mts +11 -6
  39. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  40. package/dist/number/branded-types/non-positive-int.mjs +12 -7
  41. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  42. package/dist/number/branded-types/non-positive-safe-int.d.mts +14 -7
  43. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  44. package/dist/number/branded-types/non-positive-safe-int.mjs +15 -8
  45. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  46. package/dist/number/branded-types/non-zero-int16.d.mts +13 -7
  47. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  48. package/dist/number/branded-types/non-zero-int16.mjs +14 -8
  49. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  50. package/dist/number/branded-types/non-zero-int32.d.mts +13 -7
  51. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  52. package/dist/number/branded-types/non-zero-int32.mjs +14 -8
  53. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  54. package/dist/number/branded-types/non-zero-safe-int.d.mts +13 -7
  55. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  56. package/dist/number/branded-types/non-zero-safe-int.mjs +14 -8
  57. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  58. package/dist/number/branded-types/non-zero-uint16.d.mts +13 -7
  59. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  60. package/dist/number/branded-types/non-zero-uint16.mjs +14 -8
  61. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  62. package/dist/number/branded-types/non-zero-uint32.d.mts +13 -7
  63. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  64. package/dist/number/branded-types/non-zero-uint32.mjs +14 -8
  65. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  66. package/dist/number/branded-types/positive-finite-number.d.mts +13 -6
  67. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  68. package/dist/number/branded-types/positive-finite-number.mjs +14 -7
  69. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  70. package/dist/number/branded-types/positive-int.d.mts +13 -8
  71. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  72. package/dist/number/branded-types/positive-int.mjs +14 -9
  73. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  74. package/dist/number/branded-types/positive-int16.d.mts +13 -7
  75. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  76. package/dist/number/branded-types/positive-int16.mjs +14 -8
  77. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  78. package/dist/number/branded-types/positive-int32.d.mts +13 -7
  79. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  80. package/dist/number/branded-types/positive-int32.mjs +14 -8
  81. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  82. package/dist/number/branded-types/positive-safe-int.d.mts +16 -10
  83. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  84. package/dist/number/branded-types/positive-safe-int.mjs +17 -11
  85. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  86. package/dist/number/branded-types/positive-uint16.d.mts +13 -7
  87. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  88. package/dist/number/branded-types/positive-uint16.mjs +14 -8
  89. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  90. package/dist/number/branded-types/positive-uint32.d.mts +13 -7
  91. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  92. package/dist/number/branded-types/positive-uint32.mjs +14 -8
  93. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  94. package/dist/number/branded-types/safe-int.d.mts +15 -10
  95. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  96. package/dist/number/branded-types/safe-int.mjs +16 -11
  97. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  98. package/dist/number/branded-types/safe-uint.d.mts +12 -7
  99. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  100. package/dist/number/branded-types/safe-uint.mjs +13 -8
  101. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  102. package/dist/number/branded-types/uint.d.mts +14 -10
  103. package/dist/number/branded-types/uint.d.mts.map +1 -1
  104. package/dist/number/branded-types/uint.mjs +15 -11
  105. package/dist/number/branded-types/uint.mjs.map +1 -1
  106. package/dist/number/branded-types/uint16.d.mts +12 -7
  107. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  108. package/dist/number/branded-types/uint16.mjs +13 -8
  109. package/dist/number/branded-types/uint16.mjs.map +1 -1
  110. package/dist/number/branded-types/uint32.d.mts +12 -7
  111. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  112. package/dist/number/branded-types/uint32.mjs +13 -8
  113. package/dist/number/branded-types/uint32.mjs.map +1 -1
  114. package/dist/number/enum/int8.d.mts +12 -7
  115. package/dist/number/enum/int8.d.mts.map +1 -1
  116. package/dist/number/enum/int8.mjs +19 -14
  117. package/dist/number/enum/int8.mjs.map +1 -1
  118. package/dist/number/enum/uint8.d.mts +12 -7
  119. package/dist/number/enum/uint8.d.mts.map +1 -1
  120. package/dist/number/enum/uint8.mjs +19 -14
  121. package/dist/number/enum/uint8.mjs.map +1 -1
  122. package/dist/number/refined-number-utils.d.mts +9 -9
  123. package/dist/number/refined-number-utils.d.mts.map +1 -1
  124. package/dist/number/refined-number-utils.mjs +7 -7
  125. package/dist/number/refined-number-utils.mjs.map +1 -1
  126. package/package.json +1 -1
  127. package/src/number/branded-types/int16.mts +13 -8
  128. package/src/number/branded-types/int32.mts +13 -8
  129. package/src/number/branded-types/negative-finite-number.mts +15 -8
  130. package/src/number/branded-types/negative-finite-number.test.mts +4 -4
  131. package/src/number/branded-types/negative-int.mts +13 -8
  132. package/src/number/branded-types/negative-int.test.mts +5 -5
  133. package/src/number/branded-types/negative-safe-int.mts +15 -9
  134. package/src/number/branded-types/negative-safe-int.test.mts +4 -4
  135. package/src/number/branded-types/non-negative-finite-number.mts +12 -7
  136. package/src/number/branded-types/non-negative-int16.mts +14 -8
  137. package/src/number/branded-types/non-negative-int32.mts +14 -8
  138. package/src/number/branded-types/non-positive-finite-number.mts +12 -7
  139. package/src/number/branded-types/non-positive-finite-number.test.mts +7 -7
  140. package/src/number/branded-types/non-positive-int.mts +12 -7
  141. package/src/number/branded-types/non-positive-int.test.mts +7 -7
  142. package/src/number/branded-types/non-positive-safe-int.mts +15 -8
  143. package/src/number/branded-types/non-positive-safe-int.test.mts +7 -7
  144. package/src/number/branded-types/non-zero-int16.mts +14 -8
  145. package/src/number/branded-types/non-zero-int32.mts +14 -8
  146. package/src/number/branded-types/non-zero-safe-int.mts +14 -8
  147. package/src/number/branded-types/non-zero-uint16.mts +14 -8
  148. package/src/number/branded-types/non-zero-uint32.mts +14 -8
  149. package/src/number/branded-types/positive-finite-number.mts +14 -7
  150. package/src/number/branded-types/positive-int.mts +14 -9
  151. package/src/number/branded-types/positive-int16.mts +14 -8
  152. package/src/number/branded-types/positive-int32.mts +14 -8
  153. package/src/number/branded-types/positive-safe-int.mts +17 -11
  154. package/src/number/branded-types/positive-uint16.mts +14 -8
  155. package/src/number/branded-types/positive-uint32.mts +14 -8
  156. package/src/number/branded-types/safe-int.mts +16 -11
  157. package/src/number/branded-types/safe-uint.mts +13 -8
  158. package/src/number/branded-types/uint.mts +15 -11
  159. package/src/number/branded-types/uint16.mts +13 -8
  160. package/src/number/branded-types/uint32.mts +13 -8
  161. package/src/number/enum/int8.mts +20 -14
  162. package/src/number/enum/int8.test.mts +7 -4
  163. package/src/number/enum/uint8.mts +20 -14
  164. package/src/number/enum/uint8.test.mts +7 -4
  165. package/src/number/refined-number-utils.mts +22 -19
@@ -1 +1 @@
1
- {"version":3,"file":"uint16.mjs","sources":["../../../src/number/branded-types/uint16.mts"],"sourcesContent":["import { type Uint16 as TtfImported_Uint16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint16 = TtfImported_Uint16;\n\ntype ElementType = Uint16;\n\nconst typeNameInMessage = 'a non-negative integer less than 2^16';\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 0,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 2 ** 16 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a non-negative integer less than 2^16.\n *\n * Returns `true` for a non-negative integer less than 2^16 — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^16, `false` otherwise\n */\nexport const isUint16 = is;\n\n/**\n * Casts a `number` to the `Uint16` branded type.\n *\n * Validates that the value is a non-negative integer less than 2^16 and returns\n * it with the `Uint16` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Uint16`\n * @throws {TypeError} If the value is not a non-negative integer less than 2^16\n */\nexport const asUint16 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint16` branded type.\n *\n * The `Uint16` type represents a non-negative integer less than 2^16. Division\n * (`div`) uses floor division.\n */\nexport const Uint16 = {\n /**\n * Type guard that checks if a value is a non-negative integer less than 2^16.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^16, `false` otherwise\n * @see {@link isUint16} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint16`.\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Uint16`.\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint16`\n */\n min: min_,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint16`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `Uint16` range, rounding to the nearest integer\n * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as an `Uint16`\n */\n clamp,\n\n /**\n * Generates a random `Uint16` 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 `Uint16` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint16` (floored to\n * an integer).\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint16`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint16`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The sum of `a` and `b` as an `Uint16`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint16`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The difference of `a` and `b` as an `Uint16`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint16`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The product of `a` and `b` as an `Uint16`\n */\n mul,\n\n /**\n * Divides two non-negative integers using floor division (`⌊a / b⌋`): the\n * result is `a / b` rounded toward negative infinity, as an `Uint16`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint16`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint16,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n\nexpectType<\n typeof Uint16,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,uCAAA;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,QAAA,GAAW;AAYjB,MAAM,QAAA,GAAW;AAQjB,MAAM,MAAA,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpB,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":"uint16.mjs","sources":["../../../src/number/branded-types/uint16.mts"],"sourcesContent":["import { type Uint16 as TtfImported_Uint16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint16 = TtfImported_Uint16;\n\ntype ElementType = Uint16;\n\nconst typeNameInMessage = 'a non-negative integer less than 2^16';\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 0,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 2 ** 16 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a non-negative integer less than 2^16.\n *\n * Returns `true` for a non-negative integer less than 2^16 — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^16, `false` otherwise\n */\nexport const isUint16 = is;\n\n/**\n * Casts a `number` to the `Uint16` branded type.\n *\n * Validates that the value is a non-negative integer less than 2^16 and returns\n * it with the `Uint16` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Uint16`\n * @throws {TypeError} If the value is not a non-negative integer less than 2^16\n */\nexport const asUint16 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint16` branded type.\n *\n * The `Uint16` type represents a non-negative integer less than 2^16. Division\n * (`div`) uses floor division.\n */\nexport const Uint16 = {\n /**\n * Type guard that checks if a value is a non-negative integer less than 2^16.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^16, `false` otherwise\n * @see {@link isUint16} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint16` (the lower saturation target\n * of `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Uint16` (the upper saturation target of\n * `fromNumber`).\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint16`\n */\n min: min_,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint16`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into an `Uint16`, rounding to the nearest\n * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.\n *\n * Unlike `asUint16`, this is total: out-of-range inputs are clamped to the\n * nearest representable `Uint16` instead of throwing.\n *\n * @param value - The value to convert\n * @returns The value as an `Uint16`\n */\n fromNumber,\n\n /**\n * Generates a random `Uint16` 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 `Uint16` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint16` (floored to\n * an integer).\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint16`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint16`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The sum of `a` and `b` as an `Uint16`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint16`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The difference of `a` and `b` as an `Uint16`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint16`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The product of `a` and `b` as an `Uint16`\n */\n mul,\n\n /**\n * Divides two non-negative integers using floor division (`⌊a / b⌋`): the\n * result is `a / b` rounded toward negative infinity, as an `Uint16`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint16`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint16,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n\nexpectType<\n typeof Uint16,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,uCAAA;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,QAAA,GAAW;AAYjB,MAAM,QAAA,GAAW;AAQjB,MAAM,MAAA,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpB,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,EAYL,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;;;;"}
@@ -50,11 +50,13 @@ export declare const Uint32: {
50
50
  */
51
51
  readonly is: (a: number) => a is TtfImported_Uint32;
52
52
  /**
53
- * The smallest value representable as `Uint32`.
53
+ * The smallest value representable as `Uint32` (the lower saturation target
54
+ * of `fromNumber`).
54
55
  */
55
56
  readonly MIN_VALUE: 0;
56
57
  /**
57
- * The largest value representable as `Uint32`.
58
+ * The largest value representable as `Uint32` (the upper saturation target of
59
+ * `fromNumber`).
58
60
  */
59
61
  readonly MAX_VALUE: number;
60
62
  /**
@@ -72,13 +74,16 @@ export declare const Uint32: {
72
74
  */
73
75
  readonly max: (...values: readonly import("ts-type-forge").WithSmallInt<TtfImported_Uint32>[]) => TtfImported_Uint32;
74
76
  /**
75
- * Clamps a `number` into the `Uint32` range, rounding to the nearest integer
76
- * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
77
+ * Converts an arbitrary `number` into an `Uint32`, rounding to the nearest
78
+ * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
77
79
  *
78
- * @param value - The value to clamp
79
- * @returns The clamped value as an `Uint32`
80
+ * Unlike `asUint32`, this is total: out-of-range inputs are clamped to the
81
+ * nearest representable `Uint32` instead of throwing.
82
+ *
83
+ * @param value - The value to convert
84
+ * @returns The value as an `Uint32`
80
85
  */
81
- readonly clamp: (x: number) => TtfImported_Uint32;
86
+ readonly fromNumber: (x: number) => TtfImported_Uint32;
82
87
  /**
83
88
  * Generates a random `Uint32` within the given range.
84
89
  *
@@ -1 +1 @@
1
- {"version":3,"file":"uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint32.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAIlE,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC;AA+BxC;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,wCAAK,CAAC;AAE3B;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;MAAW,CAAC;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;IACjB;;;;;;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":"uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint32.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAIlE,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC;AA+BxC;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,wCAAK,CAAC;AAE3B;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;MAAW,CAAC;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;IACjB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;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 Uint32 = {
33
33
  */
34
34
  is,
35
35
  /**
36
- * The smallest value representable as `Uint32`.
36
+ * The smallest value representable as `Uint32` (the lower saturation target
37
+ * of `fromNumber`).
37
38
  */
38
39
  MIN_VALUE,
39
40
  /**
40
- * The largest value representable as `Uint32`.
41
+ * The largest value representable as `Uint32` (the upper saturation target of
42
+ * `fromNumber`).
41
43
  */
42
44
  MAX_VALUE,
43
45
  /**
@@ -55,13 +57,16 @@ const Uint32 = {
55
57
  */
56
58
  max: max_,
57
59
  /**
58
- * Clamps a `number` into the `Uint32` range, rounding to the nearest integer
59
- * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
60
+ * Converts an arbitrary `number` into an `Uint32`, rounding to the nearest
61
+ * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
60
62
  *
61
- * @param value - The value to clamp
62
- * @returns The clamped value as an `Uint32`
63
+ * Unlike `asUint32`, this is total: out-of-range inputs are clamped to the
64
+ * nearest representable `Uint32` instead of throwing.
65
+ *
66
+ * @param value - The value to convert
67
+ * @returns The value as an `Uint32`
63
68
  */
64
- clamp,
69
+ fromNumber,
65
70
  /**
66
71
  * Generates a random `Uint32` within the given range.
67
72
  *
@@ -1 +1 @@
1
- {"version":3,"file":"uint32.mjs","sources":["../../../src/number/branded-types/uint32.mts"],"sourcesContent":["import { type Uint32 as TtfImported_Uint32 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint32 = TtfImported_Uint32;\n\ntype ElementType = Uint32;\n\nconst typeNameInMessage = 'a non-negative integer less than 2^32';\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 0,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 2 ** 32 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a non-negative integer less than 2^32.\n *\n * Returns `true` for a non-negative integer less than 2^32 — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^32, `false` otherwise\n */\nexport const isUint32 = is;\n\n/**\n * Casts a `number` to the `Uint32` branded type.\n *\n * Validates that the value is a non-negative integer less than 2^32 and returns\n * it with the `Uint32` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Uint32`\n * @throws {TypeError} If the value is not a non-negative integer less than 2^32\n */\nexport const asUint32 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint32` branded type.\n *\n * The `Uint32` type represents a non-negative integer less than 2^32. Division\n * (`div`) uses floor division.\n */\nexport const Uint32 = {\n /**\n * Type guard that checks if a value is a non-negative integer less than 2^32.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^32, `false` otherwise\n * @see {@link isUint32} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint32`.\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Uint32`.\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint32`\n */\n min: min_,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint32`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `Uint32` range, rounding to the nearest integer\n * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as an `Uint32`\n */\n clamp,\n\n /**\n * Generates a random `Uint32` 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 `Uint32` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint32` (floored to\n * an integer).\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint32`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint32`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The sum of `a` and `b` as an `Uint32`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint32`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The difference of `a` and `b` as an `Uint32`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint32`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The product of `a` and `b` as an `Uint32`\n */\n mul,\n\n /**\n * Divides two non-negative integers using floor division (`⌊a / b⌋`): the\n * result is `a / b` rounded toward negative infinity, as an `Uint32`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint32`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint32,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n\nexpectType<\n typeof Uint32,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('<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AAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
1
+ {"version":3,"file":"uint32.mjs","sources":["../../../src/number/branded-types/uint32.mts"],"sourcesContent":["import { type Uint32 as TtfImported_Uint32 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint32 = TtfImported_Uint32;\n\ntype ElementType = Uint32;\n\nconst typeNameInMessage = 'a non-negative integer less than 2^32';\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 0,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 2 ** 32 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is a non-negative integer less than 2^32.\n *\n * Returns `true` for a non-negative integer less than 2^32 — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^32, `false` otherwise\n */\nexport const isUint32 = is;\n\n/**\n * Casts a `number` to the `Uint32` branded type.\n *\n * Validates that the value is a non-negative integer less than 2^32 and returns\n * it with the `Uint32` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Uint32`\n * @throws {TypeError} If the value is not a non-negative integer less than 2^32\n */\nexport const asUint32 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint32` branded type.\n *\n * The `Uint32` type represents a non-negative integer less than 2^32. Division\n * (`div`) uses floor division.\n */\nexport const Uint32 = {\n /**\n * Type guard that checks if a value is a non-negative integer less than 2^32.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-negative integer less than 2^32, `false` otherwise\n * @see {@link isUint32} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint32` (the lower saturation target\n * of `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Uint32` (the upper saturation target of\n * `fromNumber`).\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint32`\n */\n min: min_,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint32`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into an `Uint32`, rounding to the nearest\n * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.\n *\n * Unlike `asUint32`, this is total: out-of-range inputs are clamped to the\n * nearest representable `Uint32` instead of throwing.\n *\n * @param value - The value to convert\n * @returns The value as an `Uint32`\n */\n fromNumber,\n\n /**\n * Generates a random `Uint32` 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 `Uint32` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint32` (floored to\n * an integer).\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint32`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint32`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The sum of `a` and `b` as an `Uint32`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint32`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The difference of `a` and `b` as an `Uint32`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint32`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The product of `a` and `b` as an `Uint32`\n */\n mul,\n\n /**\n * Divides two non-negative integers using floor division (`⌊a / b⌋`): the\n * result is `a / b` rounded toward negative infinity, as an `Uint32`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint32`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint32,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n\nexpectType<\n typeof Uint32,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'non-negative' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,uCAAA;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,QAAA,GAAW;AAYjB,MAAM,QAAA,GAAW;AAQjB,MAAM,MAAA,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpB,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,EAYL,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;;;;"}
@@ -37,11 +37,13 @@ export declare const Int8: {
37
37
  */
38
38
  readonly is: (x: number) => x is Int8;
39
39
  /**
40
- * The smallest value representable as `Int8`.
40
+ * The smallest value representable as `Int8` (the lower saturation target of
41
+ * `fromNumber`).
41
42
  */
42
43
  readonly MIN_VALUE: -128;
43
44
  /**
44
- * The largest value representable as `Int8`.
45
+ * The largest value representable as `Int8` (the upper saturation target of
46
+ * `fromNumber`).
45
47
  */
46
48
  readonly MAX_VALUE: 127;
47
49
  /**
@@ -59,13 +61,16 @@ export declare const Int8: {
59
61
  */
60
62
  readonly max: (...values: readonly Int8[]) => Int8;
61
63
  /**
62
- * Clamps a `number` into the `Int8` range, rounding to the nearest integer
63
- * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
64
+ * Converts an arbitrary `number` into an `Int8`, rounding to the nearest
65
+ * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
64
66
  *
65
- * @param value - The value to clamp
66
- * @returns The clamped value as an `Int8`
67
+ * Unlike `asInt8`, this is total: out-of-range inputs are clamped to the
68
+ * nearest representable `Int8` instead of throwing.
69
+ *
70
+ * @param value - The value to convert
71
+ * @returns The value as an `Int8`
67
72
  */
68
- readonly clamp: (a: number) => Int8;
73
+ readonly fromNumber: (a: number) => Int8;
69
74
  /**
70
75
  * Returns the absolute value of an integer in [-128, 127].
71
76
  *
@@ -1 +1 @@
1
- {"version":3,"file":"int8.d.mts","sourceRoot":"","sources":["../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efinedNumberUtils.operatorsForInteger({
@@ -19,18 +19,18 @@ const castType = (x) => (
19
19
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
20
20
  castTypeImpl(x)
21
21
  );
22
- const clamp = (a) => castType(clampImpl(a));
22
+ const fromNumber = (a) => castType(fromNumberImpl(a));
23
23
  const abs = (x) => (
24
24
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
25
25
  Math.abs(x)
26
26
  );
27
27
  const min_ = (...values) => castType(Math.min(...values));
28
28
  const max_ = (...values) => castType(Math.max(...values));
29
- const pow = (x, y) => clamp(x ** y);
30
- const add = (x, y) => clamp(x + y);
31
- const sub = (x, y) => clamp(x - y);
32
- const mul = (x, y) => clamp(x * y);
33
- const div = (x, y) => clamp(Math.floor(x / y));
29
+ const pow = (x, y) => fromNumber(x ** y);
30
+ const add = (x, y) => fromNumber(x + y);
31
+ const sub = (x, y) => fromNumber(x - y);
32
+ const mul = (x, y) => fromNumber(x * y);
33
+ const div = (x, y) => fromNumber(Math.floor(x / y));
34
34
  const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));
35
35
  const isInt8 = is;
36
36
  const asInt8 = castType;
@@ -44,11 +44,13 @@ const Int8 = {
44
44
  */
45
45
  is,
46
46
  /**
47
- * The smallest value representable as `Int8`.
47
+ * The smallest value representable as `Int8` (the lower saturation target of
48
+ * `fromNumber`).
48
49
  */
49
50
  MIN_VALUE,
50
51
  /**
51
- * The largest value representable as `Int8`.
52
+ * The largest value representable as `Int8` (the upper saturation target of
53
+ * `fromNumber`).
52
54
  */
53
55
  MAX_VALUE,
54
56
  /**
@@ -66,13 +68,16 @@ const Int8 = {
66
68
  */
67
69
  max: max_,
68
70
  /**
69
- * Clamps a `number` into the `Int8` range, rounding to the nearest integer
70
- * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
71
+ * Converts an arbitrary `number` into an `Int8`, rounding to the nearest
72
+ * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
71
73
  *
72
- * @param value - The value to clamp
73
- * @returns The clamped value as an `Int8`
74
+ * Unlike `asInt8`, this is total: out-of-range inputs are clamped to the
75
+ * nearest representable `Int8` instead of throwing.
76
+ *
77
+ * @param value - The value to convert
78
+ * @returns The value as an `Int8`
74
79
  */
75
- clamp,
80
+ fromNumber,
76
81
  /**
77
82
  * Returns the absolute value of an integer in [-128, 127].
78
83
  *
@@ -1 +1 @@
1
- {"version":3,"file":"int8.mjs","sources":["../../../src/number/enum/int8.mts"],"sourcesContent":["import {\n type AbsoluteValue,\n type Int16,\n type Int8 as TtfImported_Int8,\n} from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Int8 = TtfImported_Int8;\n\nconst typeNameInMessage = 'an integer in [-128, 127]';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n clamp: clampImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n Int16,\n -128,\n 127\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: -128,\n MAX_VALUE: 127,\n typeNameInMessage,\n} as const);\n\nconst is = (x: number): x is Int8 => isImpl(x);\n\nconst castType = (x: number): Int8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Int8;\n\nconst clamp = (a: number): Int8 => castType(clampImpl(a));\n\nconst abs = <N extends Int8>(x: N): AbsoluteValue<N> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.abs(x) as unknown as AbsoluteValue<N>;\n\nconst min_ = (...values: readonly Int8[]): Int8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Int8[]): Int8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Int8, y: Int8): Int8 => clamp(x ** y);\n\nconst add = (x: Int8, y: Int8): Int8 => clamp(x + y);\n\nconst sub = (x: Int8, y: Int8): Int8 => clamp(x - y);\n\nconst mul = (x: Int8, y: Int8): Int8 => clamp(x * y);\n\nconst div = (x: Int8, y: Exclude<Int8, 0>): Int8 => clamp(Math.floor(x / y));\n\nconst random = (min: Int8, max: Int8): Int8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Type guard that checks if a value is an integer in [-128, 127].\n *\n * Returns `true` for an integer in [-128, 127] — a value with no fractional\n * component.\n *\n * @param value - The value to check\n * @returns `true` if the value is an integer in [-128, 127], `false` otherwise\n */\nexport const isInt8 = is;\n\n/**\n * Casts a `number` to the `Int8` branded type.\n *\n * Validates that the value is an integer in [-128, 127] and returns it with the\n * `Int8` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Int8`\n * @throws {TypeError} If the value is not an integer in [-128, 127]\n */\nexport const asInt8 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Int8` branded type.\n *\n * The `Int8` type represents an integer in [-128, 127]. Division (`div`) uses\n * floor division.\n */\nexport const Int8 = {\n /**\n * Type guard that checks if a value is an integer in [-128, 127].\n *\n * @param value - The value to check\n * @returns `true` if the value is an integer in [-128, 127], `false` otherwise\n * @see {@link isInt8} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Int8`.\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Int8`.\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given integers.\n *\n * @param values - The integers to compare (at least one required)\n * @returns The smallest value as an `Int8`\n */\n min: min_,\n\n /**\n * Returns the largest of the given integers.\n *\n * @param values - The integers to compare (at least one required)\n * @returns The largest value as an `Int8`\n */\n max: max_,\n\n /**\n * Clamps a `number` into the `Int8` range, rounding to the nearest integer\n * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as an `Int8`\n */\n clamp,\n\n /**\n * Returns the absolute value of an integer in [-128, 127].\n *\n * The result is non-negative and keeps the `Int8` brand.\n *\n * @param a - The integer value\n * @returns The absolute value as a non-negative `Int8`\n */\n abs,\n\n /**\n * Generates a random `Int8` 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 `Int8` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Int8` (floored to an\n * integer).\n *\n * @param a - The base integer\n * @param b - The exponent integer\n * @returns `a ** b` as an `Int8`\n */\n pow,\n\n /**\n * Adds two integers, returning `a + b` as an `Int8`.\n *\n * @param a - The first integer\n * @param b - The second integer\n * @returns The sum of `a` and `b` as an `Int8`\n */\n add,\n\n /**\n * Subtracts two integers, returning `a - b` as an `Int8`.\n *\n * @param a - The first integer\n * @param b - The second integer\n * @returns The difference of `a` and `b` as an `Int8`\n */\n sub,\n\n /**\n * Multiplies two integers, returning `a * b` as an `Int8`.\n *\n * @param a - The first integer\n * @param b - The second integer\n * @returns The product of `a` and `b` as an `Int8`\n */\n mul,\n\n /**\n * Divides two integers using floor division (`⌊a / b⌋`): the result is `a /\n * b` rounded toward negative infinity, as an `Int8`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Int8`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Int8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Int16,\n 'int' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAUA,MAAM,iBAAA,GAAoB,2BAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,IAAA;AAAA,EACX,SAAA,EAAW,GAAA;AAAA,EACX;AACF,CAAU,CAAA;AAEV,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A;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,EAUA,GAAA;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":"int8.mjs","sources":["../../../src/number/enum/int8.mts"],"sourcesContent":["import {\n type AbsoluteValue,\n type Int16,\n type Int8 as TtfImported_Int8,\n} from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Int8 = TtfImported_Int8;\n\nconst typeNameInMessage = 'an integer in [-128, 127]';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n fromNumber: fromNumberImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n Int16,\n -128,\n 127\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: -128,\n MAX_VALUE: 127,\n typeNameInMessage,\n} as const);\n\nconst is = (x: number): x is Int8 => isImpl(x);\n\nconst castType = (x: number): Int8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Int8;\n\nconst fromNumber = (a: number): Int8 => castType(fromNumberImpl(a));\n\nconst abs = <N extends Int8>(x: N): AbsoluteValue<N> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.abs(x) as unknown as AbsoluteValue<N>;\n\nconst min_ = (...values: readonly Int8[]): Int8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Int8[]): Int8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Int8, y: Int8): Int8 => fromNumber(x ** y);\n\nconst add = (x: Int8, y: Int8): Int8 => fromNumber(x + y);\n\nconst sub = (x: Int8, y: Int8): Int8 => fromNumber(x - y);\n\nconst mul = (x: Int8, y: Int8): Int8 => fromNumber(x * y);\n\nconst div = (x: Int8, y: Exclude<Int8, 0>): Int8 =>\n fromNumber(Math.floor(x / y));\n\nconst random = (min: Int8, max: Int8): Int8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Type guard that checks if a value is an integer in [-128, 127].\n *\n * Returns `true` for an integer in [-128, 127] — a value with no fractional\n * component.\n *\n * @param value - The value to check\n * @returns `true` if the value is an integer in [-128, 127], `false` otherwise\n */\nexport const isInt8 = is;\n\n/**\n * Casts a `number` to the `Int8` branded type.\n *\n * Validates that the value is an integer in [-128, 127] and returns it with the\n * `Int8` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Int8`\n * @throws {TypeError} If the value is not an integer in [-128, 127]\n */\nexport const asInt8 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Int8` branded type.\n *\n * The `Int8` type represents an integer in [-128, 127]. Division (`div`) uses\n * floor division.\n */\nexport const Int8 = {\n /**\n * Type guard that checks if a value is an integer in [-128, 127].\n *\n * @param value - The value to check\n * @returns `true` if the value is an integer in [-128, 127], `false` otherwise\n * @see {@link isInt8} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Int8` (the lower saturation target of\n * `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Int8` (the upper saturation target of\n * `fromNumber`).\n */\n MAX_VALUE,\n\n /**\n * Returns the smallest of the given integers.\n *\n * @param values - The integers to compare (at least one required)\n * @returns The smallest value as an `Int8`\n */\n min: min_,\n\n /**\n * Returns the largest of the given integers.\n *\n * @param values - The integers to compare (at least one required)\n * @returns The largest value as an `Int8`\n */\n max: max_,\n\n /**\n * Converts an arbitrary `number` into an `Int8`, rounding to the nearest\n * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.\n *\n * Unlike `asInt8`, this is total: out-of-range inputs are clamped to the\n * nearest representable `Int8` instead of throwing.\n *\n * @param value - The value to convert\n * @returns The value as an `Int8`\n */\n fromNumber,\n\n /**\n * Returns the absolute value of an integer in [-128, 127].\n *\n * The result is non-negative and keeps the `Int8` brand.\n *\n * @param a - The integer value\n * @returns The absolute value as a non-negative `Int8`\n */\n abs,\n\n /**\n * Generates a random `Int8` 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 `Int8` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Int8` (floored to an\n * integer).\n *\n * @param a - The base integer\n * @param b - The exponent integer\n * @returns `a ** b` as an `Int8`\n */\n pow,\n\n /**\n * Adds two integers, returning `a + b` as an `Int8`.\n *\n * @param a - The first integer\n * @param b - The second integer\n * @returns The sum of `a` and `b` as an `Int8`\n */\n add,\n\n /**\n * Subtracts two integers, returning `a - b` as an `Int8`.\n *\n * @param a - The first integer\n * @param b - The second integer\n * @returns The difference of `a` and `b` as an `Int8`\n */\n sub,\n\n /**\n * Multiplies two integers, returning `a * b` as an `Int8`.\n *\n * @param a - The first integer\n * @param b - The second integer\n * @returns The product of `a` and `b` as an `Int8`\n */\n mul,\n\n /**\n * Divides two integers using floor division (`⌊a / b⌋`): the result is `a /\n * b` rounded toward negative infinity, as an `Int8`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Int8`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Int8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Int16,\n 'int' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAUA,MAAM,iBAAA,GAAoB,2BAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,UAAA,EAAY,cAAA;AAAA,EACZ,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,IAAA;AAAA,EACX,SAAA,EAAW,GAAA;AAAA,EACX;AACF,CAAU,CAAA;AAEV,MAAM,EAAA,GAAK,CAAC,CAAA,KAAyB,MAAA,CAAO,CAAC,CAAA;AAE7C,MAAM,WAAW,CAAC,CAAA;AAAA;AAAA,EAEhB,aAAa,CAAC;AAAA,CAAA;AAEhB,MAAM,aAAa,CAAC,CAAA,KAAoB,QAAA,CAAS,cAAA,CAAe,CAAC,CAAC,CAAA;AAElE,MAAM,MAAM,CAAiB,CAAA;AAAA;AAAA,EAE3B,IAAA,CAAK,IAAI,CAAC;AAAA,CAAA;AAEZ,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,MAAM,CAAC,CAAA,EAAS,CAAA,KAAkB,UAAA,CAAW,KAAK,CAAC,CAAA;AAEzD,MAAM,MAAM,CAAC,CAAA,EAAS,CAAA,KAAkB,UAAA,CAAW,IA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A,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA;AACF;;;;"}
@@ -37,11 +37,13 @@ export declare const Uint8: {
37
37
  */
38
38
  readonly is: (x: number) => x is Uint8;
39
39
  /**
40
- * The smallest value representable as `Uint8`.
40
+ * The smallest value representable as `Uint8` (the lower saturation target of
41
+ * `fromNumber`).
41
42
  */
42
43
  readonly MIN_VALUE: 0;
43
44
  /**
44
- * The largest value representable as `Uint8`.
45
+ * The largest value representable as `Uint8` (the upper saturation target of
46
+ * `fromNumber`).
45
47
  */
46
48
  readonly MAX_VALUE: 255;
47
49
  /**
@@ -59,13 +61,16 @@ export declare const Uint8: {
59
61
  */
60
62
  readonly min: (...values: readonly Uint8[]) => Uint8;
61
63
  /**
62
- * Clamps a `number` into the `Uint8` range, rounding to the nearest integer
63
- * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
64
+ * Converts an arbitrary `number` into an `Uint8`, rounding to the nearest
65
+ * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
64
66
  *
65
- * @param value - The value to clamp
66
- * @returns The clamped value as an `Uint8`
67
+ * Unlike `asUint8`, this is total: out-of-range inputs are clamped to the
68
+ * nearest representable `Uint8` instead of throwing.
69
+ *
70
+ * @param value - The value to convert
71
+ * @returns The value as an `Uint8`
67
72
  */
68
- readonly clamp: (a: number) => Uint8;
73
+ readonly fromNumber: (a: number) => Uint8;
69
74
  /**
70
75
  * Generates a random `Uint8` within the given range.
71
76
  *
@@ -1 +1 @@
1
- {"version":3,"file":"uint8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/uint8.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAe,MAAM,eAAe,CAAC;AAI7E,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AA+CtC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,MApCL,MAAM,KAAG,CAAC,IAAI,KAoCJ,CA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AK;IAmEhC;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;8BAzEoB,SAAS,KAAK,EAAE,KAAG,KAAK;IA4E/C;;;;;OAKG;8BApFoB,SAAS,KAAK,EAAE,KAAG,KAAK;IAuF/C;;;;;;;;;OASG;6BAlGkB,MAAM,KAAG,KAAK;IAqGnC;;;;;;;;OAQG;2BA1FgB,KAAK,OAAO,KAAK,KAAG,KAAK;IA6F5C;;;;;;;OAOG;sBA/GW,KAAK,KAAK,KAAK,KAAG,KAAK;IAkHrC;;;;;;OAMG;sBAtHW,KAAK,KAAK,KAAK,KAAG,KAAK;IAyHrC;;;;;;OAMG;sBA7HW,KAAK,KAAK,KAAK,KAAG,KAAK;IAgIrC;;;;;;OAMG;sBApIW,KAAK,KAAK,KAAK,KAAG,KAAK;IAuIrC;;;;;;;OAOG;sBA5IW,KAAK,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAG,KAAK;CA8IzC,CAAC"}
@@ -5,7 +5,7 @@ const {
5
5
  MAX_VALUE,
6
6
  MIN_VALUE,
7
7
  castType: castTypeImpl,
8
- clamp: clampImpl,
8
+ fromNumber: fromNumberImpl,
9
9
  is: isImpl,
10
10
  random: randomImpl
11
11
  } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger(
@@ -21,14 +21,14 @@ const castType = (x) => (
21
21
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
22
22
  castTypeImpl(x)
23
23
  );
24
- const clamp = (a) => castType(clampImpl(a));
24
+ const fromNumber = (a) => castType(fromNumberImpl(a));
25
25
  const min_ = (...values) => castType(Math.min(...values));
26
26
  const max_ = (...values) => castType(Math.max(...values));
27
- const pow = (x, y) => clamp(x ** y);
28
- const add = (x, y) => clamp(x + y);
29
- const sub = (x, y) => clamp(x - y);
30
- const mul = (x, y) => clamp(x * y);
31
- const div = (x, y) => clamp(Math.floor(x / y));
27
+ const pow = (x, y) => fromNumber(x ** y);
28
+ const add = (x, y) => fromNumber(x + y);
29
+ const sub = (x, y) => fromNumber(x - y);
30
+ const mul = (x, y) => fromNumber(x * y);
31
+ const div = (x, y) => fromNumber(Math.floor(x / y));
32
32
  const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));
33
33
  const isUint8 = is;
34
34
  const asUint8 = castType;
@@ -42,11 +42,13 @@ const Uint8 = {
42
42
  */
43
43
  is,
44
44
  /**
45
- * The smallest value representable as `Uint8`.
45
+ * The smallest value representable as `Uint8` (the lower saturation target of
46
+ * `fromNumber`).
46
47
  */
47
48
  MIN_VALUE,
48
49
  /**
49
- * The largest value representable as `Uint8`.
50
+ * The largest value representable as `Uint8` (the upper saturation target of
51
+ * `fromNumber`).
50
52
  */
51
53
  MAX_VALUE,
52
54
  /**
@@ -64,13 +66,16 @@ const Uint8 = {
64
66
  */
65
67
  min: min_,
66
68
  /**
67
- * Clamps a `number` into the `Uint8` range, rounding to the nearest integer
68
- * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
69
+ * Converts an arbitrary `number` into an `Uint8`, rounding to the nearest
70
+ * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
69
71
  *
70
- * @param value - The value to clamp
71
- * @returns The clamped value as an `Uint8`
72
+ * Unlike `asUint8`, this is total: out-of-range inputs are clamped to the
73
+ * nearest representable `Uint8` instead of throwing.
74
+ *
75
+ * @param value - The value to convert
76
+ * @returns The value as an `Uint8`
72
77
  */
73
- clamp,
78
+ fromNumber,
74
79
  /**
75
80
  * Generates a random `Uint8` within the given range.
76
81
  *
@@ -1 +1 @@
1
- {"version":3,"file":"uint8.mjs","sources":["../../../src/number/enum/uint8.mts"],"sourcesContent":["import { type Uint8 as TtfImported_Uint8, type Uint16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint8 = TtfImported_Uint8;\n\nconst typeNameInMessage = 'an non-negative integer less than 256';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n clamp: clampImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<Uint16, 0, 255>(\n {\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 255,\n typeNameInMessage,\n } as const,\n);\n\nconst is = (x: number): x is Uint8 => isImpl(x);\n\nconst castType = (x: number): Uint8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Uint8;\n\nconst clamp = (a: number): Uint8 => castType(clampImpl(a));\n\nconst min_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Uint8, y: Uint8): Uint8 => clamp(x ** y);\n\nconst add = (x: Uint8, y: Uint8): Uint8 => clamp(x + y);\n\nconst sub = (x: Uint8, y: Uint8): Uint8 => clamp(x - y);\n\nconst mul = (x: Uint8, y: Uint8): Uint8 => clamp(x * y);\n\nconst div = (x: Uint8, y: Exclude<Uint8, 0>): Uint8 => clamp(Math.floor(x / y));\n\nconst random = (min: Uint8, max: Uint8): Uint8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Type guard that checks if a value is an non-negative integer less than 256.\n *\n * Returns `true` for an non-negative integer less than 256 — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise\n */\nexport const isUint8 = is;\n\n/**\n * Casts a `number` to the `Uint8` branded type.\n *\n * Validates that the value is an non-negative integer less than 256 and returns\n * it with the `Uint8` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Uint8`\n * @throws {TypeError} If the value is not an non-negative integer less than 256\n */\nexport const asUint8 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint8` branded type.\n *\n * The `Uint8` type represents an non-negative integer less than 256. Division\n * (`div`) uses floor division.\n */\nexport const Uint8 = {\n /**\n * Type guard that checks if a value is an non-negative integer less than 256.\n *\n * @param value - The value to check\n * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise\n * @see {@link isUint8} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint8`.\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Uint8`.\n */\n MAX_VALUE,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint8`\n */\n max: max_,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint8`\n */\n min: min_,\n\n /**\n * Clamps a `number` into the `Uint8` range, rounding to the nearest integer\n * and constraining the result to `[MIN_VALUE, MAX_VALUE]`.\n *\n * @param value - The value to clamp\n * @returns The clamped value as an `Uint8`\n */\n clamp,\n\n /**\n * Generates a random `Uint8` 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 `Uint8` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint8` (floored to\n * an integer).\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint8`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The sum of `a` and `b` as an `Uint8`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The difference of `a` and `b` as an `Uint8`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The product of `a` and `b` as an `Uint8`\n */\n mul,\n\n /**\n * Divides two non-negative integers using floor division (`⌊a / b⌋`): the\n * result is `a / b` rounded toward negative infinity, as an `Uint8`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint8`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Uint16,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAMA,MAAM,iBAAA,GAAoB,uCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,qBAAqB,kBAAA,CAAmB,mBAAA;AAAA,EAC1C;AAAA,IACE,oBAAA,EAAsB,aAAA;AAAA,IACtB,SAAA,EAAW,CAAA;AAAA,IACX,SAAA,EAAW,GAAA;AAAA,IACX;AAAA;AAEJ,CAAA;AAEA,MAAM,EAAA,GAAK,CAAC,CAAA,KAA0B,MAAA,CAAO,CAAC,CAAA;AAE9C,MAAM,WAAW,CAAC,CAAA;AAAA;AAAA,EAEhB,aAAa,CAAC;AAAA,CAAA;AAEhB,MAAM,QAAQ,CAAC,CAAA,KAAqB,QAAA,CAAS,SAAA,CAAU,CAAC,CAAC,CAAA;AAEzD,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,KAAK,CAAC,CAAA;AAEvD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,MAAM,CAAC,CAAA,EA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],"sourcesContent":["import { type Uint8 as TtfImported_Uint8, type Uint16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint8 = TtfImported_Uint8;\n\nconst typeNameInMessage = 'an non-negative integer less than 256';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n fromNumber: fromNumberImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<Uint16, 0, 255>(\n {\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 255,\n typeNameInMessage,\n } as const,\n);\n\nconst is = (x: number): x is Uint8 => isImpl(x);\n\nconst castType = (x: number): Uint8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Uint8;\n\nconst fromNumber = (a: number): Uint8 => castType(fromNumberImpl(a));\n\nconst min_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Uint8, y: Uint8): Uint8 => fromNumber(x ** y);\n\nconst add = (x: Uint8, y: Uint8): Uint8 => fromNumber(x + y);\n\nconst sub = (x: Uint8, y: Uint8): Uint8 => fromNumber(x - y);\n\nconst mul = (x: Uint8, y: Uint8): Uint8 => fromNumber(x * y);\n\nconst div = (x: Uint8, y: Exclude<Uint8, 0>): Uint8 =>\n fromNumber(Math.floor(x / y));\n\nconst random = (min: Uint8, max: Uint8): Uint8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Type guard that checks if a value is an non-negative integer less than 256.\n *\n * Returns `true` for an non-negative integer less than 256 — a value with no\n * fractional component.\n *\n * @param value - The value to check\n * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise\n */\nexport const isUint8 = is;\n\n/**\n * Casts a `number` to the `Uint8` branded type.\n *\n * Validates that the value is an non-negative integer less than 256 and returns\n * it with the `Uint8` brand. Throws a `TypeError` otherwise.\n *\n * @param value - The value to cast\n * @returns The value as an `Uint8`\n * @throws {TypeError} If the value is not an non-negative integer less than 256\n */\nexport const asUint8 = castType;\n\n/**\n * Namespace providing type-safe operations for the `Uint8` branded type.\n *\n * The `Uint8` type represents an non-negative integer less than 256. Division\n * (`div`) uses floor division.\n */\nexport const Uint8 = {\n /**\n * Type guard that checks if a value is an non-negative integer less than 256.\n *\n * @param value - The value to check\n * @returns `true` if the value is an non-negative integer less than 256, `false` otherwise\n * @see {@link isUint8} for usage examples\n */\n is,\n\n /**\n * The smallest value representable as `Uint8` (the lower saturation target of\n * `fromNumber`).\n */\n MIN_VALUE,\n\n /**\n * The largest value representable as `Uint8` (the upper saturation target of\n * `fromNumber`).\n */\n MAX_VALUE,\n\n /**\n * Returns the largest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The largest value as an `Uint8`\n */\n max: max_,\n\n /**\n * Returns the smallest of the given non-negative integers.\n *\n * @param values - The non-negative integers to compare (at least one required)\n * @returns The smallest value as an `Uint8`\n */\n min: min_,\n\n /**\n * Converts an arbitrary `number` into an `Uint8`, rounding to the nearest\n * integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.\n *\n * Unlike `asUint8`, this is total: out-of-range inputs are clamped to the\n * nearest representable `Uint8` instead of throwing.\n *\n * @param value - The value to convert\n * @returns The value as an `Uint8`\n */\n fromNumber,\n\n /**\n * Generates a random `Uint8` 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 `Uint8` in `[min, max]`\n */\n random,\n\n /**\n * Raises `a` to the power `b`, returning `a ** b` as an `Uint8` (floored to\n * an integer).\n *\n * @param a - The base non-negative integer\n * @param b - The exponent non-negative integer\n * @returns `a ** b` as an `Uint8`\n */\n pow,\n\n /**\n * Adds two non-negative integers, returning `a + b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The sum of `a` and `b` as an `Uint8`\n */\n add,\n\n /**\n * Subtracts two non-negative integers, returning `a - b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The difference of `a` and `b` as an `Uint8`\n */\n sub,\n\n /**\n * Multiplies two non-negative integers, returning `a * b` as an `Uint8`.\n *\n * @param a - The first non-negative integer\n * @param b - The second non-negative integer\n * @returns The product of `a` and `b` as an `Uint8`\n */\n mul,\n\n /**\n * Divides two non-negative integers using floor division (`⌊a / b⌋`): the\n * result is `a / b` rounded toward negative infinity, as an `Uint8`.\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The floored quotient as an `Uint8`\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Uint16,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAMA,MAAM,iBAAA,GAAoB,uCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,UAAA,EAAY,cAAA;AAAA,EACZ,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,qBAAqB,kBAAA,CAAmB,mBAAA;AAAA,EAC1C;AAAA,IACE,oBAAA,EAAsB,aAAA;AAAA,IACtB,SAAA,EAAW,CAAA;AAAA,IACX,SAAA,EAAW,GAAA;AAAA,IACX;AAAA;AAEJ,CAAA;AAEA,MAAM,EAAA,GAAK,CAAC,CAAA,KAA0B,MAAA,CAAO,CAAC,CAAA;AAE9C,MAAM,WAAW,CAAC,CAAA;AAAA;AAAA,EAEhB,aAAa,CAAC;AAAA,CAAA;AAEhB,MAAM,aAAa,CAAC,CAAA,KAAqB,QAAA,CAAS,cAAA,CAAe,CAAC,CAAC,CAAA;AAEnE,MAAM,IAAA,GAAO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A;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;;;;"}
@@ -78,16 +78,16 @@ export declare namespace TsDataForgeInternals {
78
78
  round: (x: N, y: N) => ToInt<N>;
79
79
  }>) & ('non-negative' extends classes ? Readonly<{
80
80
  MIN_VALUE: number;
81
- clamp: (a: number) => N;
81
+ fromNumber: (a: number) => N;
82
82
  }> : unknown) & ('non-negative' extends classes ? unknown : 'positive' extends classes ? unknown : Readonly<{
83
83
  abs: (x: N) => ToNonNegative<N>;
84
84
  }>) & ('positive' extends classes ? Readonly<{
85
85
  MIN_VALUE: number;
86
- clamp: (a: number) => N;
86
+ fromNumber: (a: number) => N;
87
87
  }> : unknown) & ('range' extends classes ? Readonly<{
88
88
  MIN_VALUE: number;
89
89
  MAX_VALUE: number;
90
- clamp: (a: number) => N;
90
+ fromNumber: (a: number) => N;
91
91
  }> : unknown) & Pick<Readonly<{
92
92
  add: (x: N, y: N) => N;
93
93
  sub: (x: N, y: N) => N;
@@ -115,7 +115,7 @@ export declare namespace TsDataForgeInternals {
115
115
  random: (min?: ElementTypeWithSmallInt, max?: ElementTypeWithSmallInt) => ElementType;
116
116
  randomNonZero: (min?: ElementTypeWithSmallInt, max?: ElementTypeWithSmallInt) => ElementType;
117
117
  castType: <N extends number>(x: N) => ElementType & N;
118
- clamp: TypeEq<MAX_VALUE | MIN_VALUE, undefined> extends true ? undefined : (x: number) => ElementType;
118
+ fromNumber: TypeEq<MAX_VALUE | MIN_VALUE, undefined> extends true ? undefined : (x: number) => ElementType;
119
119
  }>;
120
120
  /**
121
121
  * Factory function that creates a complete set of type-safe operations for
@@ -157,7 +157,7 @@ export declare namespace TsDataForgeInternals {
157
157
  *
158
158
  * const quotient = intOps.div(six, intOps.castType(2));
159
159
  *
160
- * const roundedClamp = intOps.clamp(1.5);
160
+ * const coerced = intOps.fromNumber(1.5);
161
161
  *
162
162
  * const randomValue = intOps.random();
163
163
  *
@@ -169,7 +169,7 @@ export declare namespace TsDataForgeInternals {
169
169
  *
170
170
  * assert.isTrue(quotient === 3);
171
171
  *
172
- * assert.isTrue(roundedClamp === 2);
172
+ * assert.isTrue(coerced === 2);
173
173
  *
174
174
  * assert.isTrue(Number.isSafeInteger(randomValue));
175
175
  * ```
@@ -210,7 +210,7 @@ export declare namespace TsDataForgeInternals {
210
210
  random: (min?: ElementType, max?: ElementType) => ElementType;
211
211
  randomNonZero: (min?: ElementType, max?: ElementType) => ElementType;
212
212
  castType: <N extends number>(x: N) => ElementType & N;
213
- clamp: TypeEq<MAX_VALUE | MIN_VALUE, undefined> extends true ? undefined : (x: number) => ElementType;
213
+ fromNumber: TypeEq<MAX_VALUE | MIN_VALUE, undefined> extends true ? undefined : (x: number) => ElementType;
214
214
  }>;
215
215
  /**
216
216
  * Factory function that creates a complete set of type-safe operations for
@@ -248,7 +248,7 @@ export declare namespace TsDataForgeInternals {
248
248
  *
249
249
  * const ratio = floatOps.div(sum, floatOps.castType(10));
250
250
  *
251
- * const clamped = floatOps.clamp(0);
251
+ * const coerced = floatOps.fromNumber(0);
252
252
  *
253
253
  * const boundedRandom = floatOps.random(
254
254
  * floatOps.castType(10),
@@ -261,7 +261,7 @@ export declare namespace TsDataForgeInternals {
261
261
  *
262
262
  * assert.isTrue(ratio === 5);
263
263
  *
264
- * assert.isTrue(clamped >= Number.MIN_VALUE);
264
+ * assert.isTrue(coerced >= Number.MIN_VALUE);
265
265
  *
266
266
  * assert.isTrue(boundedRandom >= 10 && boundedRandom <= 20);
267
267
  *
@@ -1 +1 @@
1
- {"version":3,"file":"refined-number-utils.d.mts","sourceRoot":"","sources":["../../src/number/refined-number-utils.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAKvB,gBAAgB;AAChB,yBAAiB,oBAAoB,CAAC;IACpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAiB,kBAAkB,CAAC;QAclC,KAAK,kBAAkB,GAAG,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEhE;;;;;WAKG;QACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,kBAAkB,IAAI,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAEzE,KAAK,SAAS,CAAC,CAAC,SAAS,kBAAkB,IAAI,cAAc,CAC3D,CAAC,EACD,aAAa,CACd,CAAC;QAMF,KAAK,wBAAwB,CAAC,CAAC,SAAS,GAAG,IAAI,YAAY,CACzD,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CACxB,CAAC;QAEF;;;;;WAKG;QACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,kBAAkB,IACpD,KAAK,SAAS,mBAAmB,CAAC,CAAC,CAAC,GAChC,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC,GACjC,cAAc,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAE3C;;;;;;WAMG;QACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,kBAAkB,IAAI,KAAK,CACrE,iBAAiB,CAAC,CAAC,CAAC,EACpB,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAA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C,EAAE,MAAM,KAAK,WAAW,CAAC;SAChC,CAAC,CAAC;QAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAoEG;QACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,WAAW,SAAS,kBAAkB,EACtC,SAAS,SAAS,MAAM,EACxB,SAAS,SAAS,MAAM,yDAMvB,QAAQ,CAAC;YACV,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,SAAS,EAAE,SAAS,CAAC;YACrB,SAAS,EAAE,SAAS,CAAC;YACrB,iBAAiB,EAAE,MAAM,CAAC;SAC3B,CAAC,KAAG,iBAAiB,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAoFvD,CAAC;;KACH;CACF"}
1
+ {"version":3,"file":"refined-number-utils.d.mts","sourceRoot":"","sources":["../../src/number/refined-number-utils.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAKvB,gBAAgB;AAChB,yBAAiB,oBAAoB,CAAC;IACpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAiB,kBAAkB,CAAC;QAclC,KAAK,kBAAkB,GAAG,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEhE;;;;;WAKG;QACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,kBAAkB,IAAI,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAEzE,KAAK,SAAS,CAAC,CAAC,SAAS,kBAAkB,IAAI,cAAc,CAC3D,CAAC,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