ts-data-forge 14.10.1 → 14.11.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 (437) hide show
  1. package/README.md +34 -1
  2. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-reducing-value.mjs +4 -3
  4. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  5. package/dist/array/impl/array-utils-slice-clamped.mjs +1 -1
  6. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
  7. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
  8. package/dist/array/impl/array-utils-slicing.mjs +10 -3
  9. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  10. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
  11. package/dist/array/impl/array-utils-transformation.mjs +3 -3
  12. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  13. package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
  14. package/dist/array/impl/array-utils-validation.mjs +2 -1
  15. package/dist/array/impl/array-utils-validation.mjs.map +1 -1
  16. package/dist/built-in-tag.d.mts +22 -0
  17. package/dist/built-in-tag.d.mts.map +1 -0
  18. package/dist/built-in-tag.mjs +34 -0
  19. package/dist/built-in-tag.mjs.map +1 -0
  20. package/dist/collections/imap-mapped.mjs +6 -3
  21. package/dist/collections/imap-mapped.mjs.map +1 -1
  22. package/dist/collections/imap.mjs +6 -3
  23. package/dist/collections/imap.mjs.map +1 -1
  24. package/dist/collections/stack.mjs +3 -3
  25. package/dist/collections/stack.mjs.map +1 -1
  26. package/dist/iterator/range.d.mts +1 -1
  27. package/dist/iterator/range.d.mts.map +1 -1
  28. package/dist/iterator/range.mjs +5 -2
  29. package/dist/iterator/range.mjs.map +1 -1
  30. package/dist/json/json.d.mts.map +1 -1
  31. package/dist/json/json.mjs +13 -47
  32. package/dist/json/json.mjs.map +1 -1
  33. package/dist/number/branded-types/finite-number.d.mts +4 -9
  34. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  35. package/dist/number/branded-types/finite-number.mjs +9 -9
  36. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  37. package/dist/number/branded-types/int.d.mts +3 -9
  38. package/dist/number/branded-types/int.d.mts.map +1 -1
  39. package/dist/number/branded-types/int.mjs +9 -10
  40. package/dist/number/branded-types/int.mjs.map +1 -1
  41. package/dist/number/branded-types/int16.d.mts +3 -18
  42. package/dist/number/branded-types/int16.d.mts.map +1 -1
  43. package/dist/number/branded-types/int16.mjs +9 -10
  44. package/dist/number/branded-types/int16.mjs.map +1 -1
  45. package/dist/number/branded-types/int32.d.mts +3 -14
  46. package/dist/number/branded-types/int32.d.mts.map +1 -1
  47. package/dist/number/branded-types/int32.mjs +9 -10
  48. package/dist/number/branded-types/int32.mjs.map +1 -1
  49. package/dist/number/branded-types/negative-finite-number.d.mts +4 -16
  50. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  51. package/dist/number/branded-types/negative-finite-number.mjs +9 -10
  52. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  53. package/dist/number/branded-types/negative-int.d.mts +3 -16
  54. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  55. package/dist/number/branded-types/negative-int.mjs +9 -11
  56. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  57. package/dist/number/branded-types/negative-safe-int.d.mts +3 -17
  58. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  59. package/dist/number/branded-types/negative-safe-int.mjs +9 -11
  60. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  61. package/dist/number/branded-types/non-negative-finite-number.d.mts +4 -14
  62. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  63. package/dist/number/branded-types/non-negative-finite-number.mjs +9 -9
  64. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  65. package/dist/number/branded-types/non-negative-int16.d.mts +3 -19
  66. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  67. package/dist/number/branded-types/non-negative-int16.mjs +9 -10
  68. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  69. package/dist/number/branded-types/non-negative-int32.d.mts +3 -17
  70. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  71. package/dist/number/branded-types/non-negative-int32.mjs +9 -10
  72. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  73. package/dist/number/branded-types/non-positive-finite-number.d.mts +4 -14
  74. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  75. package/dist/number/branded-types/non-positive-finite-number.mjs +9 -9
  76. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  77. package/dist/number/branded-types/non-positive-int.d.mts +3 -14
  78. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  79. package/dist/number/branded-types/non-positive-int.mjs +9 -10
  80. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  81. package/dist/number/branded-types/non-positive-safe-int.d.mts +3 -15
  82. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  83. package/dist/number/branded-types/non-positive-safe-int.mjs +9 -10
  84. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  85. package/dist/number/branded-types/non-zero-finite-number.d.mts +4 -10
  86. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  87. package/dist/number/branded-types/non-zero-finite-number.mjs +9 -10
  88. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  89. package/dist/number/branded-types/non-zero-int.d.mts +3 -10
  90. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  91. package/dist/number/branded-types/non-zero-int.mjs +9 -11
  92. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  93. package/dist/number/branded-types/non-zero-int16.d.mts +3 -19
  94. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  95. package/dist/number/branded-types/non-zero-int16.mjs +12 -11
  96. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  97. package/dist/number/branded-types/non-zero-int32.d.mts +3 -15
  98. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  99. package/dist/number/branded-types/non-zero-int32.mjs +12 -11
  100. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  101. package/dist/number/branded-types/non-zero-safe-int.d.mts +6 -14
  102. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  103. package/dist/number/branded-types/non-zero-safe-int.mjs +9 -13
  104. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  105. package/dist/number/branded-types/non-zero-uint16.d.mts +3 -20
  106. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  107. package/dist/number/branded-types/non-zero-uint16.mjs +9 -11
  108. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  109. package/dist/number/branded-types/non-zero-uint32.d.mts +3 -18
  110. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  111. package/dist/number/branded-types/non-zero-uint32.mjs +9 -11
  112. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  113. package/dist/number/branded-types/positive-finite-number.d.mts +4 -16
  114. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  115. package/dist/number/branded-types/positive-finite-number.mjs +9 -9
  116. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  117. package/dist/number/branded-types/positive-int.d.mts +3 -16
  118. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  119. package/dist/number/branded-types/positive-int.mjs +9 -10
  120. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  121. package/dist/number/branded-types/positive-int16.d.mts +3 -21
  122. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  123. package/dist/number/branded-types/positive-int16.mjs +9 -10
  124. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  125. package/dist/number/branded-types/positive-int32.d.mts +3 -19
  126. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  127. package/dist/number/branded-types/positive-int32.mjs +9 -10
  128. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  129. package/dist/number/branded-types/positive-safe-int.d.mts +5 -19
  130. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  131. package/dist/number/branded-types/positive-safe-int.mjs +9 -11
  132. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  133. package/dist/number/branded-types/positive-uint16.d.mts +3 -20
  134. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  135. package/dist/number/branded-types/positive-uint16.mjs +9 -10
  136. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  137. package/dist/number/branded-types/positive-uint32.d.mts +3 -18
  138. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  139. package/dist/number/branded-types/positive-uint32.mjs +9 -10
  140. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  141. package/dist/number/branded-types/safe-int.d.mts +5 -12
  142. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  143. package/dist/number/branded-types/safe-int.mjs +9 -12
  144. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  145. package/dist/number/branded-types/safe-uint.d.mts +3 -15
  146. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  147. package/dist/number/branded-types/safe-uint.mjs +9 -11
  148. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  149. package/dist/number/branded-types/uint.d.mts +3 -14
  150. package/dist/number/branded-types/uint.d.mts.map +1 -1
  151. package/dist/number/branded-types/uint.mjs +9 -10
  152. package/dist/number/branded-types/uint.mjs.map +1 -1
  153. package/dist/number/branded-types/uint16.d.mts +3 -18
  154. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  155. package/dist/number/branded-types/uint16.mjs +9 -10
  156. package/dist/number/branded-types/uint16.mjs.map +1 -1
  157. package/dist/number/branded-types/uint32.d.mts +3 -16
  158. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  159. package/dist/number/branded-types/uint32.mjs +9 -10
  160. package/dist/number/branded-types/uint32.mjs.map +1 -1
  161. package/dist/number/enum/int8.d.mts +13 -15
  162. package/dist/number/enum/int8.d.mts.map +1 -1
  163. package/dist/number/enum/int8.mjs +20 -25
  164. package/dist/number/enum/int8.mjs.map +1 -1
  165. package/dist/number/enum/uint8.d.mts +12 -14
  166. package/dist/number/enum/uint8.d.mts.map +1 -1
  167. package/dist/number/enum/uint8.mjs +18 -23
  168. package/dist/number/enum/uint8.mjs.map +1 -1
  169. package/dist/number/index.d.mts +1 -1
  170. package/dist/number/index.d.mts.map +1 -1
  171. package/dist/number/index.mjs +1 -1
  172. package/dist/number/index.mjs.map +1 -1
  173. package/dist/number/num/impl/index.d.mts +2 -0
  174. package/dist/number/num/impl/index.d.mts.map +1 -0
  175. package/dist/number/num/impl/index.mjs +2 -0
  176. package/dist/number/num/impl/index.mjs.map +1 -0
  177. package/dist/number/num/impl/num.d.mts +531 -0
  178. package/dist/number/num/impl/num.d.mts.map +1 -0
  179. package/dist/number/num/impl/num.mjs +542 -0
  180. package/dist/number/num/impl/num.mjs.map +1 -0
  181. package/dist/number/num/index.d.mts +17 -0
  182. package/dist/number/num/index.d.mts.map +1 -0
  183. package/dist/number/num/index.mjs +17 -0
  184. package/dist/number/num/index.mjs.map +1 -0
  185. package/dist/number/operators/finite-number.d.mts +16 -0
  186. package/dist/number/operators/finite-number.d.mts.map +1 -0
  187. package/dist/number/operators/finite-number.mjs +7 -0
  188. package/dist/number/operators/finite-number.mjs.map +1 -0
  189. package/dist/number/operators/int.d.mts +16 -0
  190. package/dist/number/operators/int.d.mts.map +1 -0
  191. package/dist/number/operators/int.mjs +8 -0
  192. package/dist/number/operators/int.mjs.map +1 -0
  193. package/dist/number/operators/int16.d.mts +25 -0
  194. package/dist/number/operators/int16.d.mts.map +1 -0
  195. package/dist/number/operators/int16.mjs +8 -0
  196. package/dist/number/operators/int16.mjs.map +1 -0
  197. package/dist/number/operators/int32.d.mts +21 -0
  198. package/dist/number/operators/int32.d.mts.map +1 -0
  199. package/dist/number/operators/int32.mjs +8 -0
  200. package/dist/number/operators/int32.mjs.map +1 -0
  201. package/dist/number/operators/int8.d.mts +24 -0
  202. package/dist/number/operators/int8.d.mts.map +1 -0
  203. package/dist/number/operators/int8.mjs +8 -0
  204. package/dist/number/operators/int8.mjs.map +1 -0
  205. package/dist/number/operators/negative-finite-number.d.mts +11 -0
  206. package/dist/number/operators/negative-finite-number.d.mts.map +1 -0
  207. package/dist/number/operators/negative-finite-number.mjs +8 -0
  208. package/dist/number/operators/negative-finite-number.mjs.map +1 -0
  209. package/dist/number/operators/negative-int.d.mts +10 -0
  210. package/dist/number/operators/negative-int.d.mts.map +1 -0
  211. package/dist/number/operators/negative-int.mjs +9 -0
  212. package/dist/number/operators/negative-int.mjs.map +1 -0
  213. package/dist/number/operators/negative-safe-int.d.mts +10 -0
  214. package/dist/number/operators/negative-safe-int.d.mts.map +1 -0
  215. package/dist/number/operators/negative-safe-int.mjs +9 -0
  216. package/dist/number/operators/negative-safe-int.mjs.map +1 -0
  217. package/dist/number/operators/non-negative-finite-number.d.mts +22 -0
  218. package/dist/number/operators/non-negative-finite-number.d.mts.map +1 -0
  219. package/dist/number/operators/non-negative-finite-number.mjs +7 -0
  220. package/dist/number/operators/non-negative-finite-number.mjs.map +1 -0
  221. package/dist/number/operators/non-negative-int16.d.mts +27 -0
  222. package/dist/number/operators/non-negative-int16.d.mts.map +1 -0
  223. package/dist/number/operators/non-negative-int16.mjs +8 -0
  224. package/dist/number/operators/non-negative-int16.mjs.map +1 -0
  225. package/dist/number/operators/non-negative-int32.d.mts +25 -0
  226. package/dist/number/operators/non-negative-int32.d.mts.map +1 -0
  227. package/dist/number/operators/non-negative-int32.mjs +8 -0
  228. package/dist/number/operators/non-negative-int32.mjs.map +1 -0
  229. package/dist/number/operators/non-positive-finite-number.d.mts +11 -0
  230. package/dist/number/operators/non-positive-finite-number.d.mts.map +1 -0
  231. package/dist/number/operators/non-positive-finite-number.mjs +7 -0
  232. package/dist/number/operators/non-positive-finite-number.mjs.map +1 -0
  233. package/dist/number/operators/non-positive-int.d.mts +10 -0
  234. package/dist/number/operators/non-positive-int.d.mts.map +1 -0
  235. package/dist/number/operators/non-positive-int.mjs +8 -0
  236. package/dist/number/operators/non-positive-int.mjs.map +1 -0
  237. package/dist/number/operators/non-positive-safe-int.d.mts +10 -0
  238. package/dist/number/operators/non-positive-safe-int.d.mts.map +1 -0
  239. package/dist/number/operators/non-positive-safe-int.mjs +8 -0
  240. package/dist/number/operators/non-positive-safe-int.mjs.map +1 -0
  241. package/dist/number/operators/non-zero-finite-number.d.mts +16 -0
  242. package/dist/number/operators/non-zero-finite-number.d.mts.map +1 -0
  243. package/dist/number/operators/non-zero-finite-number.mjs +8 -0
  244. package/dist/number/operators/non-zero-finite-number.mjs.map +1 -0
  245. package/dist/number/operators/non-zero-int.d.mts +10 -0
  246. package/dist/number/operators/non-zero-int.d.mts.map +1 -0
  247. package/dist/number/operators/non-zero-int.mjs +9 -0
  248. package/dist/number/operators/non-zero-int.mjs.map +1 -0
  249. package/dist/number/operators/non-zero-int16.d.mts +10 -0
  250. package/dist/number/operators/non-zero-int16.d.mts.map +1 -0
  251. package/dist/number/operators/non-zero-int16.mjs +9 -0
  252. package/dist/number/operators/non-zero-int16.mjs.map +1 -0
  253. package/dist/number/operators/non-zero-int32.d.mts +10 -0
  254. package/dist/number/operators/non-zero-int32.d.mts.map +1 -0
  255. package/dist/number/operators/non-zero-int32.mjs +9 -0
  256. package/dist/number/operators/non-zero-int32.mjs.map +1 -0
  257. package/dist/number/operators/non-zero-safe-int.d.mts +10 -0
  258. package/dist/number/operators/non-zero-safe-int.d.mts.map +1 -0
  259. package/dist/number/operators/non-zero-safe-int.mjs +11 -0
  260. package/dist/number/operators/non-zero-safe-int.mjs.map +1 -0
  261. package/dist/number/operators/non-zero-uint16.d.mts +2 -0
  262. package/dist/number/operators/non-zero-uint16.d.mts.map +1 -0
  263. package/dist/number/operators/non-zero-uint16.mjs +9 -0
  264. package/dist/number/operators/non-zero-uint16.mjs.map +1 -0
  265. package/dist/number/operators/non-zero-uint32.d.mts +2 -0
  266. package/dist/number/operators/non-zero-uint32.d.mts.map +1 -0
  267. package/dist/number/operators/non-zero-uint32.mjs +9 -0
  268. package/dist/number/operators/non-zero-uint32.mjs.map +1 -0
  269. package/dist/number/operators/positive-finite-number.d.mts +23 -0
  270. package/dist/number/operators/positive-finite-number.d.mts.map +1 -0
  271. package/dist/number/operators/positive-finite-number.mjs +7 -0
  272. package/dist/number/operators/positive-finite-number.mjs.map +1 -0
  273. package/dist/number/operators/positive-int.d.mts +23 -0
  274. package/dist/number/operators/positive-int.d.mts.map +1 -0
  275. package/dist/number/operators/positive-int.mjs +8 -0
  276. package/dist/number/operators/positive-int.mjs.map +1 -0
  277. package/dist/number/operators/positive-int16.d.mts +28 -0
  278. package/dist/number/operators/positive-int16.d.mts.map +1 -0
  279. package/dist/number/operators/positive-int16.mjs +8 -0
  280. package/dist/number/operators/positive-int16.mjs.map +1 -0
  281. package/dist/number/operators/positive-int32.d.mts +26 -0
  282. package/dist/number/operators/positive-int32.d.mts.map +1 -0
  283. package/dist/number/operators/positive-int32.mjs +8 -0
  284. package/dist/number/operators/positive-int32.mjs.map +1 -0
  285. package/dist/number/operators/positive-safe-int.d.mts +24 -0
  286. package/dist/number/operators/positive-safe-int.d.mts.map +1 -0
  287. package/dist/number/operators/positive-safe-int.mjs +9 -0
  288. package/dist/number/operators/positive-safe-int.mjs.map +1 -0
  289. package/dist/number/operators/positive-uint16.d.mts +27 -0
  290. package/dist/number/operators/positive-uint16.d.mts.map +1 -0
  291. package/dist/number/operators/positive-uint16.mjs +8 -0
  292. package/dist/number/operators/positive-uint16.mjs.map +1 -0
  293. package/dist/number/operators/positive-uint32.d.mts +25 -0
  294. package/dist/number/operators/positive-uint32.d.mts.map +1 -0
  295. package/dist/number/operators/positive-uint32.mjs +8 -0
  296. package/dist/number/operators/positive-uint32.mjs.map +1 -0
  297. package/dist/number/operators/safe-int.d.mts +17 -0
  298. package/dist/number/operators/safe-int.d.mts.map +1 -0
  299. package/dist/number/operators/safe-int.mjs +10 -0
  300. package/dist/number/operators/safe-int.mjs.map +1 -0
  301. package/dist/number/operators/safe-uint.d.mts +22 -0
  302. package/dist/number/operators/safe-uint.d.mts.map +1 -0
  303. package/dist/number/operators/safe-uint.mjs +9 -0
  304. package/dist/number/operators/safe-uint.mjs.map +1 -0
  305. package/dist/number/operators/uint.d.mts +14 -0
  306. package/dist/number/operators/uint.d.mts.map +1 -0
  307. package/dist/number/operators/uint.mjs +8 -0
  308. package/dist/number/operators/uint.mjs.map +1 -0
  309. package/dist/number/operators/uint16.d.mts +25 -0
  310. package/dist/number/operators/uint16.d.mts.map +1 -0
  311. package/dist/number/operators/uint16.mjs +8 -0
  312. package/dist/number/operators/uint16.mjs.map +1 -0
  313. package/dist/number/operators/uint32.d.mts +23 -0
  314. package/dist/number/operators/uint32.d.mts.map +1 -0
  315. package/dist/number/operators/uint32.mjs +8 -0
  316. package/dist/number/operators/uint32.mjs.map +1 -0
  317. package/dist/number/operators/uint8.d.mts +24 -0
  318. package/dist/number/operators/uint8.d.mts.map +1 -0
  319. package/dist/number/operators/uint8.mjs +8 -0
  320. package/dist/number/operators/uint8.mjs.map +1 -0
  321. package/dist/number/refined-number-utils.d.mts +2 -2
  322. package/dist/number/refined-number-utils.d.mts.map +1 -1
  323. package/dist/number/refined-number-utils.mjs +1 -1
  324. package/dist/number/refined-number-utils.mjs.map +1 -1
  325. package/dist/object/object.d.mts +8 -0
  326. package/dist/object/object.d.mts.map +1 -1
  327. package/dist/object/object.mjs +17 -5
  328. package/dist/object/object.mjs.map +1 -1
  329. package/dist/others/fast-deep-equal.mjs +1 -1
  330. package/dist/others/fast-deep-equal.mjs.map +1 -1
  331. package/dist/others/replace-equal-deep.mjs +10 -3
  332. package/dist/others/replace-equal-deep.mjs.map +1 -1
  333. package/package.json +22 -9
  334. package/src/array/impl/array-utils-reducing-value.mts +4 -3
  335. package/src/array/impl/array-utils-shape-invariants.test.mts +1 -1
  336. package/src/array/impl/array-utils-slice-clamped.mts +1 -1
  337. package/src/array/impl/array-utils-slicing.mts +12 -3
  338. package/src/array/impl/array-utils-transformation.mts +7 -3
  339. package/src/array/impl/array-utils-transformation.test.mts +52 -3
  340. package/src/array/impl/array-utils-validation.mts +2 -1
  341. package/src/built-in-tag.mts +59 -0
  342. package/src/built-in-tag.test.mts +215 -0
  343. package/src/collections/imap-mapped.mts +6 -4
  344. package/src/collections/imap-mapped.test.mts +27 -0
  345. package/src/collections/imap.mts +6 -4
  346. package/src/collections/imap.test.mts +13 -0
  347. package/src/collections/stack.mts +3 -3
  348. package/src/iterator/range.mts +10 -2
  349. package/src/iterator/range.test.mts +7 -0
  350. package/src/json/json.mts +17 -57
  351. package/src/json/json.test.mts +32 -0
  352. package/src/number/branded-types/finite-number.mts +23 -25
  353. package/src/number/branded-types/int.mts +20 -26
  354. package/src/number/branded-types/int16.mts +21 -26
  355. package/src/number/branded-types/int32.mts +21 -26
  356. package/src/number/branded-types/negative-finite-number.mts +25 -26
  357. package/src/number/branded-types/negative-int.mts +20 -27
  358. package/src/number/branded-types/negative-safe-int.mts +23 -28
  359. package/src/number/branded-types/non-negative-finite-number.mts +24 -25
  360. package/src/number/branded-types/non-negative-int16.mts +23 -26
  361. package/src/number/branded-types/non-negative-int32.mts +23 -26
  362. package/src/number/branded-types/non-positive-finite-number.mts +24 -25
  363. package/src/number/branded-types/non-positive-int.mts +20 -26
  364. package/src/number/branded-types/non-positive-safe-int.mts +21 -26
  365. package/src/number/branded-types/non-zero-finite-number.mts +23 -25
  366. package/src/number/branded-types/non-zero-int.mts +19 -25
  367. package/src/number/branded-types/non-zero-int16.mts +27 -28
  368. package/src/number/branded-types/non-zero-int32.mts +27 -28
  369. package/src/number/branded-types/non-zero-safe-int.mts +25 -35
  370. package/src/number/branded-types/non-zero-uint16.mts +24 -28
  371. package/src/number/branded-types/non-zero-uint32.mts +24 -28
  372. package/src/number/branded-types/positive-finite-number.mts +25 -25
  373. package/src/number/branded-types/positive-int.mts +21 -26
  374. package/src/number/branded-types/positive-int16.mts +23 -26
  375. package/src/number/branded-types/positive-int32.mts +23 -26
  376. package/src/number/branded-types/positive-safe-int.mts +24 -31
  377. package/src/number/branded-types/positive-uint16.mts +23 -26
  378. package/src/number/branded-types/positive-uint32.mts +23 -26
  379. package/src/number/branded-types/safe-int.mts +22 -29
  380. package/src/number/branded-types/safe-uint.mts +21 -27
  381. package/src/number/branded-types/uint.mts +21 -26
  382. package/src/number/branded-types/uint16.mts +21 -26
  383. package/src/number/branded-types/uint32.mts +21 -26
  384. package/src/number/enum/int8.mts +40 -52
  385. package/src/number/enum/uint8.mts +40 -48
  386. package/src/number/index.mts +1 -1
  387. package/src/number/num/impl/index.mts +1 -0
  388. package/src/number/num/impl/num.mts +715 -0
  389. package/src/number/{num.test.mts → num/impl/num.test.mts} +17 -5
  390. package/src/number/num/index.mts +16 -0
  391. package/src/number/num-arithmetic.test.mts +1 -1
  392. package/src/number/operators/finite-number.mts +20 -0
  393. package/src/number/operators/int.mts +20 -0
  394. package/src/number/operators/int16.mts +33 -0
  395. package/src/number/operators/int32.mts +33 -0
  396. package/src/number/operators/int8.mts +18 -0
  397. package/src/number/operators/negative-finite-number.mts +22 -0
  398. package/src/number/operators/negative-int.mts +22 -0
  399. package/src/number/operators/negative-safe-int.mts +32 -0
  400. package/src/number/operators/non-negative-finite-number.mts +32 -0
  401. package/src/number/operators/non-negative-int16.mts +33 -0
  402. package/src/number/operators/non-negative-int32.mts +33 -0
  403. package/src/number/operators/non-positive-finite-number.mts +21 -0
  404. package/src/number/operators/non-positive-int.mts +21 -0
  405. package/src/number/operators/non-positive-safe-int.mts +31 -0
  406. package/src/number/operators/non-zero-finite-number.mts +21 -0
  407. package/src/number/operators/non-zero-int.mts +22 -0
  408. package/src/number/operators/non-zero-int16.mts +32 -0
  409. package/src/number/operators/non-zero-int32.mts +32 -0
  410. package/src/number/operators/non-zero-safe-int.mts +34 -0
  411. package/src/number/operators/non-zero-uint16.mts +32 -0
  412. package/src/number/operators/non-zero-uint32.mts +32 -0
  413. package/src/number/operators/positive-finite-number.mts +32 -0
  414. package/src/number/operators/positive-int.mts +32 -0
  415. package/src/number/operators/positive-int16.mts +33 -0
  416. package/src/number/operators/positive-int32.mts +33 -0
  417. package/src/number/operators/positive-safe-int.mts +34 -0
  418. package/src/number/operators/positive-uint16.mts +33 -0
  419. package/src/number/operators/positive-uint32.mts +33 -0
  420. package/src/number/operators/safe-int.mts +35 -0
  421. package/src/number/operators/safe-uint.mts +33 -0
  422. package/src/number/operators/uint.mts +31 -0
  423. package/src/number/operators/uint16.mts +32 -0
  424. package/src/number/operators/uint32.mts +32 -0
  425. package/src/number/operators/uint8.mts +16 -0
  426. package/src/number/refined-number-utils.mts +4 -4
  427. package/src/object/object.mts +33 -5
  428. package/src/object/object.test.mts +55 -0
  429. package/src/others/fast-deep-equal.mts +1 -1
  430. package/src/others/replace-equal-deep.mts +11 -4
  431. package/src/others/replace-equal-deep.test.mts +26 -0
  432. package/dist/number/num.d.mts +0 -546
  433. package/dist/number/num.d.mts.map +0 -1
  434. package/dist/number/num.mjs +0 -559
  435. package/dist/number/num.mjs.map +0 -1
  436. package/src/guard/is-error.test.mts +0 -145
  437. package/src/number/num.mts +0 -731
