ts-data-forge 14.10.2 → 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 (416) 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 +2 -2
  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/stack.mjs +3 -3
  21. package/dist/collections/stack.mjs.map +1 -1
  22. package/dist/iterator/range.d.mts +1 -1
  23. package/dist/iterator/range.d.mts.map +1 -1
  24. package/dist/iterator/range.mjs +5 -2
  25. package/dist/iterator/range.mjs.map +1 -1
  26. package/dist/number/branded-types/finite-number.d.mts +4 -9
  27. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  28. package/dist/number/branded-types/finite-number.mjs +9 -9
  29. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  30. package/dist/number/branded-types/int.d.mts +3 -9
  31. package/dist/number/branded-types/int.d.mts.map +1 -1
  32. package/dist/number/branded-types/int.mjs +9 -10
  33. package/dist/number/branded-types/int.mjs.map +1 -1
  34. package/dist/number/branded-types/int16.d.mts +3 -18
  35. package/dist/number/branded-types/int16.d.mts.map +1 -1
  36. package/dist/number/branded-types/int16.mjs +9 -10
  37. package/dist/number/branded-types/int16.mjs.map +1 -1
  38. package/dist/number/branded-types/int32.d.mts +3 -14
  39. package/dist/number/branded-types/int32.d.mts.map +1 -1
  40. package/dist/number/branded-types/int32.mjs +9 -10
  41. package/dist/number/branded-types/int32.mjs.map +1 -1
  42. package/dist/number/branded-types/negative-finite-number.d.mts +4 -16
  43. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  44. package/dist/number/branded-types/negative-finite-number.mjs +9 -10
  45. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  46. package/dist/number/branded-types/negative-int.d.mts +3 -16
  47. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  48. package/dist/number/branded-types/negative-int.mjs +9 -11
  49. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  50. package/dist/number/branded-types/negative-safe-int.d.mts +3 -17
  51. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  52. package/dist/number/branded-types/negative-safe-int.mjs +9 -11
  53. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  54. package/dist/number/branded-types/non-negative-finite-number.d.mts +4 -14
  55. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  56. package/dist/number/branded-types/non-negative-finite-number.mjs +9 -9
  57. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  58. package/dist/number/branded-types/non-negative-int16.d.mts +3 -19
  59. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  60. package/dist/number/branded-types/non-negative-int16.mjs +9 -10
  61. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  62. package/dist/number/branded-types/non-negative-int32.d.mts +3 -17
  63. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  64. package/dist/number/branded-types/non-negative-int32.mjs +9 -10
  65. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  66. package/dist/number/branded-types/non-positive-finite-number.d.mts +4 -14
  67. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  68. package/dist/number/branded-types/non-positive-finite-number.mjs +9 -9
  69. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  70. package/dist/number/branded-types/non-positive-int.d.mts +3 -14
  71. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  72. package/dist/number/branded-types/non-positive-int.mjs +9 -10
  73. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  74. package/dist/number/branded-types/non-positive-safe-int.d.mts +3 -15
  75. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  76. package/dist/number/branded-types/non-positive-safe-int.mjs +9 -10
  77. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  78. package/dist/number/branded-types/non-zero-finite-number.d.mts +4 -10
  79. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  80. package/dist/number/branded-types/non-zero-finite-number.mjs +9 -10
  81. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  82. package/dist/number/branded-types/non-zero-int.d.mts +3 -10
  83. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  84. package/dist/number/branded-types/non-zero-int.mjs +9 -11
  85. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  86. package/dist/number/branded-types/non-zero-int16.d.mts +3 -19
  87. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  88. package/dist/number/branded-types/non-zero-int16.mjs +12 -11
  89. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  90. package/dist/number/branded-types/non-zero-int32.d.mts +3 -15
  91. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  92. package/dist/number/branded-types/non-zero-int32.mjs +12 -11
  93. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  94. package/dist/number/branded-types/non-zero-safe-int.d.mts +6 -14
  95. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  96. package/dist/number/branded-types/non-zero-safe-int.mjs +9 -13
  97. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  98. package/dist/number/branded-types/non-zero-uint16.d.mts +3 -20
  99. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  100. package/dist/number/branded-types/non-zero-uint16.mjs +9 -11
  101. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  102. package/dist/number/branded-types/non-zero-uint32.d.mts +3 -18
  103. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  104. package/dist/number/branded-types/non-zero-uint32.mjs +9 -11
  105. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  106. package/dist/number/branded-types/positive-finite-number.d.mts +4 -16
  107. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  108. package/dist/number/branded-types/positive-finite-number.mjs +9 -9
  109. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  110. package/dist/number/branded-types/positive-int.d.mts +3 -16
  111. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  112. package/dist/number/branded-types/positive-int.mjs +9 -10
  113. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  114. package/dist/number/branded-types/positive-int16.d.mts +3 -21
  115. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  116. package/dist/number/branded-types/positive-int16.mjs +9 -10
  117. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  118. package/dist/number/branded-types/positive-int32.d.mts +3 -19
  119. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  120. package/dist/number/branded-types/positive-int32.mjs +9 -10
  121. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  122. package/dist/number/branded-types/positive-safe-int.d.mts +5 -19
  123. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  124. package/dist/number/branded-types/positive-safe-int.mjs +9 -11
  125. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  126. package/dist/number/branded-types/positive-uint16.d.mts +3 -20
  127. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  128. package/dist/number/branded-types/positive-uint16.mjs +9 -10
  129. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  130. package/dist/number/branded-types/positive-uint32.d.mts +3 -18
  131. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  132. package/dist/number/branded-types/positive-uint32.mjs +9 -10
  133. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  134. package/dist/number/branded-types/safe-int.d.mts +5 -12
  135. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  136. package/dist/number/branded-types/safe-int.mjs +9 -12
  137. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  138. package/dist/number/branded-types/safe-uint.d.mts +3 -15
  139. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  140. package/dist/number/branded-types/safe-uint.mjs +9 -11
  141. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  142. package/dist/number/branded-types/uint.d.mts +3 -14
  143. package/dist/number/branded-types/uint.d.mts.map +1 -1
  144. package/dist/number/branded-types/uint.mjs +9 -10
  145. package/dist/number/branded-types/uint.mjs.map +1 -1
  146. package/dist/number/branded-types/uint16.d.mts +3 -18
  147. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  148. package/dist/number/branded-types/uint16.mjs +9 -10
  149. package/dist/number/branded-types/uint16.mjs.map +1 -1
  150. package/dist/number/branded-types/uint32.d.mts +3 -16
  151. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  152. package/dist/number/branded-types/uint32.mjs +9 -10
  153. package/dist/number/branded-types/uint32.mjs.map +1 -1
  154. package/dist/number/enum/int8.d.mts +13 -15
  155. package/dist/number/enum/int8.d.mts.map +1 -1
  156. package/dist/number/enum/int8.mjs +20 -25
  157. package/dist/number/enum/int8.mjs.map +1 -1
  158. package/dist/number/enum/uint8.d.mts +12 -14
  159. package/dist/number/enum/uint8.d.mts.map +1 -1
  160. package/dist/number/enum/uint8.mjs +18 -23
  161. package/dist/number/enum/uint8.mjs.map +1 -1
  162. package/dist/number/index.d.mts +1 -1
  163. package/dist/number/index.d.mts.map +1 -1
  164. package/dist/number/index.mjs +1 -1
  165. package/dist/number/index.mjs.map +1 -1
  166. package/dist/number/num/impl/index.d.mts +2 -0
  167. package/dist/number/num/impl/index.d.mts.map +1 -0
  168. package/dist/number/num/impl/index.mjs +2 -0
  169. package/dist/number/num/impl/index.mjs.map +1 -0
  170. package/dist/number/num/impl/num.d.mts +531 -0
  171. package/dist/number/num/impl/num.d.mts.map +1 -0
  172. package/dist/number/num/impl/num.mjs +542 -0
  173. package/dist/number/num/impl/num.mjs.map +1 -0
  174. package/dist/number/num/index.d.mts +17 -0
  175. package/dist/number/num/index.d.mts.map +1 -0
  176. package/dist/number/num/index.mjs +17 -0
  177. package/dist/number/num/index.mjs.map +1 -0
  178. package/dist/number/operators/finite-number.d.mts +16 -0
  179. package/dist/number/operators/finite-number.d.mts.map +1 -0
  180. package/dist/number/operators/finite-number.mjs +7 -0
  181. package/dist/number/operators/finite-number.mjs.map +1 -0
  182. package/dist/number/operators/int.d.mts +16 -0
  183. package/dist/number/operators/int.d.mts.map +1 -0
  184. package/dist/number/operators/int.mjs +8 -0
  185. package/dist/number/operators/int.mjs.map +1 -0
  186. package/dist/number/operators/int16.d.mts +25 -0
  187. package/dist/number/operators/int16.d.mts.map +1 -0
  188. package/dist/number/operators/int16.mjs +8 -0
  189. package/dist/number/operators/int16.mjs.map +1 -0
  190. package/dist/number/operators/int32.d.mts +21 -0
  191. package/dist/number/operators/int32.d.mts.map +1 -0
  192. package/dist/number/operators/int32.mjs +8 -0
  193. package/dist/number/operators/int32.mjs.map +1 -0
  194. package/dist/number/operators/int8.d.mts +24 -0
  195. package/dist/number/operators/int8.d.mts.map +1 -0
  196. package/dist/number/operators/int8.mjs +8 -0
  197. package/dist/number/operators/int8.mjs.map +1 -0
  198. package/dist/number/operators/negative-finite-number.d.mts +11 -0
  199. package/dist/number/operators/negative-finite-number.d.mts.map +1 -0
  200. package/dist/number/operators/negative-finite-number.mjs +8 -0
  201. package/dist/number/operators/negative-finite-number.mjs.map +1 -0
  202. package/dist/number/operators/negative-int.d.mts +10 -0
  203. package/dist/number/operators/negative-int.d.mts.map +1 -0
  204. package/dist/number/operators/negative-int.mjs +9 -0
  205. package/dist/number/operators/negative-int.mjs.map +1 -0
  206. package/dist/number/operators/negative-safe-int.d.mts +10 -0
  207. package/dist/number/operators/negative-safe-int.d.mts.map +1 -0
  208. package/dist/number/operators/negative-safe-int.mjs +9 -0
  209. package/dist/number/operators/negative-safe-int.mjs.map +1 -0
  210. package/dist/number/operators/non-negative-finite-number.d.mts +22 -0
  211. package/dist/number/operators/non-negative-finite-number.d.mts.map +1 -0
  212. package/dist/number/operators/non-negative-finite-number.mjs +7 -0
  213. package/dist/number/operators/non-negative-finite-number.mjs.map +1 -0
  214. package/dist/number/operators/non-negative-int16.d.mts +27 -0
  215. package/dist/number/operators/non-negative-int16.d.mts.map +1 -0
  216. package/dist/number/operators/non-negative-int16.mjs +8 -0
  217. package/dist/number/operators/non-negative-int16.mjs.map +1 -0
  218. package/dist/number/operators/non-negative-int32.d.mts +25 -0
  219. package/dist/number/operators/non-negative-int32.d.mts.map +1 -0
  220. package/dist/number/operators/non-negative-int32.mjs +8 -0
  221. package/dist/number/operators/non-negative-int32.mjs.map +1 -0
  222. package/dist/number/operators/non-positive-finite-number.d.mts +11 -0
  223. package/dist/number/operators/non-positive-finite-number.d.mts.map +1 -0
  224. package/dist/number/operators/non-positive-finite-number.mjs +7 -0
  225. package/dist/number/operators/non-positive-finite-number.mjs.map +1 -0
  226. package/dist/number/operators/non-positive-int.d.mts +10 -0
  227. package/dist/number/operators/non-positive-int.d.mts.map +1 -0
  228. package/dist/number/operators/non-positive-int.mjs +8 -0
  229. package/dist/number/operators/non-positive-int.mjs.map +1 -0
  230. package/dist/number/operators/non-positive-safe-int.d.mts +10 -0
  231. package/dist/number/operators/non-positive-safe-int.d.mts.map +1 -0
  232. package/dist/number/operators/non-positive-safe-int.mjs +8 -0
  233. package/dist/number/operators/non-positive-safe-int.mjs.map +1 -0
  234. package/dist/number/operators/non-zero-finite-number.d.mts +16 -0
  235. package/dist/number/operators/non-zero-finite-number.d.mts.map +1 -0
  236. package/dist/number/operators/non-zero-finite-number.mjs +8 -0
  237. package/dist/number/operators/non-zero-finite-number.mjs.map +1 -0
  238. package/dist/number/operators/non-zero-int.d.mts +10 -0
  239. package/dist/number/operators/non-zero-int.d.mts.map +1 -0
  240. package/dist/number/operators/non-zero-int.mjs +9 -0
  241. package/dist/number/operators/non-zero-int.mjs.map +1 -0
  242. package/dist/number/operators/non-zero-int16.d.mts +10 -0
  243. package/dist/number/operators/non-zero-int16.d.mts.map +1 -0
  244. package/dist/number/operators/non-zero-int16.mjs +9 -0
  245. package/dist/number/operators/non-zero-int16.mjs.map +1 -0
  246. package/dist/number/operators/non-zero-int32.d.mts +10 -0
  247. package/dist/number/operators/non-zero-int32.d.mts.map +1 -0
  248. package/dist/number/operators/non-zero-int32.mjs +9 -0
  249. package/dist/number/operators/non-zero-int32.mjs.map +1 -0
  250. package/dist/number/operators/non-zero-safe-int.d.mts +10 -0
  251. package/dist/number/operators/non-zero-safe-int.d.mts.map +1 -0
  252. package/dist/number/operators/non-zero-safe-int.mjs +11 -0
  253. package/dist/number/operators/non-zero-safe-int.mjs.map +1 -0
  254. package/dist/number/operators/non-zero-uint16.d.mts +2 -0
  255. package/dist/number/operators/non-zero-uint16.d.mts.map +1 -0
  256. package/dist/number/operators/non-zero-uint16.mjs +9 -0
  257. package/dist/number/operators/non-zero-uint16.mjs.map +1 -0
  258. package/dist/number/operators/non-zero-uint32.d.mts +2 -0
  259. package/dist/number/operators/non-zero-uint32.d.mts.map +1 -0
  260. package/dist/number/operators/non-zero-uint32.mjs +9 -0
  261. package/dist/number/operators/non-zero-uint32.mjs.map +1 -0
  262. package/dist/number/operators/positive-finite-number.d.mts +23 -0
  263. package/dist/number/operators/positive-finite-number.d.mts.map +1 -0
  264. package/dist/number/operators/positive-finite-number.mjs +7 -0
  265. package/dist/number/operators/positive-finite-number.mjs.map +1 -0
  266. package/dist/number/operators/positive-int.d.mts +23 -0
  267. package/dist/number/operators/positive-int.d.mts.map +1 -0
  268. package/dist/number/operators/positive-int.mjs +8 -0
  269. package/dist/number/operators/positive-int.mjs.map +1 -0
  270. package/dist/number/operators/positive-int16.d.mts +28 -0
  271. package/dist/number/operators/positive-int16.d.mts.map +1 -0
  272. package/dist/number/operators/positive-int16.mjs +8 -0
  273. package/dist/number/operators/positive-int16.mjs.map +1 -0
  274. package/dist/number/operators/positive-int32.d.mts +26 -0
  275. package/dist/number/operators/positive-int32.d.mts.map +1 -0
  276. package/dist/number/operators/positive-int32.mjs +8 -0
  277. package/dist/number/operators/positive-int32.mjs.map +1 -0
  278. package/dist/number/operators/positive-safe-int.d.mts +24 -0
  279. package/dist/number/operators/positive-safe-int.d.mts.map +1 -0
  280. package/dist/number/operators/positive-safe-int.mjs +9 -0
  281. package/dist/number/operators/positive-safe-int.mjs.map +1 -0
  282. package/dist/number/operators/positive-uint16.d.mts +27 -0
  283. package/dist/number/operators/positive-uint16.d.mts.map +1 -0
  284. package/dist/number/operators/positive-uint16.mjs +8 -0
  285. package/dist/number/operators/positive-uint16.mjs.map +1 -0
  286. package/dist/number/operators/positive-uint32.d.mts +25 -0
  287. package/dist/number/operators/positive-uint32.d.mts.map +1 -0
  288. package/dist/number/operators/positive-uint32.mjs +8 -0
  289. package/dist/number/operators/positive-uint32.mjs.map +1 -0
  290. package/dist/number/operators/safe-int.d.mts +17 -0
  291. package/dist/number/operators/safe-int.d.mts.map +1 -0
  292. package/dist/number/operators/safe-int.mjs +10 -0
  293. package/dist/number/operators/safe-int.mjs.map +1 -0
  294. package/dist/number/operators/safe-uint.d.mts +22 -0
  295. package/dist/number/operators/safe-uint.d.mts.map +1 -0
  296. package/dist/number/operators/safe-uint.mjs +9 -0
  297. package/dist/number/operators/safe-uint.mjs.map +1 -0
  298. package/dist/number/operators/uint.d.mts +14 -0
  299. package/dist/number/operators/uint.d.mts.map +1 -0
  300. package/dist/number/operators/uint.mjs +8 -0
  301. package/dist/number/operators/uint.mjs.map +1 -0
  302. package/dist/number/operators/uint16.d.mts +25 -0
  303. package/dist/number/operators/uint16.d.mts.map +1 -0
  304. package/dist/number/operators/uint16.mjs +8 -0
  305. package/dist/number/operators/uint16.mjs.map +1 -0
  306. package/dist/number/operators/uint32.d.mts +23 -0
  307. package/dist/number/operators/uint32.d.mts.map +1 -0
  308. package/dist/number/operators/uint32.mjs +8 -0
  309. package/dist/number/operators/uint32.mjs.map +1 -0
  310. package/dist/number/operators/uint8.d.mts +24 -0
  311. package/dist/number/operators/uint8.d.mts.map +1 -0
  312. package/dist/number/operators/uint8.mjs +8 -0
  313. package/dist/number/operators/uint8.mjs.map +1 -0
  314. package/dist/number/refined-number-utils.d.mts +2 -2
  315. package/dist/number/refined-number-utils.d.mts.map +1 -1
  316. package/dist/number/refined-number-utils.mjs +1 -1
  317. package/dist/number/refined-number-utils.mjs.map +1 -1
  318. package/dist/object/object.mjs +1 -1
  319. package/dist/object/object.mjs.map +1 -1
  320. package/dist/others/fast-deep-equal.mjs +1 -1
  321. package/dist/others/fast-deep-equal.mjs.map +1 -1
  322. package/package.json +22 -9
  323. package/src/array/impl/array-utils-reducing-value.mts +4 -3
  324. package/src/array/impl/array-utils-shape-invariants.test.mts +1 -1
  325. package/src/array/impl/array-utils-slice-clamped.mts +1 -1
  326. package/src/array/impl/array-utils-slicing.mts +12 -3
  327. package/src/array/impl/array-utils-transformation.mts +6 -2
  328. package/src/array/impl/array-utils-validation.mts +2 -1
  329. package/src/built-in-tag.mts +59 -0
  330. package/src/built-in-tag.test.mts +215 -0
  331. package/src/collections/stack.mts +3 -3
  332. package/src/iterator/range.mts +10 -2
  333. package/src/iterator/range.test.mts +7 -0
  334. package/src/number/branded-types/finite-number.mts +23 -25
  335. package/src/number/branded-types/int.mts +20 -26
  336. package/src/number/branded-types/int16.mts +21 -26
  337. package/src/number/branded-types/int32.mts +21 -26
  338. package/src/number/branded-types/negative-finite-number.mts +25 -26
  339. package/src/number/branded-types/negative-int.mts +20 -27
  340. package/src/number/branded-types/negative-safe-int.mts +23 -28
  341. package/src/number/branded-types/non-negative-finite-number.mts +24 -25
  342. package/src/number/branded-types/non-negative-int16.mts +23 -26
  343. package/src/number/branded-types/non-negative-int32.mts +23 -26
  344. package/src/number/branded-types/non-positive-finite-number.mts +24 -25
  345. package/src/number/branded-types/non-positive-int.mts +20 -26
  346. package/src/number/branded-types/non-positive-safe-int.mts +21 -26
  347. package/src/number/branded-types/non-zero-finite-number.mts +23 -25
  348. package/src/number/branded-types/non-zero-int.mts +19 -25
  349. package/src/number/branded-types/non-zero-int16.mts +27 -28
  350. package/src/number/branded-types/non-zero-int32.mts +27 -28
  351. package/src/number/branded-types/non-zero-safe-int.mts +25 -35
  352. package/src/number/branded-types/non-zero-uint16.mts +24 -28
  353. package/src/number/branded-types/non-zero-uint32.mts +24 -28
  354. package/src/number/branded-types/positive-finite-number.mts +25 -25
  355. package/src/number/branded-types/positive-int.mts +21 -26
  356. package/src/number/branded-types/positive-int16.mts +23 -26
  357. package/src/number/branded-types/positive-int32.mts +23 -26
  358. package/src/number/branded-types/positive-safe-int.mts +24 -31
  359. package/src/number/branded-types/positive-uint16.mts +23 -26
  360. package/src/number/branded-types/positive-uint32.mts +23 -26
  361. package/src/number/branded-types/safe-int.mts +22 -29
  362. package/src/number/branded-types/safe-uint.mts +21 -27
  363. package/src/number/branded-types/uint.mts +21 -26
  364. package/src/number/branded-types/uint16.mts +21 -26
  365. package/src/number/branded-types/uint32.mts +21 -26
  366. package/src/number/enum/int8.mts +40 -52
  367. package/src/number/enum/uint8.mts +40 -48
  368. package/src/number/index.mts +1 -1
  369. package/src/number/num/impl/index.mts +1 -0
  370. package/src/number/num/impl/num.mts +715 -0
  371. package/src/number/{num.test.mts → num/impl/num.test.mts} +4 -4
  372. package/src/number/num/index.mts +16 -0
  373. package/src/number/num-arithmetic.test.mts +1 -1
  374. package/src/number/operators/finite-number.mts +20 -0
  375. package/src/number/operators/int.mts +20 -0
  376. package/src/number/operators/int16.mts +33 -0
  377. package/src/number/operators/int32.mts +33 -0
  378. package/src/number/operators/int8.mts +18 -0
  379. package/src/number/operators/negative-finite-number.mts +22 -0
  380. package/src/number/operators/negative-int.mts +22 -0
  381. package/src/number/operators/negative-safe-int.mts +32 -0
  382. package/src/number/operators/non-negative-finite-number.mts +32 -0
  383. package/src/number/operators/non-negative-int16.mts +33 -0
  384. package/src/number/operators/non-negative-int32.mts +33 -0
  385. package/src/number/operators/non-positive-finite-number.mts +21 -0
  386. package/src/number/operators/non-positive-int.mts +21 -0
  387. package/src/number/operators/non-positive-safe-int.mts +31 -0
  388. package/src/number/operators/non-zero-finite-number.mts +21 -0
  389. package/src/number/operators/non-zero-int.mts +22 -0
  390. package/src/number/operators/non-zero-int16.mts +32 -0
  391. package/src/number/operators/non-zero-int32.mts +32 -0
  392. package/src/number/operators/non-zero-safe-int.mts +34 -0
  393. package/src/number/operators/non-zero-uint16.mts +32 -0
  394. package/src/number/operators/non-zero-uint32.mts +32 -0
  395. package/src/number/operators/positive-finite-number.mts +32 -0
  396. package/src/number/operators/positive-int.mts +32 -0
  397. package/src/number/operators/positive-int16.mts +33 -0
  398. package/src/number/operators/positive-int32.mts +33 -0
  399. package/src/number/operators/positive-safe-int.mts +34 -0
  400. package/src/number/operators/positive-uint16.mts +33 -0
  401. package/src/number/operators/positive-uint32.mts +33 -0
  402. package/src/number/operators/safe-int.mts +35 -0
  403. package/src/number/operators/safe-uint.mts +33 -0
  404. package/src/number/operators/uint.mts +31 -0
  405. package/src/number/operators/uint16.mts +32 -0
  406. package/src/number/operators/uint32.mts +32 -0
  407. package/src/number/operators/uint8.mts +16 -0
  408. package/src/number/refined-number-utils.mts +4 -4
  409. package/src/object/object.mts +1 -1
  410. package/src/others/fast-deep-equal.mts +1 -1
  411. package/dist/number/num.d.mts +0 -550
  412. package/dist/number/num.d.mts.map +0 -1
  413. package/dist/number/num.mjs +0 -563
  414. package/dist/number/num.mjs.map +0 -1
  415. package/src/guard/is-error.test.mts +0 -145
  416. package/src/number/num.mts +0 -735
