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 +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"}
@@ -1,5 +1,5 @@
1
1
  import type { NonZeroFiniteNumber as TtfImported_NonZeroFiniteNumber } 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 NonZeroFiniteNumber = TtfImported_NonZeroFiniteNumber;
4
4
  type ElementType = NonZeroFiniteNumber;
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-zero finite number, `false` otherwise
16
16
  */
17
- export declare const isNonZeroFiniteNumber: (a: number) => a is TtfImported_NonZeroFiniteNumber;
17
+ export declare const isNonZeroFiniteNumber: (value: number) => value is NonZeroFiniteNumber;
18
18
  /**
19
19
  * Casts a `number` to the `NonZeroFiniteNumber` branded type.
20
20
  *
@@ -25,13 +25,7 @@ export declare const isNonZeroFiniteNumber: (a: number) => a is TtfImported_NonZ
25
25
  * @returns The value as a `NonZeroFiniteNumber`
26
26
  * @throws {TypeError} If the value is not a non-zero finite number
27
27
  */
28
- export declare const asNonZeroFiniteNumber: <N extends number>(x: N) => number & {
29
- readonly "!=0": true;
30
- readonly Finite: true;
31
- readonly NaNValue: false;
32
- } & Readonly<{
33
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
34
- }> & N;
28
+ export declare const asNonZeroFiniteNumber: <N extends number>(value: N) => NonZeroFiniteNumber & N;
35
29
  /**
36
30
  * Namespace providing type-safe operations for the `NonZeroFiniteNumber`
37
31
  * branded type.
@@ -46,7 +40,7 @@ export declare const NonZeroFiniteNumber: {
46
40
  * @returns `true` if the value is a non-zero finite number, `false` otherwise
47
41
  * @see {@link isNonZeroFiniteNumber} for usage examples
48
42
  */
49
- readonly is: (a: number) => a is TtfImported_NonZeroFiniteNumber;
43
+ readonly is: typeof isNonZeroFiniteNumber;
50
44
  /**
51
45
  * Returns the absolute value of a non-zero finite number.
52
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,mBAAmB,IAAI,+BAA+B,EACvD,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAElE,KAAK,WAAW,GAAG,mBAAmB,CAAC;AAyBvC,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;AAc9E;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,qDAAK,CAAC;AAExC;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;;;;;MAAW,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;;;;OAWG;;;;;;;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,mBAAmB,IAAI,+BAA+B,EACvD,MAAM,eAAe,CAAC;AAWvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAElE,KAAK,WAAW,GAAG,mBAAmB,CAAC;AAIvC,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;AAc9E;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,UACzB,MAAM,KACZ,KAAK,IAAI,mBAA4D,CAAC;AAEzE;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,SAC7C,CAAC,KACP,mBAAmB,GAAG,CAMxB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;;;;OAWG;;;;;;;;CAEK,CAAC"}
@@ -1,12 +1,6 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { abs, div, max as max_, min as min_, mul, pow, randomNonZero as random, } from '../operators/non-zero-finite-number.mjs';
3
3
  const typeNameInMessage = 'a non-zero finite number';
4
- const { abs, castType, div, is, max: max_, min: min_, mul, pow, randomNonZero: random, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
5
- nonZero: true,
6
- MIN_VALUE: -Number.MAX_VALUE,
7
- MAX_VALUE: Number.MAX_VALUE,
8
- typeNameInMessage,
9
- });
10
4
  const floor = (x) =>
11
5
 
12
6
  Math.floor(x);
@@ -27,7 +21,7 @@ Math.round(x);
27
21
 
28
22
 
29
23
 
30
- export const isNonZeroFiniteNumber = is;
24
+ export const isNonZeroFiniteNumber = (value) => Number.isFinite(value) && value !== 0;
31
25
 
32
26
 
33
27
 
@@ -38,7 +32,12 @@ export const isNonZeroFiniteNumber = is;
38
32
 
39
33
 
40
34
 
41
- export const asNonZeroFiniteNumber = castType;
35
+ export const asNonZeroFiniteNumber = (value) => {
36
+ if (!isNonZeroFiniteNumber(value)) {
37
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
38
+ }
39
+ return value;
40
+ };
42
41
 
43
42
 
44
43
 
@@ -53,7 +52,7 @@ export const NonZeroFiniteNumber = {
53
52
 
54
53
 
55
54
 
56
- is,
55
+ is: isNonZeroFiniteNumber,
57
56
 
58
57
 
59
58
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAMnE,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD,MAAM,EACJ,GAAG,EACH,QAAQ,EACR,GAAG,EACH,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,aAAa,EAAE,MAAM,GACtB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,iBAAiB,CAI3D;IACA,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,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,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAKR,GAAG,CAAC,CAAC;AAEP;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC;;;;;;OAMG;IACH,EAAE;IAEF;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;OAMG;IACH,IAAI;IAEJ;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;;;;;OAWG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-zero-finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,GAAG,EACH,GAAG,EACH,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,aAAa,IAAI,MAAM,GACxB,MAAM,yCAAyC,CAAC;AAOjD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD,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,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAKR,GAAG,CAAC,CAAC;AAEP;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAa,EACiB,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AAEzE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAQ,EACiB,EAAE;IAC3B,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,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,mBAAmB,GAAG;IACjC;;;;;;OAMG;IACH,EAAE,EAAE,qBAAqB;IAEzB;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;OAMG;IACH,IAAI;IAEJ;;;;;;OAMG;IACH,KAAK;IAEL;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;;;;;OAWG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type NonZeroInt = TtfImported_NonZeroInt;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-zero integer, `false` otherwise
11
11
  */