@@ -1,4 +1,4 @@
1
- import type { SafeInt, SafeUint, NonZeroSafeInt as TtfImported_NonZeroSafeInt } from 'ts-type-forge';
1
+ import type { NonZeroSafeInt as TtfImported_NonZeroSafeInt } from 'ts-type-forge';
2
2
  export type NonZeroSafeInt = TtfImported_NonZeroSafeInt;
3
3
  /**
4
4
  * Type guard that checks if a value is a non-zero safe integer.
@@ -9,7 +9,7 @@ export type NonZeroSafeInt = TtfImported_NonZeroSafeInt;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-zero safe integer, `false` otherwise
11
11
  */
12
- export declare const isNonZeroSafeInt: (a: number) => a is TtfImported_NonZeroSafeInt;
12
+ export declare const isNonZeroSafeInt: (value: number) => value is NonZeroSafeInt;
13
13
  /**
14
14
  * Casts a `number` to the `NonZeroSafeInt` branded type.
15
15
  *
@@ -20,15 +20,7 @@ export declare const isNonZeroSafeInt: (a: number) => a is TtfImported_NonZeroSa
20
20
  * @returns The value as a `NonZeroSafeInt`
21
21
  * @throws {TypeError} If the value is not a non-zero safe integer
22
22
  */