@@ -1,5 +1,5 @@
1
1
  import type { NonNegativeFiniteNumber as TtfImported_NonNegativeFiniteNumber } 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 NonNegativeFiniteNumber = TtfImported_NonNegativeFiniteNumber;
4
4
  type ElementType = NonNegativeFiniteNumber;
5
5
  declare const floor: (x: ElementType) => 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 non-negative finite number, `false` otherwise
16
16
  */
17
- export declare const isNonNegativeFiniteNumber: (a: number) => a is TtfImported_NonNegativeFiniteNumber;
17
+ export declare const isNonNegativeFiniteNumber: (value: number) => value is NonNegativeFiniteNumber;
18
18
  /**
19
19
  * Casts a `number` to the `NonNegativeFiniteNumber` branded type.
20
20
  *
@@ -25,17 +25,7 @@ export declare const isNonNegativeFiniteNumber: (a: number) => a is TtfImported_
25
25
  * @returns The value as a `NonNegativeFiniteNumber`
26
26
  * @throws {TypeError} If the value is not a non-negative finite number
27
27
  */
28
- export declare const asNonNegativeFiniteNumber: <N extends number>(x: N) => number & {
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 NaNValue: false;
36
- } & Readonly<{
37
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
38
- }> & N;
28
+ export declare const asNonNegativeFiniteNumber: <N extends number>(value: N) => NonNegativeFiniteNumber & N;
39
29
  /**
40
30
  * Namespace providing type-safe operations for the `NonNegativeFiniteNumber`
41
31
  * branded type.
@@ -50,7 +40,7 @@ export declare const NonNegativeFiniteNumber: {
50
40
  * @returns `true` if the value is a non-negative finite number, `false` otherwise
51
41
  * @see {@link isNonNegativeFiniteNumber} for usage examples
52
42
  */