12
- export declare const isNonZeroInt: (a: number) => a is TtfImported_NonZeroInt;
12
+ export declare const isNonZeroInt: (value: number) => value is NonZeroInt;
13
13
  /**
14
14
  * Casts a `number` to the `NonZeroInt` branded type.
15
15
  *
@@ -20,14 +20,7 @@ export declare const isNonZeroInt: (a: number) => a is TtfImported_NonZeroInt;
20
20
  * @returns The value as a `NonZeroInt`
21
21
  * @throws {TypeError} If the value is not a non-zero integer
22
22
  */
23
- export declare const asNonZeroInt: <N extends number>(x: N) => number & {
24
- readonly "!=0": true;
25
- readonly Finite: true;
26
- readonly Int: true;
27
- readonly NaNValue: false;
28
- } & Readonly<{
29
- 'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
30
- }> & N;
23
+ export declare const asNonZeroInt: <N extends number>(value: N) => NonZeroInt & N;
31
24
  /**
32
25
  * Namespace providing type-safe operations for the `NonZeroInt` branded type.
33
26
  *
@@ -46,7 +39,7 @@ export declare const NonZeroInt: {
46
39
  * @returns `true` if the value is a non-zero integer, `false` otherwise
47
40
  * @see {@link isNonZeroInt} for usage examples
48
41
  */
49
- readonly is: (a: number) => a is TtfImported_NonZeroInt;
42
+ readonly is: typeof isNonZeroInt;
50
43
  /**
51
44
  * Returns the absolute value of a non-zero integer.
52
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAI1E,MAAM,MAAM,UAAU,GAAG,sBAAsB,CAAC;AA2BhD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,4CAAK,CAAC;AAE/B;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;;;;;;MAAW,CAAC;AAErC;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;;OAMG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAY1E,MAAM,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAMhD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,KAAK,IAAI,UACd,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,UAAU,GAAG,CAMtE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;;OAMG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;CAEK,CAAC"}
@@ -1,13 +1,6 @@
1
1
 
2
- import { TsDataForgeInternals } from '../refined-number-utils.mjs';
2
+ import { abs, max as max_, min as min_, mul, pow, randomNonZero as random, } from '../operators/non-zero-int.mjs';
3
3
  const typeNameInMessage = 'a non-zero integer';
4
- const { abs, castType, is, max: max_, min: min_, mul, pow, randomNonZero: random, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
5
- integerOrSafeInteger: 'Integer',
6
- nonZero: true,
7
- MIN_VALUE: -Number.MAX_VALUE,
8
- MAX_VALUE: Number.MAX_VALUE,
9
- typeNameInMessage,
10
- });
11
4
 
12
5
 
13
6
 
@@ -17,7 +10,7 @@ const { abs, castType, is, max: max_, min: min_, mul, pow, randomNonZero: random
17
10
 
18
11
 
19
12
 
20
- export const isNonZeroInt = is;
13
+ export const isNonZeroInt = (value) => Number.isInteger(value) && value !== 0;
21
14
 
22
15
 
23
16
 
@@ -28,7 +21,12 @@ export const isNonZeroInt = is;
28
21
 
29
22
 
30
23
 
31
- export const asNonZeroInt = castType;
24
+ export const asNonZeroInt = (value) => {
25
+ if (!isNonZeroInt(value)) {
26
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
27
+ }
28
+ return value;
29
+ };
32
30
 
33
31
 
34
32
 
@@ -47,7 +45,7 @@ export const NonZeroInt = {
47
45
 
48
46
 
49
47
 
50
- is,
48
+ is: isNonZeroInt,
51
49
 
52
50
 
53
51
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-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,GAAG,EACH,QAAQ,EACR,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,SAAS;IAC/B,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;;;;OAMG;IACH,EAAE;IAEF;;;;;;;;;OASG;IACH,GAAG;IAEH;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-zero-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,GAAG,EACH,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,aAAa,IAAI,MAAM,GACxB,MAAM,+BAA+B,CAAC;AAOvC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAuB,EAAE,CACjE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAmB,KAAQ,EAAkB,EAAE;IACzE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,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,UAAU,GAAG;IACxB;;;;;;OAMG;IACH,EAAE,EAAE,YAAY;IAEhB;;;;;;;;;OASG;IACH,GAAG;IAEH;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type NonZeroInt16 = TtfImported_NonZeroInt16;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-zero integer in [-2^15, 2^15), `false` otherwise
11
11
  */