23
- export declare const asNonZeroSafeInt: <N extends number>(x: N) => number & {
24
- readonly "!=0": true;
25
- readonly Finite: true;
26
- readonly Int: true;
27
- readonly NaNValue: false;
28
- readonly SafeInt: true;
29
- } & Readonly<{
30
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
31
- }> & N;
23
+ export declare const asNonZeroSafeInt: <N extends number>(value: N) => NonZeroSafeInt & N;
32
24
  /**
33
25
  * Namespace providing type-safe operations for the `NonZeroSafeInt` branded
34
26
  * type.
@@ -44,17 +36,17 @@ export declare const NonZeroSafeInt: {
44
36
  * @returns `true` if the value is a non-zero safe integer, `false` otherwise
45
37
  * @see {@link isNonZeroSafeInt} for usage examples
46
38
  */
47
- readonly is: (a: number) => a is TtfImported_NonZeroSafeInt;
39
+ readonly is: typeof isNonZeroSafeInt;
48
40
  /**
49
41
  * The smallest value representable as `NonZeroSafeInt` (the lower saturation
50
42
  * target of `fromNumber`).
51
43
  */
52
- readonly MIN_VALUE: SafeInt;
44
+ readonly MIN_VALUE: import("ts-type-forge").SafeInt;
53
45
  /**
54
46
  * The largest value representable as `NonZeroSafeInt` (the upper saturation
55
47
  * target of `fromNumber`).
56
48
  */