53
- readonly is: (a: number) => a is TtfImported_NonNegativeFiniteNumber;
43
+ readonly is: typeof isNonNegativeFiniteNumber;
54
44
  /**
55
45
  * The smallest value representable as `NonNegativeFiniteNumber` (the lower
56
46
  * saturation target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-negative-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,mCAAmC,EAE/D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE1E,KAAK,WAAW,GAAG,uBAAuB,CAAC;AA2B3C,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEiB,CAAC;AAE9E,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,KAAK,CAAC,WAAW,CAEiB,CAAC;AAM9E;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,yDAAK,CAAC;AAE5C;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;MAAW,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;;;OAMG;;IAGH;;;OAGG;;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":"non-negative-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,mCAAmC,EAE/D,MAAM,eAAe,CAAC;AAcvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE1E,KAAK,WAAW,GAAG,uBAAuB,CAAC;AAI3C,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEiB,CAAC;AAE9E,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,KAAK,CAAC,WAAW,CAEiB,CAAC;AAM9E;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,UAC7B,MAAM,KACZ,KAAK,IAAI,uBAA+D,CAAC;AAE5E;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,MAAM,SACjD,CAAC,KACP,uBAAuB,GAAG,CAM5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;;;OAMG;;IAGH;;;OAGG;;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/non-negative-finite-number.mjs';
3
3
  const typeNameInMessage = 'a non-negative 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: 0,
6
- MAX_VALUE: Number.MAX_VALUE,
7
- typeNameInMessage,
8
- });
9
4
  const floor = (x) =>
10
5
 
11
6
  Math.floor(x);
@@ -25,7 +20,7 @@ Math.round(x);
25
20
 
26
21
 
27
22
 
28
- export const isNonNegativeFiniteNumber = is;
23
+ export const isNonNegativeFiniteNumber = (value) => Number.isFinite(value) && value >= 0;
29
24
 
30
25
 
31
26
 
@@ -36,7 +31,12 @@ export const isNonNegativeFiniteNumber = is;
36
31
 
37
32
 
38
33
 
39
- export const asNonNegativeFiniteNumber = castType;
34
+ export const asNonNegativeFiniteNumber = (value) => {
35
+ if (!isNonNegativeFiniteNumber(value)) {
36
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
37
+ }
38
+ return value;
39
+ };
40
40
 
41
41
 
42
42
 
@@ -51,7 +51,7 @@ export const NonNegativeFiniteNumber = {
51
51
 
52
52
 
53
53
 
54
- is,
54
+ is: isNonNegativeFiniteNumber,
55
55
 
56
56
 
57
57
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-negative-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-finite-number.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAEzD,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,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;CACT,CAAC,CAAC;AAEZ,MAAM,KAAK,GAAG,CACZ,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D,CAAC;AAE9E,MAAM,IAAI,GAAG,CACX,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAA+D,CAAC;AAE7E,MAAM,KAAK,GAAG,CACZ,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D,CAAC;AAE9E,UAAU,CACR,GAAG,CACJ,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC;;;;;;OAMG;IACH,EAAE;IAEF;;;OAGG;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,CAMR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-negative-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-finite-number.mts"],"names":[],"mappings":"AAIA,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,6CAA6C,CAAC;AAOrD,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAEzD,MAAM,KAAK,GAAG,CACZ,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D,CAAC;AAE9E,MAAM,IAAI,GAAG,CACX,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAA+D,CAAC;AAE7E,MAAM,KAAK,GAAG,CACZ,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D,CAAC;AAE9E,UAAU,CACR,GAAG,CACJ,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAa,EACqB,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAQ,EACqB,EAAE;IAC/B,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,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,uBAAuB,GAAG;IACrC;;;;;;OAMG;IACH,EAAE,EAAE,yBAAyB;IAE7B;;;OAGG;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,CAMR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type NonNegativeInt16 = TtfImported_NonNegativeInt16;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-negative integer in [0, 2^15), `false` otherwise
11
11
  */