12
- export declare const isNonZeroInt16: (a: number) => a is TtfImported_NonZeroInt16;
12
+ export declare const isNonZeroInt16: (value: number) => value is NonZeroInt16;
13
13
  /**
14
14
  * Casts a `number` to the `NonZeroInt16` branded type.
15
15
  *
@@ -20,23 +20,7 @@ export declare const isNonZeroInt16: (a: number) => a is TtfImported_NonZeroInt1
20
20
  * @returns The value as a `NonZeroInt16`
21
21
  * @throws {TypeError} If the value is not a non-zero integer in [-2^15, 2^15)
22
22
  */
23
- export declare const asNonZeroInt16: <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 "> -2^16": true;
30
- readonly "> -2^32": true;
31
- readonly ">= -2^15": true;
32
- readonly ">= -2^31": 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 asNonZeroInt16: <N extends number>(value: N) => NonZeroInt16 & N;
40
24
  /**
41
25
  * Namespace providing type-safe operations for the `NonZeroInt16` branded type.
42
26
  *
@@ -51,7 +35,7 @@ export declare const NonZeroInt16: {
51
35
  * @returns `true` if the value is a non-zero integer in [-2^15, 2^15), `false` otherwise
52
36
  * @see {@link isNonZeroInt16} for usage examples
53
37
  */
54
- readonly is: (a: number) => a is TtfImported_NonZeroInt16;
38
+ readonly is: typeof isNonZeroInt16;
55
39
  /**
56
40
  * The smallest value representable as `NonZeroInt16` (the lower saturation
57
41
  * target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAI9E,MAAM,MAAM,YAAY,GAAG,wBAAwB,CAAC;AA8BpD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,8CAAK,CAAC;AAEjC;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;MAAW,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAe9E,MAAM,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAMpD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,KAAK,IAAI,YAIlC,CAAC;AAEvB;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,SACtC,CAAC,KACP,YAAY,GAAG,CAMjB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;CAEK,CAAC"}
@@ -1,13 +1,6 @@
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-int16.mjs';
3
3
  const typeNameInMessage = 'a non-zero integer in [-2^15, 2^15)';
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
- MIN_VALUE: -(2 ** 15),
8
- MAX_VALUE: 2 ** 15 - 1,
9
- typeNameInMessage,
10
- });
11
4
 
12
5
 
13
6
 
@@ -17,7 +10,10 @@ const { MAX_VALUE, MIN_VALUE, abs, castType, fromNumber, is, max: max_, min: min
17
10
 
18
11
 
19
12
 
20
- export const isNonZeroInt16 = is;
13
+ export const isNonZeroInt16 = (value) => Number.isSafeInteger(value) &&
14
+ value !== 0 &&
15
+ -(2 ** 15) <= value &&
16
+ value <= 2 ** 15 - 1;
21
17
 
22
18
 
23
19
 
@@ -28,7 +24,12 @@ export const isNonZeroInt16 = is;
28
24
 
29
25
 
30
26
 
31
- export const asNonZeroInt16 = castType;
27
+ export const asNonZeroInt16 = (value) => {
28
+ if (!isNonZeroInt16(value)) {
29
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
30
+ }
31
+ return value;
32
+ };
32
33
 
33
34
 
34
35
 
@@ -43,7 +44,7 @@ export const NonZeroInt16 = {
43
44
 
44
45
 
45
46
 
46
- is,
47
+ is: isNonZeroInt16,
47
48
 
48
49
 
49
50
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-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,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,CAAC,CAAC,IAAI,EAAE,CAAC;IACrB,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;;;;;;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;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-zero-int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int16.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,iCAAiC,CAAC;AAOzC,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAyB,EAAE,CACrE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;IAC3B,KAAK,KAAK,CAAC;IACX,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK;IACnB,KAAK,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAQ,EACU,EAAE;IACpB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,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,YAAY,GAAG;IAC1B;;;;;;OAMG;IACH,EAAE,EAAE,cAAc;IAElB;;;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;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
@@ -9,7 +9,7 @@ export type NonZeroInt32 = TtfImported_NonZeroInt32;
9
9
  * @param value - The value to check
10
10
  * @returns `true` if the value is a non-zero integer in [-2^31, 2^31), `false` otherwise
11
11
  */