57
- readonly MAX_VALUE: SafeUint;
49
+ readonly MAX_VALUE: import("ts-type-forge").SafeUint;
58
50
  /**
59
51
  * Returns the absolute value of a non-zero safe integer.
60
52
  *
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,QAAQ,EACR,cAAc,IAAI,0BAA0B,EAC7C,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAgCxD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,gDAAK,CAAC;AAEnC;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;MAAW,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAelF,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAMxD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,KAAK,IAAI,cACd,CAAC;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,SACxC,CAAC,KACP,cAAc,GAAG,CAMnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
@@ -1,15 +1,8 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { MAX_VALUE, MIN_VALUE, abs, fromNumber, max as max_, min as min_, mul, pow, randomNonZero as random, } from '../operators/non-zero-safe-int.mjs';
3
3
  const typeNameInMessage = 'a non-zero safe integer';
4
- const { MAX_VALUE, MIN_VALUE, abs, castType, fromNumber, is, max: max_, min: min_, mul, pow, randomNonZero: random, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
- integerOrSafeInteger: 'SafeInteger',
6
- nonZero: true,
7
4
 
8
- MIN_VALUE: Number.MIN_SAFE_INTEGER,
9
5
 
10
- MAX_VALUE: Number.MAX_SAFE_INTEGER,
11
- typeNameInMessage,
12
- });
13
6
 
14
7
 
15
8
 
@@ -17,9 +10,9 @@ const { MAX_VALUE, MIN_VALUE, abs, castType, fromNumber, is, max: max_, min: min
17
10
 
18
11
 
19
12
 
13
+ export const isNonZeroSafeInt = (value) => Number.isSafeInteger(value) && value !== 0;
20
14
 
21
15
 
22
- export const isNonZeroSafeInt = is;
23
16
 
24
17
 
25
18
 
@@ -28,9 +21,12 @@ export const isNonZeroSafeInt = is;
28
21
 
29
22
 
30
23
 
31
-
32
-
33
- export const asNonZeroSafeInt = castType;
24
+ export const asNonZeroSafeInt = (value) => {
25
+ if (!isNonZeroSafeInt(value)) {
26
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
27
+ }
28
+ return value;
29
+ };
34
30
 
35
31
 
36
32
 
@@ -46,7 +42,7 @@ export const NonZeroSafeInt = {
46
42
 
47
43
 
48
44
 
49
- is,
45
+ is: isNonZeroSafeInt,
50
46
 
51
47
 
52
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-safe-int.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,GACtB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;IACA,oBAAoB,EAAE,aAAa;IACnC,OAAO,EAAE,IAAI;IACb,yGAAyG;IACzG,SAAS,EAAE,MAAM,CAAC,gBAA2B;IAC7C,yGAAyG;IACzG,SAAS,EAAE,MAAM,CAAC,gBAA4B;IAC9C,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;;;;;OAMG;IACH,EAAE;IAEF;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-zero-safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-safe-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,aAAa,IAAI,MAAM,GACxB,MAAM,oCAAoC,CAAC;AAO5C,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA2B,EAAE,CACzE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAQ,EACY,EAAE;IACtB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;;;;;OAMG;IACH,EAAE,EAAE,gBAAgB;IAEpB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type NonZeroUint16 = TtfImported_NonZeroUint16;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-zero integer in [1, 2^16), `false` otherwise
11
11
  */