12
- export declare const isNonNegativeInt16: (a: number) => a is TtfImported_NonNegativeInt16;
12
+ export declare const isNonNegativeInt16: (value: number) => value is NonNegativeInt16;
13
13
  /**
14
14
  * Casts a `number` to the `NonNegativeInt16` branded type.
15
15
  *
@@ -20,23 +20,7 @@ export declare const isNonNegativeInt16: (a: number) => a is TtfImported_NonNega
20
20
  * @returns The value as a `NonNegativeInt16`
21
21
  * @throws {TypeError} If the value is not a non-negative integer in [0, 2^15)
22
22
  */
23
- export declare const asNonNegativeInt16: <N extends number>(x: N) => number & {
24
- readonly "< 2^15": true;
25
- readonly "< 2^16": true;
26
- readonly "< 2^31": true;
27
- readonly "< 2^32": true;
28
- readonly "> -2^16": true;
29
- readonly "> -2^32": true;
30
- readonly ">= -2^15": true;
31
- readonly ">= -2^31": true;
32
- readonly ">=0": true;
33
- readonly Finite: true;
34
- readonly Int: true;
35
- readonly NaNValue: false;
36
- readonly SafeInt: true;
37
- } & Readonly<{
38
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
39
- }> & N;
23
+ export declare const asNonNegativeInt16: <N extends number>(value: N) => NonNegativeInt16 & N;
40
24
  /**
41
25
  * Namespace providing type-safe operations for the `NonNegativeInt16` branded
42
26
  * type.
@@ -52,7 +36,7 @@ export declare const NonNegativeInt16: {
52
36
  * @returns `true` if the value is a non-negative integer in [0, 2^15), `false` otherwise
53
37
  * @see {@link isNonNegativeInt16} for usage examples
54
38
  */