12
- export declare const isNonZeroInt32: (a: number) => a is TtfImported_NonZeroInt32;
12
+ export declare const isNonZeroInt32: (value: number) => value is NonZeroInt32;
13
13
  /**
14
14
  * Casts a `number` to the `NonZeroInt32` branded type.
15
15
  *
@@ -20,19 +20,7 @@ export declare const isNonZeroInt32: (a: number) => a is TtfImported_NonZeroInt3
20
20
  * @returns The value as a `NonZeroInt32`
21
21
  * @throws {TypeError} If the value is not a non-zero integer in [-2^31, 2^31)
22
22
  */
23
- export declare const asNonZeroInt32: <N extends number>(x: N) => number & {
24
- readonly "!=0": true;
25
- readonly "< 2^31": true;
26
- readonly "< 2^32": true;
27
- readonly "> -2^32": true;
28
- readonly ">= -2^31": 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 asNonZeroInt32: <N extends number>(value: N) => NonZeroInt32 & N;
36
24
  /**
37
25
  * Namespace providing type-safe operations for the `NonZeroInt32` branded type.
38
26
  *
@@ -47,7 +35,7 @@ export declare const NonZeroInt32: {
47
35
  * @returns `true` if the value is a non-zero integer in [-2^31, 2^31), `false` otherwise
48
36
  * @see {@link isNonZeroInt32} for usage examples
49
37
  */
50
- readonly is: (a: number) => a is TtfImported_NonZeroInt32;
38
+ readonly is: typeof isNonZeroInt32;
51
39
  /**
52
40
  * The smallest value representable as `NonZeroInt32` (the lower saturation
53
41
  * target of `fromNumber`).
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAI9E,MAAM,MAAM,YAAY,GAAG,wBAAwB,CAAC;AA8BpD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,8CAAK,CAAC;AAEjC;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;MAAW,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;CAEK,CAAC"}
1
+ {"version":3,"file":"non-zero-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAe9E,MAAM,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAMpD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,KAAK,IAAI,YAIlC,CAAC;AAEvB;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,SACtC,CAAC,KACP,YAAY,GAAG,CAMjB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;CAEK,CAAC"}
@@ -1,13 +1,6 @@
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-int32.mjs';
3
3
  const typeNameInMessage = 'a non-zero integer in [-2^31, 2^31)';
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
- MIN_VALUE: -(2 ** 31),
8
- MAX_VALUE: 2 ** 31 - 1,
9
- typeNameInMessage,
10
- });
11
4
 
12
5
 
13
6
 
@@ -17,7 +10,10 @@ const { MAX_VALUE, MIN_VALUE, abs, castType, fromNumber, is, max: max_, min: min
17
10
 
18
11
 
19
12
 
20
- export const isNonZeroInt32 = is;
13
+ export const isNonZeroInt32 = (value) => Number.isSafeInteger(value) &&
14
+ value !== 0 &&
15
+ -(2 ** 31) <= value &&
16
+ value <= 2 ** 31 - 1;
21
17
 
22
18
 
23
19
 
@@ -28,7 +24,12 @@ export const isNonZeroInt32 = is;
28
24
 
29
25
 
30
26
 
31
- export const asNonZeroInt32 = castType;
27
+ export const asNonZeroInt32 = (value) => {
28
+ if (!isNonZeroInt32(value)) {
29
+ throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
30
+ }
31
+ return value;
32
+ };
32
33
 
33
34
 
34
35
 
@@ -43,7 +44,7 @@ export const NonZeroInt32 = {
43
44
 
44
45
 
45
46
 
46
- is,
47
+ is: isNonZeroInt32,
47
48
 
48
49
 
49
50
 
@@ -1 +1 @@
1
- {"version":3,"file":"non-zero-int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-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,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,CAAC,CAAC,IAAI,EAAE,CAAC;IACrB,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACtB,iBAAiB;CACT,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;;;;;;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;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"non-zero-int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-int32.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,iCAAiC,CAAC;AAOzC,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAyB,EAAE,CACrE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;IAC3B,KAAK,KAAK,CAAC;IACX,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK;IACnB,KAAK,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAQ,EACU,EAAE;IACpB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,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,YAAY,GAAG;IAC1B;;;;;;OAMG;IACH,EAAE,EAAE,cAAc;IAElB;;;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;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAOR,GAAG,CAAC,CAAC;AAEP,UAAU,CAOR,IAAI,CAAC,CAAC"}