12
- export declare const isNonZeroUint16: (a: number) => a is import("ts-type-forge").PositiveUint16;
12
+ export declare const isNonZeroUint16: (value: number) => value is NonZeroUint16;
13
13
  /**
14
14
  * Casts a `number` to the `NonZeroUint16` branded type.
15
15
  *
@@ -20,24 +20,7 @@ export declare const isNonZeroUint16: (a: number) => a is import("ts-type-forge"
20
20
  * @returns The value as a `NonZeroUint16`
21
21
  * @throws {TypeError} If the value is not a non-zero integer in [1, 2^16)
22
22
  */
23
- export declare const asNonZeroUint16: <N extends number>(x: N) => number & {
24
- readonly "!=0": true;
25
- readonly "< 2^16": true;
26
- readonly "< 2^31": true;
27
- readonly "< 2^32": true;
28
- readonly "<=0": false;
29
- readonly "> -2^16": true;
30
- readonly "> -2^32": true;
31
- readonly ">= -2^15": true;
32
- readonly ">= -2^31": true;
33
- readonly ">=0": true;
34
- readonly Finite: true;
35
- readonly Int: true;
36
- readonly NaNValue: false;
37
- readonly SafeInt: true;
38
- } & Readonly<{
39
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
40
- }> & N;
23
+ export declare const asNonZeroUint16: <N extends number>(value: N) => NonZeroUint16 & N;
41
24
  /**
42
25
  * Namespace providing type-safe operations for the `NonZeroUint16` branded
43
26
  * type.
@@ -53,7 +36,7 @@ export declare const NonZeroUint16: {
53
36
  * @returns `true` if the value is a non-zero integer in [1, 2^16), `false` otherwise
54
37
  * @see {@link isNonZeroUint16} for usage examples
55
38
  */