55
- readonly is: (a: number) => a is TtfImported_NonNegativeInt16;
39
+ readonly is: typeof isNonNegativeInt16;
56
40
  /**
57
41
  * The smallest value representable as `NonNegativeInt16` (the lower
58
42
  * saturation target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-negative-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAItF,MAAM,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AA+B5D;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,kDAAK,CAAC;AAErC;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;MAAW,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-negative-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAiBtF,MAAM,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AAM5D;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,KAAG,KAAK,IAAI,gBACO,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,SAC1C,CAAC,KACP,gBAAgB,GAAG,CAMrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;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/non-negative-int16.mjs';
3
3
  const typeNameInMessage = 'a non-negative integer in [0, 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: 0,
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 isNonNegativeInt16 = is;
13
+ export const isNonNegativeInt16 = (value) => Number.isSafeInteger(value) && 0 <= value && value <= 2 ** 15 - 1;
20
14
 
21
15
 
22
16
 
@@ -27,7 +21,12 @@ export const isNonNegativeInt16 = is;
27
21
 
28
22
 
29
23
 
30
- export const asNonNegativeInt16 = castType;
24
+ export const asNonNegativeInt16 = (value) => {
25
+ if (!isNonNegativeInt16(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 NonNegativeInt16 = {
43
42
 
44
43
 
45
44
 
46
- is,
45
+ is: isNonNegativeInt16,
47
46
 
48
47
 
49
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-negative-int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAEhE,MAAM,EACJ,SAAS,EACT,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,aAAa;IACnC,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B;;;;;;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;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;;OAQG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-negative-int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,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,qCAAqC,CAAC;AAO7C,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAA6B,EAAE,CAC7E,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,kBAAkB,GAAG,CAChC,KAAQ,EACc,EAAE;IACxB,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,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,gBAAgB,GAAG;IAC9B;;;;;;OAMG;IACH,EAAE,EAAE,kBAAkB;IAEtB;;;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;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;;OAQG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type NonNegativeInt32 = TtfImported_NonNegativeInt32;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-negative integer in [0, 2^31), `false` otherwise
11
11
  */