56
- readonly is: (a: number) => a is import("ts-type-forge").PositiveUint16;
39
+ readonly is: typeof isNonZeroUint16;
57
40
  /**
58
41
  * The smallest value representable as `NonZeroUint16` (the lower saturation
59
42
  * target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-uint16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAIhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AA8BtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,4DAAK,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;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-uint16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAehF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAMtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,UAAW,MAAM,KAAG,KAAK,IAAI,aACU,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,SACvC,CAAC,KACP,aAAa,GAAG,CAMlB,CAAC;AAEF;;;;;;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;;CAEK,CAAC"}
@@ -1,13 +1,6 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { MAX_VALUE, MIN_VALUE, add, fromNumber, max as max_, min as min_, mul, pow, randomNonZero as random, } from '../operators/non-zero-uint16.mjs';
3
3
  const typeNameInMessage = 'a non-zero integer in [1, 2^16)';
4
- const { MAX_VALUE, MIN_VALUE, add, castType, fromNumber, is, max: max_, min: min_, mul, pow, randomNonZero: random, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
- integerOrSafeInteger: 'SafeInteger',
6
- nonZero: true,
7
- MIN_VALUE: 1,
8
- MAX_VALUE: 2 ** 16 - 1,
9
- typeNameInMessage,
10
- });
11
4
 
12
5
 
13
6
 
@@ -17,7 +10,7 @@ const { MAX_VALUE, MIN_VALUE, add, castType, fromNumber, is, max: max_, min: min
17
10
 
18
11
 
19
12
 
20
- export const isNonZeroUint16 = is;
13
+ export const isNonZeroUint16 = (value) => Number.isSafeInteger(value) && 1 <= value && value <= 2 ** 16 - 1;
21
14
 
22
15
 
23
16
 
@@ -28,7 +21,12 @@ export const isNonZeroUint16 = is;
28
21
 
29
22
 
30
23
 
31
- export const asNonZeroUint16 = castType;
24
+ export const asNonZeroUint16 = (value) => {
25
+ if (!isNonZeroUint16(value)) {
26
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
27
+ }
28
+ return value;
29
+ };
32
30
 
33
31
 
34
32
 
@@ -44,7 +42,7 @@ export const NonZeroUint16 = {
44
42
 
45
43
 
46
44
 
47
- is,
45
+ is: isNonZeroUint16,
48
46
 
49
47
 
50
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-uint16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,GACtB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;IACA,oBAAoB,EAAE,aAAa;IACnC,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;;;;OAMG;IACH,EAAE;IAEF;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-zero-uint16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,aAAa,IAAI,MAAM,GACxB,MAAM,kCAAkC,CAAC;AAO1C,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAA0B,EAAE,CACvE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAQ,EACW,EAAE;IACrB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;;;;OAMG;IACH,EAAE,EAAE,eAAe;IAEnB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type NonZeroUint32 = TtfImported_NonZeroUint32;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-zero integer in [1, 2^32), `false` otherwise
11
11
  */
12
- export declare const isNonZeroUint32: (a: number) => a is import("ts-type-forge").PositiveUint32;
12
+ export declare const isNonZeroUint32: (value: number) => value is NonZeroUint32;
13
13
  /**
14
14
  * Casts a `number` to the `NonZeroUint32` branded type.
15
15
  *
@@ -20,22 +20,7 @@ export declare const isNonZeroUint32: (a: number) => a is import("ts-type-forge"
20
20
  * @returns The value as a `NonZeroUint32`
21
21
  * @throws {TypeError} If the value is not a non-zero integer in [1, 2^32)
22
22
  */
23
- export declare const asNonZeroUint32: <N extends number>(x: N) => number & {
24
- readonly "!=0": true;
25
- readonly "< 2^32": true;
26
- readonly "<=0": false;
27
- readonly "> -2^16": true;
28
- readonly "> -2^32": true;
29
- readonly ">= -2^15": true;
30
- readonly ">= -2^31": true;
31
- readonly ">=0": true;
32
- readonly Finite: true;
33
- readonly Int: true;
34
- readonly NaNValue: false;
35
- readonly SafeInt: true;
36
- } & Readonly<{
37
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
38
- }> & N;
23
+ export declare const asNonZeroUint32: <N extends number>(value: N) => NonZeroUint32 & N;
39
24
  /**
40
25
  * Namespace providing type-safe operations for the `NonZeroUint32` branded
41
26
  * type.
@@ -51,7 +36,7 @@ export declare const NonZeroUint32: {
51
36
  * @returns `true` if the value is a non-zero integer in [1, 2^32), `false` otherwise
52
37
  * @see {@link isNonZeroUint32} for usage examples
53
38
  */
54
- readonly is: (a: number) => a is import("ts-type-forge").PositiveUint32;
39
+ readonly is: typeof isNonZeroUint32;
55
40
  /**
56
41
  * The smallest value representable as `NonZeroUint32` (the lower saturation
57
42
  * target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAIhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AA8BtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,4DAAK,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;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAehF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAMtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,UAAW,MAAM,KAAG,KAAK,IAAI,aACU,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,SACvC,CAAC,KACP,aAAa,GAAG,CAMlB,CAAC;AAEF;;;;;;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;;CAEK,CAAC"}
@@ -1,13 +1,6 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { MAX_VALUE, MIN_VALUE, add, fromNumber, max as max_, min as min_, mul, pow, randomNonZero as random, } from '../operators/non-zero-uint32.mjs';
3
3
  const typeNameInMessage = 'a non-zero integer in [1, 2^32)';
4
- const { MAX_VALUE, MIN_VALUE, add, castType, fromNumber, is, max: max_, min: min_, mul, pow, randomNonZero: random, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
- integerOrSafeInteger: 'SafeInteger',
6
- nonZero: true,
7
- MIN_VALUE: 1,
8
- MAX_VALUE: 2 ** 32 - 1,
9
- typeNameInMessage,
10
- });
11
4
 
12
5
 
13
6
 
@@ -17,7 +10,7 @@ const { MAX_VALUE, MIN_VALUE, add, castType, fromNumber, is, max: max_, min: min
17
10
 
18
11
 
19
12
 
20
- export const isNonZeroUint32 = is;
13
+ export const isNonZeroUint32 = (value) => Number.isSafeInteger(value) && 1 <= value && value <= 2 ** 32 - 1;
21
14
 
22
15
 
23
16
 
@@ -28,7 +21,12 @@ export const isNonZeroUint32 = is;
28
21
 
29
22
 
30
23
 
31
- export const asNonZeroUint32 = castType;
24
+ export const asNonZeroUint32 = (value) => {
25
+ if (!isNonZeroUint32(value)) {
26
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
27
+ }
28
+ return value;
29
+ };
32
30
 
33
31
 
34
32
 
@@ -44,7 +42,7 @@ export const NonZeroUint32 = {
44
42
 
45
43
 
46
44
 
47
- is,
45
+ is: isNonZeroUint32,
48
46
 
49
47
 
50
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-uint32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,GACtB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;IACA,oBAAoB,EAAE,aAAa;IACnC,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;;;;OAMG;IACH,EAAE;IAEF;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-zero-uint32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-uint32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,aAAa,IAAI,MAAM,GACxB,MAAM,kCAAkC,CAAC;AAO1C,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAA0B,EAAE,CACvE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAQ,EACW,EAAE;IACrB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;;;;OAMG;IACH,EAAE,EAAE,eAAe;IAEnB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { PositiveFiniteNumber as TtfImported_PositiveFiniteNumber } from 'ts-type-forge';
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import type { TsDataForgeInternals } from '../refined-number-utils.mjs';
3
3
  export type PositiveFiniteNumber = TtfImported_PositiveFiniteNumber;
4
4
  type ElementType = PositiveFiniteNumber;
5
5
  declare const floor: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>>;
@@ -14,7 +14,7 @@ declare const round: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils
14
14
  * @param value - The value to check
15
15
  * @returns `true` if the value is a positive finite number, `false` otherwise
16
16
  */
17
- export declare const isPositiveFiniteNumber: (a: number) => a is TtfImported_PositiveFiniteNumber;
17
+ export declare const isPositiveFiniteNumber: (value: number) => value is PositiveFiniteNumber;
18
18
  /**
19
19
  * Casts a `number` to the `PositiveFiniteNumber` branded type.
20
20
  *
@@ -25,19 +25,7 @@ export declare const isPositiveFiniteNumber: (a: number) => a is TtfImported_Pos
25
25
  * @returns The value as a `PositiveFiniteNumber`
26
26
  * @throws {TypeError} If the value is not a positive finite number
27
27
  */
28
- export declare const asPositiveFiniteNumber: <N extends number>(x: N) => number & {
29
- readonly "!=0": true;
30
- readonly "<=0": false;
31
- readonly "> -2^16": true;
32
- readonly "> -2^32": true;
33
- readonly ">= -2^15": true;
34
- readonly ">= -2^31": true;
35
- readonly ">=0": true;
36
- readonly Finite: true;
37
- readonly NaNValue: false;
38
- } & Readonly<{
39
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
40
- }> & N;
28
+ export declare const asPositiveFiniteNumber: <N extends number>(value: N) => PositiveFiniteNumber & N;
41
29
  /**
42
30
  * Namespace providing type-safe operations for the `PositiveFiniteNumber`
43
31
  * branded type.
@@ -52,7 +40,7 @@ export declare const PositiveFiniteNumber: {
52
40
  * @returns `true` if the value is a positive finite number, `false` otherwise
53
41
  * @see {@link isPositiveFiniteNumber} for usage examples
54
42
  */
55
- readonly is: (a: number) => a is TtfImported_PositiveFiniteNumber;
43
+ readonly is: typeof isPositiveFiniteNumber;
56
44
  /**
57
45
  * The smallest value representable as `PositiveFiniteNumber` (the lower
58
46
  * saturation target of `fromNumber`). The domain is open at `0` (excluded),
@@ -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,KAAK,EAEV,oBAAoB,IAAI,gCAAgC,EAEzD,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;AA2BxC,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAEJ,QAAA,MAAM,IAAI,MACL,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEgB,CAAC;AAE7E,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAcJ;;;;;;;;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;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;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,KAAK,EAEV,oBAAoB,IAAI,gCAAgC,EAEzD,MAAM,eAAe,CAAC;AAcvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;AAIxC,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAEJ,QAAA,MAAM,IAAI,MACL,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEgB,CAAC;AAE7E,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAcJ;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,UAC1B,MAAM,KACZ,KAAK,IAAI,oBACyC,CAAC;AAEtD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,MAAM,SAC9C,CAAC,KACP,oBAAoB,GAAG,CAMzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;CAEK,CAAC"}
@@ -1,11 +1,6 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { MIN_VALUE, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/positive-finite-number.mjs';
3
3
  const typeNameInMessage = 'a positive finite number';
4
- const { MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
5
- MIN_VALUE: Number.MIN_VALUE,
6
- MAX_VALUE: Number.MAX_VALUE,
7
- typeNameInMessage,
8
- });
9
4
  const floor = (x) =>
10
5
 
11
6
  Math.floor(x);
@@ -26,7 +21,7 @@ Math.round(x);
26
21
 
27
22
 
28
23
 
29
- export const isPositiveFiniteNumber = is;
24
+ export const isPositiveFiniteNumber = (value) => Number.isFinite(value) && value >= Number.MIN_VALUE;
30
25
 
31
26
 
32
27
 
@@ -37,7 +32,12 @@ export const isPositiveFiniteNumber = is;
37
32
 
38
33
 
39
34
 
40
- export const asPositiveFiniteNumber = castType;
35
+ export const asPositiveFiniteNumber = (value) => {
36
+ if (!isPositiveFiniteNumber(value)) {
37
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
38
+ }
39
+ return value;
40
+ };
41
41
 
42
42
 
43
43
 
@@ -52,7 +52,7 @@ export const PositiveFiniteNumber = {
52
52
 
53
53
 
54
54
 
55
- is,
55
+ is: isPositiveFiniteNumber,
56
56
 
57
57
 
58
58
 
@@ -1 +1 @@
1
- {"version":3,"file":"positive-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD,MAAM,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,GAAG,EACH,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,iBAAiB,CAI3D;IACA,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;CACT,CAAC,CAAC;AAEZ,MAAM,KAAK,GAAG,CACZ,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,KAAK,CACR,CAAC,CAGF,CAAC;AAEJ,MAAM,IAAI,GAAG,CACX,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAA+D,CAAC;AAE7E,MAAM,KAAK,GAAG,CACZ,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,KAAK,CACR,CAAC,CAGF,CAAC;AAEJ,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAKR,GAAG,CAAC,CAAC;AAEP;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC;;;;;;OAMG;IACH,EAAE;IAEF;;;;;OAKG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;OAMG;IACH,IAAI;IAEJ;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"positive-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,GAAG,EACH,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,yCAAyC,CAAC;AAOjD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD,MAAM,KAAK,GAAG,CACZ,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,KAAK,CACR,CAAC,CAGF,CAAC;AAEJ,MAAM,IAAI,GAAG,CACX,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAA+D,CAAC;AAE7E,MAAM,KAAK,GAAG,CACZ,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,KAAK,CACR,CAAC,CAGF,CAAC;AAEJ,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAKR,GAAG,CAAC,CAAC;AAEP;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAa,EACkB,EAAE,CACjC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAQ,EACkB,EAAE;IAC5B,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC;;;;;;OAMG;IACH,EAAE,EAAE,sBAAsB;IAE1B;;;;;OAKG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;IACH,UAAU;IAEV;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;OAMG;IACH,IAAI;IAEJ;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,IAAI,CAAC,CAAC"}
@@ -19,7 +19,7 @@ export type PositiveInt = TtfImported_PositiveInt;
19
19
  * @param value - The value to check
20
20
  * @returns `true` if the value is a positive integer, `false` otherwise
21
21
  */
22
- export declare const isPositiveInt: (a: number) => a is TtfImported_PositiveInt;
22
+ export declare const isPositiveInt: (value: number) => value is PositiveInt;
23
23
  /**
24
24
  * Casts a `number` to the `PositiveInt` branded type.
25
25
  *
@@ -40,20 +40,7 @@ export declare const isPositiveInt: (a: number) => a is TtfImported_PositiveInt;
40
40
  * @returns The value as a `PositiveInt`
41
41
  * @throws {TypeError} If the value is not a positive integer
42
42
  */