12
- export declare const isNonNegativeInt32: (a: number) => a is TtfImported_NonNegativeInt32;
12
+ export declare const isNonNegativeInt32: (value: number) => value is NonNegativeInt32;
13
13
  /**
14
14
  * Casts a `number` to the `NonNegativeInt32` branded type.
15
15
  *
@@ -20,21 +20,7 @@ export declare const isNonNegativeInt32: (a: number) => a is TtfImported_NonNega
20
20
  * @returns The value as a `NonNegativeInt32`
21
21
  * @throws {TypeError} If the value is not a non-negative integer in [0, 2^31)
22
22
  */
23
- export declare const asNonNegativeInt32: <N extends number>(x: N) => number & {
24
- readonly "< 2^31": true;
25
- readonly "< 2^32": true;
26
- readonly "> -2^16": true;
27
- readonly "> -2^32": true;
28
- readonly ">= -2^15": true;
29
- readonly ">= -2^31": true;
30
- readonly ">=0": true;
31
- readonly Finite: true;
32
- readonly Int: true;
33
- readonly NaNValue: false;
34
- readonly SafeInt: true;
35
- } & Readonly<{
36
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
37
- }> & N;
23
+ export declare const asNonNegativeInt32: <N extends number>(value: N) => NonNegativeInt32 & N;
38
24
  /**
39
25
  * Namespace providing type-safe operations for the `NonNegativeInt32` branded
40
26
  * type.
@@ -50,7 +36,7 @@ export declare const NonNegativeInt32: {
50
36
  * @returns `true` if the value is a non-negative integer in [0, 2^31), `false` otherwise
51
37
  * @see {@link isNonNegativeInt32} for usage examples
52
38
  */
53
- readonly is: (a: number) => a is TtfImported_NonNegativeInt32;
39
+ readonly is: typeof isNonNegativeInt32;
54
40
  /**
55
41
  * The smallest value representable as `NonNegativeInt32` (the lower
56
42
  * saturation target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-negative-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAItF,MAAM,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AA+B5D;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,kDAAK,CAAC;AAErC;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;MAAW,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;;;;;;;;;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-negative-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAiBtF,MAAM,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AAM5D;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,KAAG,KAAK,IAAI,gBACO,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,SAC1C,CAAC,KACP,gBAAgB,GAAG,CAMrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;;;;;;;;;;;;;;;;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/non-negative-int32.mjs';
3
3
  const typeNameInMessage = 'a non-negative integer in [0, 2^31)';
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: 0,
7
- MAX_VALUE: 2 ** 31 - 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 isNonNegativeInt32 = is;
13
+ export const isNonNegativeInt32 = (value) => Number.isSafeInteger(value) && 0 <= value && value <= 2 ** 31 - 1;
20
14
 
21
15
 
22
16
 
@@ -27,7 +21,12 @@ export const isNonNegativeInt32 = is;
27
21
 
28
22
 
29
23
 
30
- export const asNonNegativeInt32 = castType;
24
+ export const asNonNegativeInt32 = (value) => {
25
+ if (!isNonNegativeInt32(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 NonNegativeInt32 = {
43
42
 
44
43
 
45
44
 
46
- is,
45
+ is: isNonNegativeInt32,
47
46
 
48
47
 
49
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-negative-int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAEhE,MAAM,EACJ,SAAS,EACT,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,aAAa;IACnC,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B;;;;;;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;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;;OAQG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-negative-int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-negative-int32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,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,qCAAqC,CAAC;AAO7C,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAA6B,EAAE,CAC7E,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,kBAAkB,GAAG,CAChC,KAAQ,EACc,EAAE;IACxB,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,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,gBAAgB,GAAG;IAC9B;;;;;;OAMG;IACH,EAAE,EAAE,kBAAkB;IAEtB;;;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;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;;OAQG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { NonPositiveFiniteNumber as TtfImported_NonPositiveFiniteNumber } 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 NonPositiveFiniteNumber = TtfImported_NonPositiveFiniteNumber;
4
4
  type ElementType = NonPositiveFiniteNumber;
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 non-positive finite number, `false` otherwise
16
16
  */
17
- export declare const isNonPositiveFiniteNumber: (a: number) => a is TtfImported_NonPositiveFiniteNumber;
17
+ export declare const isNonPositiveFiniteNumber: (value: number) => value is NonPositiveFiniteNumber;
18
18
  /**
19
19
  * Casts a `number` to the `NonPositiveFiniteNumber` branded type.
20
20
  *
@@ -25,17 +25,7 @@ export declare const isNonPositiveFiniteNumber: (a: number) => a is TtfImported_
25
25
  * @returns The value as a `NonPositiveFiniteNumber`
26
26
  * @throws {TypeError} If the value is not a non-positive finite number
27
27
  */
28
- export declare const asNonPositiveFiniteNumber: <N extends number>(x: N) => number & {
29
- readonly "< 2^15": true;
30
- readonly "< 2^16": true;
31
- readonly "< 2^31": true;
32
- readonly "< 2^32": true;
33
- readonly "<=0": true;
34
- readonly Finite: true;
35
- readonly NaNValue: false;
36
- } & Readonly<{
37
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
38
- }> & N;
28
+ export declare const asNonPositiveFiniteNumber: <N extends number>(value: N) => NonPositiveFiniteNumber & N;
39
29
  /**
40
30
  * Namespace providing type-safe operations for the `NonPositiveFiniteNumber`
41
31
  * branded type.
@@ -50,7 +40,7 @@ export declare const NonPositiveFiniteNumber: {
50
40
  * @returns `true` if the value is a non-positive finite number, `false` otherwise
51
41
  * @see {@link isNonPositiveFiniteNumber} for usage examples
52
42
  */