43
- export declare const asPositiveInt: <N extends number>(x: N) => number & {
44
- readonly "!=0": true;
45
- readonly "<=0": false;
46
- readonly "> -2^16": true;
47
- readonly "> -2^32": true;
48
- readonly ">= -2^15": true;
49
- readonly ">= -2^31": true;
50
- readonly ">=0": true;
51
- readonly Finite: true;
52
- readonly Int: true;
53
- readonly NaNValue: false;
54
- } & Readonly<{
55
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
56
- }> & N;
43
+ export declare const asPositiveInt: <N extends number>(value: N) => PositiveInt & N;
57
44
  /**
58
45
  * Namespace providing type-safe operations for the `PositiveInt` branded type.
59
46
  *
@@ -82,7 +69,7 @@ export declare const PositiveInt: {
82
69
  * @returns `true` if the value is a positive integer, `false` otherwise
83
70
  * @see {@link isPositiveInt} for usage examples
84
71
  */
85
- readonly is: (a: number) => a is TtfImported_PositiveInt;
72
+ readonly is: typeof isPositiveInt;
86
73
  /**
87
74
  * The smallest value representable as `PositiveInt` (the lower saturation
88
75
  * target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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"}
1
+ {"version":3,"file":"positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAgB5E,MAAM,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAMlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,KAAK,IAAI,WAChB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,WAAW,GAAG,CAMxE,CAAC;AAEF;;;;;;;;;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"}
@@ -1,12 +1,6 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { MIN_VALUE, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/positive-int.mjs';
3
3
  const typeNameInMessage = 'a positive integer';
4
- const { MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
- integerOrSafeInteger: 'Integer',
6
- MIN_VALUE: 1,
7
- MAX_VALUE: Number.MAX_VALUE,
8
- typeNameInMessage,
9
- });
10
4
 
11
5
 
12
6
 
@@ -26,7 +20,7 @@ const { MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul
26
20
 
27
21
 
28
22
 
29
- export const isPositiveInt = is;
23
+ export const isPositiveInt = (value) => Number.isInteger(value) && value >= 1;
30
24
 
31
25
 
32
26
 
@@ -47,7 +41,12 @@ export const isPositiveInt = is;
47
41
 
48
42
 
49
43
 
50
- export const asPositiveInt = castType;
44
+ export const asPositiveInt = (value) => {
45
+ if (!isPositiveInt(value)) {
46
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
47
+ }
48
+ return value;
49
+ };
51
50
 
52
51
 
53
52
 
@@ -76,7 +75,7 @@ export const PositiveInt = {
76
75
 
77
76
 
78
77
 
79
- is,
78
+ is: isPositiveInt,
80
79
 
81
80
 
82
81
 
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C,MAAM,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,GAAG,EACH,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;IACA,oBAAoB,EAAE,SAAS;IAC/B,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;;;;;;;;;;;;;;;;OAgBG;IACH,EAAE;IAEF;;;OAGG;IACH,SAAS;IAET;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,UAAU;IAEV;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM;IAEN;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"positive-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,GAAG,EACH,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,+BAA+B,CAAC;AAOvC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAwB,EAAE,CACnE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAmB,KAAQ,EAAmB,EAAE;IAC3E,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;;;;;;;;;;;;;;;;OAgBG;IACH,EAAE,EAAE,aAAa;IAEjB;;;OAGG;IACH,SAAS;IAET;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,UAAU;IAEV;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM;IAEN;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type PositiveInt16 = TtfImported_PositiveInt16;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a positive integer in [1, 2^15), `false` otherwise
11
11
  */
12
- export declare const isPositiveInt16: (a: number) => a is TtfImported_PositiveInt16;
12
+ export declare const isPositiveInt16: (value: number) => value is PositiveInt16;
13
13
  /**
14
14
  * Casts a `number` to the `PositiveInt16` branded type.
15
15
  *
@@ -20,25 +20,7 @@ export declare const isPositiveInt16: (a: number) => a is TtfImported_PositiveIn
20
20
  * @returns The value as a `PositiveInt16`
21
21
  * @throws {TypeError} If the value is not a positive integer in [1, 2^15)
22
22
  */
23
- export declare const asPositiveInt16: <N extends number>(x: N) => number & {
24
- readonly "!=0": true;
25
- readonly "< 2^15": true;
26
- readonly "< 2^16": true;
27
- readonly "< 2^31": true;
28
- readonly "< 2^32": true;
29
- readonly "<=0": false;
30
- readonly "> -2^16": true;
31
- readonly "> -2^32": true;
32
- readonly ">= -2^15": true;
33
- readonly ">= -2^31": true;
34
- readonly ">=0": true;
35
- readonly Finite: true;
36
- readonly Int: true;
37
- readonly NaNValue: false;
38
- readonly SafeInt: true;
39
- } & Readonly<{
40
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
41
- }> & N;
23
+ export declare const asPositiveInt16: <N extends number>(value: N) => PositiveInt16 & N;
42
24
  /**
43
25
  * Namespace providing type-safe operations for the `PositiveInt16` branded
44
26
  * type.
@@ -54,7 +36,7 @@ export declare const PositiveInt16: {
54
36
  * @returns `true` if the value is a positive integer in [1, 2^15), `false` otherwise
55
37
  * @see {@link isPositiveInt16} for usage examples
56
38
  */
57
- readonly is: (a: number) => a is TtfImported_PositiveInt16;
39
+ readonly is: typeof isPositiveInt16;
58
40
  /**
59
41
  * The smallest value representable as `PositiveInt16` (the lower saturation
60
42
  * target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"positive-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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"}
1
+ {"version":3,"file":"positive-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAiBhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAMtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,UAAW,MAAM,KAAG,KAAK,IAAI,aACU,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,SACvC,CAAC,KACP,aAAa,GAAG,CAMlB,CAAC;AAEF;;;;;;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"}
@@ -1,12 +1,6 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { MAX_VALUE, MIN_VALUE, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/positive-int16.mjs';
3
3
  const typeNameInMessage = 'a positive integer in [1, 2^15)';
4
- const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
- integerOrSafeInteger: 'SafeInteger',
6
- MIN_VALUE: 1,
7
- MAX_VALUE: 2 ** 15 - 1,
8
- typeNameInMessage,
9
- });
10
4
 
11
5
 
12
6
 
@@ -16,7 +10,7 @@ const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min
16
10
 
17
11
 
18
12
 
19
- export const isPositiveInt16 = is;
13
+ export const isPositiveInt16 = (value) => Number.isSafeInteger(value) && 1 <= value && value <= 2 ** 15 - 1;
20
14
 
21
15
 
22
16
 
@@ -27,7 +21,12 @@ export const isPositiveInt16 = is;
27
21
 
28
22
 
29
23
 
30
- export const asPositiveInt16 = castType;
24
+ export const asPositiveInt16 = (value) => {
25
+ if (!isPositiveInt16(value)) {
26
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
27
+ }
28
+ return value;
29
+ };
31
30
 
32
31
 
33
32
 
@@ -43,7 +42,7 @@ export const PositiveInt16 = {
43
42
 
44
43
 
45
44
 
46
- is,
45
+ is: isPositiveInt16,
47
46
 
48
47
 
49
48