53
- readonly is: (a: number) => a is TtfImported_NonPositiveFiniteNumber;
43
+ readonly is: typeof isNonPositiveFiniteNumber;
54
44
  /**
55
45
  * The largest value representable as `NonPositiveFiniteNumber` (the upper
56
46
  * saturation target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,IAAI,mCAAmC,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE1E,KAAK,WAAW,GAAG,uBAAuB,CAAC;AAyB3C,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,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAKzD,CAAC;AAEJ,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,yDAAK,CAAC;AAE5C;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;MAAW,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-positive-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,IAAI,mCAAmC,EAAE,MAAM,eAAe,CAAC;AAWpG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE1E,KAAK,WAAW,GAAG,uBAAuB,CAAC;AAI3C,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,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAKzD,CAAC;AAEJ,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,UAC7B,MAAM,KACZ,KAAK,IAAI,uBAA+D,CAAC;AAE5E;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,MAAM,SACjD,CAAC,KACP,uBAAuB,GAAG,CAM5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
@@ -1,10 +1,5 @@
1
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
1
+ import { MAX_VALUE, add, fromNumber, max as max_, min as min_, pow, random, sub, } from '../operators/non-positive-finite-number.mjs';
2
2
  const typeNameInMessage = 'a non-positive finite number';
3
- const { MAX_VALUE, add, castType, fromNumber, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
4
- MIN_VALUE: -Number.MAX_VALUE,
5
- MAX_VALUE: 0,
6
- typeNameInMessage,
7
- });
8
3
  const floor = (x) =>
9
4
 
10
5
  Math.floor(x);
@@ -23,7 +18,7 @@ Math.round(x);
23
18
 
24
19
 
25
20
 
26
- export const isNonPositiveFiniteNumber = is;
21
+ export const isNonPositiveFiniteNumber = (value) => Number.isFinite(value) && value <= 0;
27
22
 
28
23
 
29
24
 
@@ -34,7 +29,12 @@ export const isNonPositiveFiniteNumber = is;
34
29
 
35
30
 
36
31
 
37
- export const asNonPositiveFiniteNumber = castType;
32
+ export const asNonPositiveFiniteNumber = (value) => {
33
+ if (!isNonPositiveFiniteNumber(value)) {
34
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
35
+ }
36
+ return value;
37
+ };
38
38
 
39
39
 
40
40
 
@@ -49,7 +49,7 @@ export const NonPositiveFiniteNumber = {
49
49
 
50
50
 
51
51
 
52
- is,
52
+ is: isNonPositiveFiniteNumber,
53
53
 
54
54
 
55
55
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-finite-number.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAEzD,MAAM,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,iBAAiB,CAI3D;IACA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,CAAC;IACZ,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,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAEV,CAAC;AAEJ,MAAM,KAAK,GAAG,CACZ,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,KAAK,CACR,CAAC,CAGF,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC;;;;;;OAMG;IACH,EAAE;IAEF;;;OAGG;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;CACK,CAAC"}
1
+ {"version":3,"file":"non-positive-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-finite-number.mts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,6CAA6C,CAAC;AAOrD,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAEzD,MAAM,KAAK,GAAG,CACZ,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,KAAK,CACR,CAAC,CAGF,CAAC;AAEJ,MAAM,IAAI,GAAG,CACX,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAEV,CAAC;AAEJ,MAAM,KAAK,GAAG,CACZ,CAAc,EAGd,EAAE;AACF,oEAAoE;AACpE,IAAI,CAAC,KAAK,CACR,CAAC,CAGF,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAa,EACqB,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAQ,EACqB,EAAE;IAC/B,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,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,uBAAuB,GAAG;IACrC;;;;;;OAMG;IACH,EAAE,EAAE,yBAAyB;IAE7B;;;OAGG;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;CACK,CAAC"}
@@ -10,7 +10,7 @@ export type NonPositiveInt = TtfImported_NonPositiveInt;
10
10
  * @param value - The value to check
11
11
  * @returns `true` if the value is a non-positive integer, `false` otherwise
12
12
  */
13
- export declare const isNonPositiveInt: (a: number) => a is TtfImported_NonPositiveInt;
13
+ export declare const isNonPositiveInt: (value: number) => value is NonPositiveInt;
14
14
  /**
15
15
  * Casts a `number` to the `NonPositiveInt` branded type.
16
16
  *
@@ -21,18 +21,7 @@ export declare const isNonPositiveInt: (a: number) => a is TtfImported_NonPositi
21
21
  * @returns The value as a `NonPositiveInt`
22
22
  * @throws {TypeError} If the value is not a non-positive integer
23
23
  */
24
- export declare const asNonPositiveInt: <N extends number>(x: N) => number & {
25
- readonly "< 2^15": true;
26
- readonly "< 2^16": true;
27
- readonly "< 2^31": true;
28
- readonly "< 2^32": true;
29
- readonly "<=0": true;
30
- readonly Finite: true;
31
- readonly Int: true;
32
- readonly NaNValue: false;
33
- } & Readonly<{
34
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
35
- }> & N;
24
+ export declare const asNonPositiveInt: <N extends number>(value: N) => NonPositiveInt & N;
36
25
  /**
37
26
  * Namespace providing type-safe operations for the `NonPositiveInt` branded
38
27
  * type.
@@ -52,7 +41,7 @@ export declare const NonPositiveInt: {
52
41
  * @returns `true` if the value is a non-positive integer, `false` otherwise
53
42
  * @see {@link isNonPositiveInt} for usage examples
54
43
  */
55
- readonly is: (a: number) => a is TtfImported_NonPositiveInt;
44
+ readonly is: typeof isNonPositiveInt;
56
45
  /**
57
46
  * The largest value representable as `NonPositiveInt` (the upper saturation
58
47
  * target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAGlF,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC;AA4BxD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,gDAAK,CAAC;AAEnC;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;MAAW,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAYlF,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAIxD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,KAAK,IAAI,cACnB,CAAC;AAExC;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,SACxC,CAAC,KACP,cAAc,GAAG,CAMnB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
@@ -1,11 +1,5 @@
1
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
1
+ import { MAX_VALUE, add, fromNumber, max as max_, min as min_, pow, random, sub, } from '../operators/non-positive-int.mjs';
2
2
  const typeNameInMessage = 'a non-positive integer';
3
- const { MAX_VALUE, add, castType, fromNumber, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
4
- integerOrSafeInteger: 'Integer',
5
- MIN_VALUE: -Number.MAX_VALUE,
6
- MAX_VALUE: 0,
7
- typeNameInMessage,
8
- });
9
3
 
10
4
 
11
5
 
@@ -16,7 +10,7 @@ const { MAX_VALUE, add, castType, fromNumber, is, max: max_, min: min_, pow, ran
16
10
 
17
11
 
18
12
 
19
- export const isNonPositiveInt = is;
13
+ export const isNonPositiveInt = (value) => Number.isInteger(value) && value <= 0;
20
14
 
21
15
 
22
16
 
@@ -27,7 +21,12 @@ export const isNonPositiveInt = is;
27
21
 
28
22
 
29
23
 
30
- export const asNonPositiveInt = castType;
24
+ export const asNonPositiveInt = (value) => {
25
+ if (!isNonPositiveInt(value)) {
26
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
27
+ }
28
+ return value;
29
+ };
31
30
 
32
31
 
33
32
 
@@ -47,7 +46,7 @@ export const NonPositiveInt = {
47
46
 
48
47
 
49
48
 
50
- is,
49
+ is: isNonPositiveInt,
51
50
 
52
51
 
53
52
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEnD,MAAM,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;IACA,oBAAoB,EAAE,SAAS;IAC/B,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,CAAC;IACZ,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;;;;;OAMG;IACH,EAAE;IAEF;;;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;;;;;;;OAOG;IACH,GAAG;CACK,CAAC"}
1
+ {"version":3,"file":"non-positive-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-int.mts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,mCAAmC,CAAC;AAI3C,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA2B,EAAE,CACzE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAExC;;;;;;;;;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;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;;;;;OAMG;IACH,EAAE,EAAE,gBAAgB;IAEpB;;;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;;;;;;;OAOG;IACH,GAAG;CACK,CAAC"}
@@ -9,7 +9,7 @@ export type NonPositiveSafeInt = TtfImported_NonPositiveSafeInt;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-positive safe integer, `false` otherwise
11
11
  */
12
- export declare const isNonPositiveSafeInt: (a: number) => a is TtfImported_NonPositiveSafeInt;
12
+ export declare const isNonPositiveSafeInt: (value: number) => value is NonPositiveSafeInt;
13
13
  /**
14
14
  * Casts a `number` to the `NonPositiveSafeInt` branded type.
15
15
  *
@@ -20,19 +20,7 @@ export declare const isNonPositiveSafeInt: (a: number) => a is TtfImported_NonPo
20
20
  * @returns The value as a `NonPositiveSafeInt`
21
21
  * @throws {TypeError} If the value is not a non-positive safe integer
22
22
  */
23
- export declare const asNonPositiveSafeInt: <N extends number>(x: N) => number & {
24
- readonly "< 2^15": true;
25
- readonly "< 2^16": true;
26
- readonly "< 2^31": true;
27
- readonly "< 2^32": true;
28
- readonly "<=0": true;
29
- readonly Finite: true;
30
- readonly Int: true;
31
- readonly NaNValue: false;
32
- readonly SafeInt: true;
33
- } & Readonly<{
34
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
35
- }> & N;
23
+ export declare const asNonPositiveSafeInt: <N extends number>(value: N) => NonPositiveSafeInt & N;
36
24
  /**
37
25
  * Namespace providing type-safe operations for the `NonPositiveSafeInt` branded
38
26
  * type.
@@ -48,7 +36,7 @@ export declare const NonPositiveSafeInt: {
48
36
  * @returns `true` if the value is a non-positive safe integer, `false` otherwise
49
37
  * @see {@link isNonPositiveSafeInt} for usage examples
50
38
  */
51
- readonly is: (a: number) => a is TtfImported_NonPositiveSafeInt;
39
+ readonly is: typeof isNonPositiveSafeInt;
52
40
  /**
53
41
  * The smallest value representable as `NonPositiveSafeInt` (the lower
54
42
  * saturation target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAG1F,MAAM,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AA6BhE;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,oDAAK,CAAC;AAEvC;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;MAAW,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;IAC7B;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;;OAWG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAa1F,MAAM,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAIhE;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,UACxB,MAAM,KACZ,KAAK,IAAI,kBAA+D,CAAC;AAE5E;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,SAC5C,CAAC,KACP,kBAAkB,GAAG,CAMvB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;IAC7B;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;;OAWG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
@@ -1,11 +1,5 @@
1
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
1
+ import { MAX_VALUE, MIN_VALUE, add, fromNumber, max as max_, min as min_, pow, random, sub, } from '../operators/non-positive-safe-int.mjs';
2
2
  const typeNameInMessage = 'a non-positive safe integer';
3
- const { MAX_VALUE, MIN_VALUE, add, castType, fromNumber, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
4
- integerOrSafeInteger: 'SafeInteger',
5
- MIN_VALUE: Number.MIN_SAFE_INTEGER,
6
- MAX_VALUE: 0,
7
- typeNameInMessage,
8
- });
9
3
 
10
4
 
11
5
 
@@ -15,7 +9,7 @@ const { MAX_VALUE, MIN_VALUE, add, castType, fromNumber, is, max: max_, min: min
15
9
 
16
10
 
17
11
 
18
- export const isNonPositiveSafeInt = is;
12
+ export const isNonPositiveSafeInt = (value) => Number.isSafeInteger(value) && value <= 0;
19
13
 
20
14
 
21
15
 
@@ -26,7 +20,12 @@ export const isNonPositiveSafeInt = is;
26
20
 
27
21
 
28
22
 
29
- export const asNonPositiveSafeInt = castType;
23
+ export const asNonPositiveSafeInt = (value) => {
24
+ if (!isNonPositiveSafeInt(value)) {
25
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
26
+ }
27
+ return value;
28
+ };
30
29
 
31
30
 
32
31
 
@@ -42,7 +41,7 @@ export const NonPositiveSafeInt = {
42
41
 
43
42
 
44
43
 
45
- is,
44
+ is: isNonPositiveSafeInt,
46
45
 
47
46
 
48
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-positive-safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAExD,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,EACV,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;IACA,oBAAoB,EAAE,aAAa;IACnC,SAAS,EAAE,MAAM,CAAC,gBAAgB;IAClC,SAAS,EAAE,CAAC;IACZ,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC;;;;;;OAMG;IACH,EAAE;IAEF;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;OAWG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC"}
1
+ {"version":3,"file":"non-positive-safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-positive-safe-int.mts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,wCAAwC,CAAC;AAIhD,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACgB,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAQ,EACgB,EAAE;IAC1B,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,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,kBAAkB,GAAG;IAChC;;;;;;OAMG;IACH,EAAE,EAAE,oBAAoB;IAExB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;OAWG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC"}