ts-data-forge 3.3.0 → 3.3.1

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 (424) hide show
  1. package/README.md +37 -13
  2. package/dist/array/impl/array-utils-creation.d.mts +116 -0
  3. package/dist/array/impl/array-utils-creation.d.mts.map +1 -0
  4. package/dist/array/impl/array-utils-creation.mjs +110 -0
  5. package/dist/array/impl/array-utils-creation.mjs.map +1 -0
  6. package/dist/array/impl/array-utils-element-access.d.mts +61 -0
  7. package/dist/array/impl/array-utils-element-access.d.mts.map +1 -0
  8. package/dist/array/impl/array-utils-element-access.mjs +66 -0
  9. package/dist/array/impl/array-utils-element-access.mjs.map +1 -0
  10. package/dist/array/impl/array-utils-iterators.d.mts +59 -0
  11. package/dist/array/impl/array-utils-iterators.d.mts.map +1 -0
  12. package/dist/array/impl/array-utils-iterators.mjs +104 -0
  13. package/dist/array/impl/array-utils-iterators.mjs.map +1 -0
  14. package/dist/array/impl/array-utils-modification.d.mts +154 -0
  15. package/dist/array/impl/array-utils-modification.d.mts.map +1 -0
  16. package/dist/array/impl/array-utils-modification.mjs +139 -0
  17. package/dist/array/impl/array-utils-modification.mjs.map +1 -0
  18. package/dist/array/impl/array-utils-reducing-value.d.mts +214 -0
  19. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -0
  20. package/dist/array/impl/array-utils-reducing-value.mjs +160 -0
  21. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -0
  22. package/dist/array/impl/array-utils-search.d.mts +179 -0
  23. package/dist/array/impl/array-utils-search.d.mts.map +1 -0
  24. package/dist/array/impl/array-utils-search.mjs +153 -0
  25. package/dist/array/impl/array-utils-search.mjs.map +1 -0
  26. package/dist/array/impl/array-utils-set-op.d.mts +100 -0
  27. package/dist/array/impl/array-utils-set-op.d.mts.map +1 -0
  28. package/dist/array/impl/array-utils-set-op.mjs +137 -0
  29. package/dist/array/impl/array-utils-set-op.mjs.map +1 -0
  30. package/dist/array/impl/array-utils-size.d.mts +24 -0
  31. package/dist/array/impl/array-utils-size.d.mts.map +1 -0
  32. package/dist/array/impl/array-utils-size.mjs +28 -0
  33. package/dist/array/impl/array-utils-size.mjs.map +1 -0
  34. package/dist/array/impl/array-utils-slice-clamped.d.mts +18 -0
  35. package/dist/array/impl/array-utils-slice-clamped.d.mts.map +1 -0
  36. package/dist/array/impl/array-utils-slice-clamped.mjs +49 -0
  37. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -0
  38. package/dist/array/impl/array-utils-slicing.d.mts +120 -0
  39. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -0
  40. package/dist/array/impl/array-utils-slicing.mjs +140 -0
  41. package/dist/array/impl/array-utils-slicing.mjs.map +1 -0
  42. package/dist/array/impl/array-utils-transformation.d.mts +348 -0
  43. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -0
  44. package/dist/array/impl/array-utils-transformation.mjs +331 -0
  45. package/dist/array/impl/array-utils-transformation.mjs.map +1 -0
  46. package/dist/array/impl/array-utils-validation.d.mts +149 -0
  47. package/dist/array/impl/array-utils-validation.d.mts.map +1 -0
  48. package/dist/array/impl/array-utils-validation.mjs +166 -0
  49. package/dist/array/impl/array-utils-validation.mjs.map +1 -0
  50. package/dist/array/impl/index.d.mts +13 -0
  51. package/dist/array/impl/index.d.mts.map +1 -0
  52. package/dist/array/impl/index.mjs +13 -0
  53. package/dist/array/impl/index.mjs.map +1 -0
  54. package/dist/array/index.d.mts +1 -1
  55. package/dist/array/index.d.mts.map +1 -1
  56. package/dist/array/index.mjs +2 -1
  57. package/dist/array/index.mjs.map +1 -1
  58. package/dist/collections/imap-mapped.d.mts +83 -253
  59. package/dist/collections/imap-mapped.d.mts.map +1 -1
  60. package/dist/collections/imap-mapped.mjs +33 -164
  61. package/dist/collections/imap-mapped.mjs.map +1 -1
  62. package/dist/collections/imap.d.mts +436 -163
  63. package/dist/collections/imap.d.mts.map +1 -1
  64. package/dist/collections/imap.mjs +74 -94
  65. package/dist/collections/imap.mjs.map +1 -1
  66. package/dist/collections/iset-mapped.d.mts +828 -345
  67. package/dist/collections/iset-mapped.d.mts.map +1 -1
  68. package/dist/collections/iset-mapped.mjs +200 -242
  69. package/dist/collections/iset-mapped.mjs.map +1 -1
  70. package/dist/collections/iset.d.mts +397 -205
  71. package/dist/collections/iset.d.mts.map +1 -1
  72. package/dist/collections/iset.mjs +102 -184
  73. package/dist/collections/iset.mjs.map +1 -1
  74. package/dist/collections/queue.d.mts +155 -135
  75. package/dist/collections/queue.d.mts.map +1 -1
  76. package/dist/collections/queue.mjs +55 -156
  77. package/dist/collections/queue.mjs.map +1 -1
  78. package/dist/collections/stack.d.mts +154 -154
  79. package/dist/collections/stack.d.mts.map +1 -1
  80. package/dist/collections/stack.mjs +54 -203
  81. package/dist/collections/stack.mjs.map +1 -1
  82. package/dist/entry-point.d.mts +1 -0
  83. package/dist/entry-point.d.mts.map +1 -1
  84. package/dist/entry-point.mjs +2 -1
  85. package/dist/entry-point.mjs.map +1 -1
  86. package/dist/expect-type.d.mts +43 -172
  87. package/dist/expect-type.d.mts.map +1 -1
  88. package/dist/expect-type.mjs +43 -172
  89. package/dist/expect-type.mjs.map +1 -1
  90. package/dist/functional/match.d.mts +35 -140
  91. package/dist/functional/match.d.mts.map +1 -1
  92. package/dist/functional/match.mjs.map +1 -1
  93. package/dist/functional/optional.d.mts +282 -160
  94. package/dist/functional/optional.d.mts.map +1 -1
  95. package/dist/functional/optional.mjs +131 -71
  96. package/dist/functional/optional.mjs.map +1 -1
  97. package/dist/functional/pipe.d.mts +59 -113
  98. package/dist/functional/pipe.d.mts.map +1 -1
  99. package/dist/functional/pipe.mjs.map +1 -1
  100. package/dist/functional/result.d.mts +433 -332
  101. package/dist/functional/result.d.mts.map +1 -1
  102. package/dist/functional/result.mjs +233 -239
  103. package/dist/functional/result.mjs.map +1 -1
  104. package/dist/globals.d.mts +12 -5
  105. package/dist/guard/has-key.d.mts +23 -74
  106. package/dist/guard/has-key.d.mts.map +1 -1
  107. package/dist/guard/has-key.mjs +23 -74
  108. package/dist/guard/has-key.mjs.map +1 -1
  109. package/dist/guard/is-non-empty-string.d.mts +20 -87
  110. package/dist/guard/is-non-empty-string.d.mts.map +1 -1
  111. package/dist/guard/is-non-empty-string.mjs +20 -87
  112. package/dist/guard/is-non-empty-string.mjs.map +1 -1
  113. package/dist/guard/is-non-null-object.d.mts +14 -84
  114. package/dist/guard/is-non-null-object.d.mts.map +1 -1
  115. package/dist/guard/is-non-null-object.mjs +14 -84
  116. package/dist/guard/is-non-null-object.mjs.map +1 -1
  117. package/dist/guard/is-primitive.d.mts +13 -126
  118. package/dist/guard/is-primitive.d.mts.map +1 -1
  119. package/dist/guard/is-primitive.mjs +13 -126
  120. package/dist/guard/is-primitive.mjs.map +1 -1
  121. package/dist/guard/is-record.d.mts +21 -132
  122. package/dist/guard/is-record.d.mts.map +1 -1
  123. package/dist/guard/is-record.mjs +21 -132
  124. package/dist/guard/is-record.mjs.map +1 -1
  125. package/dist/guard/is-type.d.mts +201 -238
  126. package/dist/guard/is-type.d.mts.map +1 -1
  127. package/dist/guard/is-type.mjs +201 -238
  128. package/dist/guard/is-type.mjs.map +1 -1
  129. package/dist/guard/key-is-in.d.mts +22 -139
  130. package/dist/guard/key-is-in.d.mts.map +1 -1
  131. package/dist/guard/key-is-in.mjs +22 -139
  132. package/dist/guard/key-is-in.mjs.map +1 -1
  133. package/dist/index.d.mts +0 -1
  134. package/dist/index.d.mts.map +1 -1
  135. package/dist/index.mjs +0 -1
  136. package/dist/index.mjs.map +1 -1
  137. package/dist/iterator/range.d.mts +29 -62
  138. package/dist/iterator/range.d.mts.map +1 -1
  139. package/dist/iterator/range.mjs.map +1 -1
  140. package/dist/json/json.d.mts +191 -121
  141. package/dist/json/json.d.mts.map +1 -1
  142. package/dist/json/json.mjs +238 -136
  143. package/dist/json/json.mjs.map +1 -1
  144. package/dist/number/branded-types/finite-number.d.mts +24 -156
  145. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  146. package/dist/number/branded-types/finite-number.mjs +27 -159
  147. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  148. package/dist/number/branded-types/int.d.mts +122 -120
  149. package/dist/number/branded-types/int.d.mts.map +1 -1
  150. package/dist/number/branded-types/int.mjs +122 -120
  151. package/dist/number/branded-types/int.mjs.map +1 -1
  152. package/dist/number/branded-types/int16.d.mts +22 -30
  153. package/dist/number/branded-types/int16.d.mts.map +1 -1
  154. package/dist/number/branded-types/int16.mjs +22 -30
  155. package/dist/number/branded-types/int16.mjs.map +1 -1
  156. package/dist/number/branded-types/int32.d.mts +22 -31
  157. package/dist/number/branded-types/int32.d.mts.map +1 -1
  158. package/dist/number/branded-types/int32.mjs +22 -31
  159. package/dist/number/branded-types/int32.mjs.map +1 -1
  160. package/dist/number/branded-types/non-negative-finite-number.d.mts +28 -36
  161. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  162. package/dist/number/branded-types/non-negative-finite-number.mjs +31 -39
  163. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  164. package/dist/number/branded-types/non-negative-int16.d.mts +24 -34
  165. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  166. package/dist/number/branded-types/non-negative-int16.mjs +24 -34
  167. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  168. package/dist/number/branded-types/non-negative-int32.d.mts +26 -35
  169. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  170. package/dist/number/branded-types/non-negative-int32.mjs +26 -35
  171. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  172. package/dist/number/branded-types/non-zero-finite-number.d.mts +22 -37
  173. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  174. package/dist/number/branded-types/non-zero-finite-number.mjs +25 -40
  175. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  176. package/dist/number/branded-types/non-zero-int.d.mts +15 -30
  177. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  178. package/dist/number/branded-types/non-zero-int.mjs +15 -30
  179. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  180. package/dist/number/branded-types/non-zero-int16.d.mts +27 -35
  181. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  182. package/dist/number/branded-types/non-zero-int16.mjs +27 -35
  183. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  184. package/dist/number/branded-types/non-zero-int32.d.mts +29 -36
  185. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  186. package/dist/number/branded-types/non-zero-int32.mjs +29 -36
  187. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  188. package/dist/number/branded-types/non-zero-safe-int.d.mts +37 -38
  189. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  190. package/dist/number/branded-types/non-zero-safe-int.mjs +39 -40
  191. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  192. package/dist/number/branded-types/non-zero-uint16.d.mts +24 -35
  193. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  194. package/dist/number/branded-types/non-zero-uint16.mjs +24 -35
  195. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  196. package/dist/number/branded-types/non-zero-uint32.d.mts +24 -35
  197. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  198. package/dist/number/branded-types/non-zero-uint32.mjs +24 -35
  199. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  200. package/dist/number/branded-types/positive-finite-number.d.mts +26 -40
  201. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  202. package/dist/number/branded-types/positive-finite-number.mjs +29 -43
  203. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  204. package/dist/number/branded-types/positive-int.d.mts +133 -123
  205. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  206. package/dist/number/branded-types/positive-int.mjs +133 -123
  207. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  208. package/dist/number/branded-types/positive-int16.d.mts +24 -35
  209. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  210. package/dist/number/branded-types/positive-int16.mjs +24 -35
  211. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  212. package/dist/number/branded-types/positive-int32.d.mts +24 -35
  213. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  214. package/dist/number/branded-types/positive-int32.mjs +24 -35
  215. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  216. package/dist/number/branded-types/positive-safe-int.d.mts +159 -33
  217. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  218. package/dist/number/branded-types/positive-safe-int.mjs +160 -34
  219. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  220. package/dist/number/branded-types/positive-uint16.d.mts +24 -35
  221. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  222. package/dist/number/branded-types/positive-uint16.mjs +24 -35
  223. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  224. package/dist/number/branded-types/positive-uint32.d.mts +26 -36
  225. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  226. package/dist/number/branded-types/positive-uint32.mjs +26 -36
  227. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  228. package/dist/number/branded-types/safe-int.d.mts +140 -99
  229. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  230. package/dist/number/branded-types/safe-int.mjs +142 -101
  231. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  232. package/dist/number/branded-types/safe-uint.d.mts +24 -33
  233. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  234. package/dist/number/branded-types/safe-uint.mjs +25 -34
  235. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  236. package/dist/number/branded-types/uint.d.mts +121 -30
  237. package/dist/number/branded-types/uint.d.mts.map +1 -1
  238. package/dist/number/branded-types/uint.mjs +121 -30
  239. package/dist/number/branded-types/uint.mjs.map +1 -1
  240. package/dist/number/branded-types/uint16.d.mts +26 -34
  241. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  242. package/dist/number/branded-types/uint16.mjs +26 -34
  243. package/dist/number/branded-types/uint16.mjs.map +1 -1
  244. package/dist/number/branded-types/uint32.d.mts +26 -68
  245. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  246. package/dist/number/branded-types/uint32.mjs +26 -68
  247. package/dist/number/branded-types/uint32.mjs.map +1 -1
  248. package/dist/number/enum/int8.d.mts +37 -101
  249. package/dist/number/enum/int8.d.mts.map +1 -1
  250. package/dist/number/enum/int8.mjs +39 -170
  251. package/dist/number/enum/int8.mjs.map +1 -1
  252. package/dist/number/enum/uint8.d.mts +45 -55
  253. package/dist/number/enum/uint8.d.mts.map +1 -1
  254. package/dist/number/enum/uint8.mjs +46 -155
  255. package/dist/number/enum/uint8.mjs.map +1 -1
  256. package/dist/number/num.d.mts +145 -206
  257. package/dist/number/num.d.mts.map +1 -1
  258. package/dist/number/num.mjs +143 -199
  259. package/dist/number/num.mjs.map +1 -1
  260. package/dist/number/refined-number-utils.d.mts +97 -21
  261. package/dist/number/refined-number-utils.d.mts.map +1 -1
  262. package/dist/number/refined-number-utils.mjs +91 -20
  263. package/dist/number/refined-number-utils.mjs.map +1 -1
  264. package/dist/object/object.d.mts +126 -208
  265. package/dist/object/object.d.mts.map +1 -1
  266. package/dist/object/object.mjs +68 -102
  267. package/dist/object/object.mjs.map +1 -1
  268. package/dist/others/cast-mutable.d.mts +12 -88
  269. package/dist/others/cast-mutable.d.mts.map +1 -1
  270. package/dist/others/cast-mutable.mjs +13 -89
  271. package/dist/others/cast-mutable.mjs.map +1 -1
  272. package/dist/others/cast-readonly.d.mts +12 -168
  273. package/dist/others/cast-readonly.d.mts.map +1 -1
  274. package/dist/others/cast-readonly.mjs +13 -169
  275. package/dist/others/cast-readonly.mjs.map +1 -1
  276. package/dist/others/if-then.d.mts +6 -83
  277. package/dist/others/if-then.d.mts.map +1 -1
  278. package/dist/others/if-then.mjs +6 -83
  279. package/dist/others/if-then.mjs.map +1 -1
  280. package/dist/others/map-nullable.d.mts +12 -136
  281. package/dist/others/map-nullable.d.mts.map +1 -1
  282. package/dist/others/map-nullable.mjs.map +1 -1
  283. package/dist/others/memoize-function.d.mts +14 -157
  284. package/dist/others/memoize-function.d.mts.map +1 -1
  285. package/dist/others/memoize-function.mjs +14 -157
  286. package/dist/others/memoize-function.mjs.map +1 -1
  287. package/dist/others/tuple.d.mts +33 -151
  288. package/dist/others/tuple.d.mts.map +1 -1
  289. package/dist/others/tuple.mjs +33 -151
  290. package/dist/others/tuple.mjs.map +1 -1
  291. package/dist/others/unknown-to-string.d.mts +11 -125
  292. package/dist/others/unknown-to-string.d.mts.map +1 -1
  293. package/dist/others/unknown-to-string.mjs +12 -126
  294. package/dist/others/unknown-to-string.mjs.map +1 -1
  295. package/dist/promise/promise.d.mts +33 -20
  296. package/dist/promise/promise.d.mts.map +1 -1
  297. package/dist/promise/promise.mjs +34 -21
  298. package/dist/promise/promise.mjs.map +1 -1
  299. package/package.json +47 -39
  300. package/src/array/impl/array-utils-creation.mts +192 -0
  301. package/src/array/{array-utils-creation.test.mts → impl/array-utils-creation.test.mts} +121 -72
  302. package/src/array/impl/array-utils-element-access.mts +115 -0
  303. package/src/array/impl/array-utils-element-access.test.mts +151 -0
  304. package/src/array/impl/array-utils-iterators.mts +79 -0
  305. package/src/array/impl/array-utils-iterators.test.mts +98 -0
  306. package/src/array/impl/array-utils-modification.mts +434 -0
  307. package/src/array/{array-utils-modification.test.mts → impl/array-utils-modification.test.mts} +41 -28
  308. package/src/array/{array-utils-overload-type-error.test.mts → impl/array-utils-overload-type-error.test.mts} +33 -33
  309. package/src/array/impl/array-utils-reducing-value.mts +551 -0
  310. package/src/array/{array-utils-reducing-value.test.mts → impl/array-utils-reducing-value.test.mts} +45 -50
  311. package/src/array/impl/array-utils-search.mts +509 -0
  312. package/src/array/impl/array-utils-search.test.mts +346 -0
  313. package/src/array/impl/array-utils-set-op.mts +166 -0
  314. package/src/array/{array-utils-set-op.test.mts → impl/array-utils-set-op.test.mts} +42 -35
  315. package/src/array/impl/array-utils-size.mts +30 -0
  316. package/src/array/impl/array-utils-size.test.mts +9 -0
  317. package/src/array/impl/array-utils-slice-clamped.mts +51 -0
  318. package/src/array/{array-utils-slice-clamped.test.mts → impl/array-utils-slice-clamped.test.mts} +12 -12
  319. package/src/array/impl/array-utils-slicing.mts +275 -0
  320. package/src/array/impl/array-utils-slicing.test.mts +158 -0
  321. package/src/array/impl/array-utils-transformation.mts +746 -0
  322. package/src/array/{array-utils-transformation.test.mts → impl/array-utils-transformation.test.mts} +662 -889
  323. package/src/array/impl/array-utils-validation.mts +241 -0
  324. package/src/array/{array-utils-validation.test.mts → impl/array-utils-validation.test.mts} +194 -107
  325. package/src/array/{array.test.mts → impl/array.test.mts} +2 -2
  326. package/src/array/impl/index.mts +12 -0
  327. package/src/array/index.mts +1 -1
  328. package/src/collections/imap-mapped.mts +99 -265
  329. package/src/collections/imap.mts +477 -174
  330. package/src/collections/imap.test.mts +12 -19
  331. package/src/collections/iset-mapped.mts +892 -358
  332. package/src/collections/iset.mts +429 -213
  333. package/src/collections/queue.mts +174 -200
  334. package/src/collections/stack.mts +172 -245
  335. package/src/collections/stack.test.mts +9 -1
  336. package/src/entry-point.mts +1 -0
  337. package/src/expect-type.mts +43 -172
  338. package/src/functional/match.mts +35 -145
  339. package/src/functional/optional.mts +285 -163
  340. package/src/functional/optional.test.mts +4 -1
  341. package/src/functional/pipe.mts +60 -113
  342. package/src/functional/result.mts +452 -351
  343. package/src/functional/result.test.mts +9 -2
  344. package/src/globals.d.mts +12 -5
  345. package/src/guard/has-key.mts +23 -74
  346. package/src/guard/is-non-empty-string.mts +20 -87
  347. package/src/guard/is-non-null-object.mts +14 -84
  348. package/src/guard/is-non-null-object.test.mts +1 -1
  349. package/src/guard/is-primitive.mts +13 -126
  350. package/src/guard/is-primitive.test.mts +1 -1
  351. package/src/guard/is-record.mts +21 -132
  352. package/src/guard/is-type.mts +201 -238
  353. package/src/guard/is-type.test.mts +7 -7
  354. package/src/guard/key-is-in.mts +22 -139
  355. package/src/index.mts +0 -1
  356. package/src/iterator/range.mts +29 -62
  357. package/src/json/json.mts +202 -134
  358. package/src/json/json.test.mts +1 -3
  359. package/src/number/branded-types/finite-number.mts +27 -159
  360. package/src/number/branded-types/int.mts +122 -120
  361. package/src/number/branded-types/int16.mts +22 -30
  362. package/src/number/branded-types/int16.test.mts +24 -24
  363. package/src/number/branded-types/int32.mts +22 -31
  364. package/src/number/branded-types/int32.test.mts +39 -39
  365. package/src/number/branded-types/non-negative-finite-number.mts +31 -39
  366. package/src/number/branded-types/non-negative-int16.mts +24 -34
  367. package/src/number/branded-types/non-negative-int16.test.mts +16 -16
  368. package/src/number/branded-types/non-negative-int32.mts +26 -35
  369. package/src/number/branded-types/non-negative-int32.test.mts +30 -30
  370. package/src/number/branded-types/non-zero-finite-number.mts +25 -40
  371. package/src/number/branded-types/non-zero-int.mts +15 -30
  372. package/src/number/branded-types/non-zero-int16.mts +27 -35
  373. package/src/number/branded-types/non-zero-int16.test.mts +26 -26
  374. package/src/number/branded-types/non-zero-int32.mts +29 -36
  375. package/src/number/branded-types/non-zero-int32.test.mts +45 -42
  376. package/src/number/branded-types/non-zero-safe-int.mts +39 -40
  377. package/src/number/branded-types/non-zero-uint16.mts +24 -35
  378. package/src/number/branded-types/non-zero-uint16.test.mts +16 -16
  379. package/src/number/branded-types/non-zero-uint32.mts +24 -35
  380. package/src/number/branded-types/non-zero-uint32.test.mts +28 -28
  381. package/src/number/branded-types/positive-finite-number.mts +29 -43
  382. package/src/number/branded-types/positive-int.mts +134 -124
  383. package/src/number/branded-types/positive-int16.mts +24 -35
  384. package/src/number/branded-types/positive-int16.test.mts +14 -14
  385. package/src/number/branded-types/positive-int32.mts +24 -35
  386. package/src/number/branded-types/positive-int32.test.mts +26 -26
  387. package/src/number/branded-types/positive-safe-int.mts +160 -34
  388. package/src/number/branded-types/positive-uint16.mts +24 -35
  389. package/src/number/branded-types/positive-uint16.test.mts +16 -16
  390. package/src/number/branded-types/positive-uint32.mts +26 -36
  391. package/src/number/branded-types/positive-uint32.test.mts +31 -28
  392. package/src/number/branded-types/safe-int.mts +142 -101
  393. package/src/number/branded-types/safe-uint.mts +25 -34
  394. package/src/number/branded-types/uint.mts +121 -30
  395. package/src/number/branded-types/uint16.mts +26 -34
  396. package/src/number/branded-types/uint16.test.mts +16 -16
  397. package/src/number/branded-types/uint32.mts +26 -68
  398. package/src/number/branded-types/uint32.test.mts +28 -28
  399. package/src/number/enum/int8.mts +39 -170
  400. package/src/number/enum/uint8.mts +46 -155
  401. package/src/number/num.mts +157 -212
  402. package/src/number/num.test.mts +4 -4
  403. package/src/number/refined-number-utils.mts +109 -26
  404. package/src/object/object.mts +130 -212
  405. package/src/object/object.test.mts +29 -0
  406. package/src/others/cast-mutable.mts +13 -89
  407. package/src/others/cast-mutable.test.mts +80 -0
  408. package/src/others/cast-readonly.mts +13 -169
  409. package/src/others/if-then.mts +6 -83
  410. package/src/others/map-nullable.mts +12 -136
  411. package/src/others/map-nullable.test.mts +6 -6
  412. package/src/others/memoize-function.mts +14 -157
  413. package/src/others/tuple.mts +33 -151
  414. package/src/others/unknown-to-string.mts +12 -126
  415. package/src/others/unknown-to-string.test.mts +13 -1
  416. package/src/promise/promise.mts +34 -21
  417. package/src/promise/promise.test.mts +43 -0
  418. package/dist/array/array-utils.d.mts +0 -2956
  419. package/dist/array/array-utils.d.mts.map +0 -1
  420. package/dist/array/array-utils.mjs +0 -1838
  421. package/dist/array/array-utils.mjs.map +0 -1
  422. package/src/array/array-utils-search.test.mts +0 -169
  423. package/src/array/array-utils-slicing.test.mts +0 -274
  424. package/src/array/array-utils.mts +0 -4834
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Namespace providing utility functions for number manipulation and validation.
3
3
  *
4
- * This namespace offers a comprehensive set of type-safe number utilities including:
4
+ * This namespace offers a comprehensive set of type-safe number utilities
5
+ * including:
6
+ *
5
7
  * - Type conversion and validation
6
8
  * - Type guards for numeric constraints (non-zero, non-negative, positive)
7
9
  * - Range checking and clamping operations
@@ -10,203 +12,197 @@
10
12
  *
11
13
  * Many functions in this namespace leverage TypeScript's type system to provide
12
14
  * compile-time guarantees about numeric constraints.
13
- *
14
- * @example
15
- * ```typescript
16
- * // Type conversion
17
- * const num = Num.from('123.45'); // 123.45
18
- * const invalid = Num.from('abc'); // NaN
19
- *
20
- * // Type guards
21
- * const value = 5;
22
- * if (Num.isPositive(value)) {
23
- * // value is typed as PositiveNumber & 5
24
- * }
25
- *
26
- * // Range checking
27
- * const isValid = Num.isInRange(0, 100)(50); // true
28
- *
29
- * // Clamping
30
- * const clamped = Num.clamp(150, 0, 100); // 100
31
- * const clampFn = Num.clamp(0, 100);
32
- * const result = clampFn(150); // 100
33
- * ```
34
15
  */
35
16
  var Num;
36
17
  (function (Num) {
37
18
  /**
38
19
  * Converts an unknown value to a number. Alias for the `Number` constructor.
39
- * @param n The value to convert.
40
- * @returns The numeric representation of `n`.
20
+ *
41
21
  * @example
42
- * ```typescript
43
- * Num.from('123.45'); // 123.45
44
- * Num.from('hello'); // NaN
22
+ *
23
+ * ```ts
24
+ * const input = '123.45';
25
+ *
26
+ * const result = Num.from(input);
27
+ *
28
+ * assert(result === 123.45);
45
29
  * ```
30
+ *
31
+ * @param n The value to convert.
32
+ * @returns The numeric representation of `n`.
46
33
  */
47
34
  Num.from = Number;
48
35
  /**
49
36
  * Type guard that checks if a number is non-zero.
50
37
  *
51
- * When this function returns `true`, TypeScript narrows the type to exclude zero,
52
- * providing compile-time safety for division operations and other calculations
53
- * that require non-zero values.
54
- *
55
- * @template N - The numeric literal type or number type to check
56
- * @param num - The number to check
57
- * @returns `true` if the number is not zero, `false` otherwise
38
+ * When this function returns `true`, TypeScript narrows the type to exclude
39
+ * zero, providing compile-time safety for division operations and other
40
+ * calculations that require non-zero values.
58
41
  *
59
42
  * @example
60
- * ```typescript
61
- * const value = 5;
43
+ *
44
+ * ```ts
45
+ * const value: number = 5;
46
+ *
62
47
  * if (Num.isNonZero(value)) {
63
- * // value is typed as NonZeroNumber & 5
64
- * const result = 10 / value; // Safe division
48
+ * // Safe to divide now that we know value is non-zero
49
+ * // eslint-disable-next-line total-functions/no-partial-division
50
+ * const inverted = 1 / value;
51
+ * assert(inverted === 0.2);
65
52
  * }
66
53
  *
67
- * // Works with numeric literals
68
- * const literal = 0 as 0 | 1 | 2;
69
- * if (Num.isNonZero(literal)) {
70
- * // literal is typed as 1 | 2
71
- * }
54
+ * assert.notOk(Num.isNonZero(0));
72
55
  * ```
56
+ *
57
+ * @template N - The numeric literal type or number type to check
58
+ * @param num - The number to check
59
+ * @returns `true` if the number is not zero, `false` otherwise
73
60
  */
74
61
  Num.isNonZero = (num) => num !== 0;
75
62
  /**
76
- * Type guard that checks if a number is non-negative (greater than or equal to zero).
63
+ * Type guard that checks if a number is non-negative (greater than or equal
64
+ * to zero).
77
65
  *
78
- * When this function returns `true`, TypeScript narrows the type to exclude negative
79
- * values, which is useful for operations that require non-negative inputs like
80
- * array indices or measurements.
81
- *
82
- * @template N - The numeric literal type or number type to check
83
- * @param num - The number to check
84
- * @returns `true` if the number is >= 0, `false` otherwise
66
+ * When this function returns `true`, TypeScript narrows the type to exclude
67
+ * negative values, which is useful for operations that require non-negative
68
+ * inputs like array indices or measurements.
85
69
  *
86
70
  * @example
87
- * ```typescript
88
- * const value = 10;
89
- * if (Num.isNonNegative(value)) {
90
- * // value is typed as NonNegativeNumber & 10
91
- * const arr = new Array(value); // Safe array creation
92
- * }
93
71
  *
94
- * // Type narrowing with unions
95
- * const index = -1 as -1 | 0 | 1;
96
- * if (Num.isNonNegative(index)) {
97
- * // index is typed as 0 | 1
72
+ * ```ts
73
+ * const candidate = 10;
74
+ *
75
+ * if (Num.isNonNegative(candidate)) {
76
+ * const index: number = candidate;
77
+ * assert(index === 10);
98
78
  * }
79
+ *
80
+ * assert.notOk(Num.isNonNegative(-1));
99
81
  * ```
82
+ *
83
+ * @template N - The numeric literal type or number type to check
84
+ * @param num - The number to check
85
+ * @returns `true` if the number is >= 0, `false` otherwise
100
86
  */
101
87
  Num.isNonNegative = (num) => num >= 0;
102
88
  /**
103
89
  * Type guard that checks if a number is positive (greater than zero).
104
90
  *
105
- * When this function returns `true`, TypeScript narrows the type to exclude zero
106
- * and negative values. This is particularly useful for validating inputs that
107
- * must be strictly positive, such as dimensions, counts, or rates.
108
- *
109
- * @template N - The numeric literal type or number type to check
110
- * @param num - The number to check
111
- * @returns `true` if the number is > 0, `false` otherwise
91
+ * When this function returns `true`, TypeScript narrows the type to exclude
92
+ * zero and negative values. This is particularly useful for validating inputs
93
+ * that must be strictly positive, such as dimensions, counts, or rates.
112
94
  *
113
95
  * @example
114
- * ```typescript
115
- * const count = 5;
116
- * if (Num.isPositive(count)) {
117
- * // count is typed as PositiveNumber & 5
118
- * const average = total / count; // Safe division
119
- * }
120
96
  *
121
- * // Type narrowing with numeric literals
122
- * const value = 0 as -1 | 0 | 1 | 2;
123
- * if (Num.isPositive(value)) {
124
- * // value is typed as 1 | 2
97
+ * ```ts
98
+ * const amount = 42;
99
+ *
100
+ * if (Num.isPositive(amount)) {
101
+ * assert.ok(amount > 0);
125
102
  * }
103
+ *
104
+ * assert.notOk(Num.isPositive(0));
126
105
  * ```
106
+ *
107
+ * @template N - The numeric literal type or number type to check
108
+ * @param num - The number to check
109
+ * @returns `true` if the number is > 0, `false` otherwise
127
110
  */
128
111
  Num.isPositive = (num) => num > 0;
129
112
  /**
130
- * Creates a function that checks if a number `x` is within the range `lowerBound <= x < upperBound`.
131
- * @param lowerBound The lower bound (inclusive).
132
- * @param upperBound The upper bound (exclusive).
133
- * @returns A function that takes a number `x` and returns `true` if `x` is in the range, `false` otherwise.
113
+ * Creates a function that checks if a number `x` is within the range
114
+ * `lowerBound <= x < upperBound`.
115
+ *
134
116
  * @example
135
- * ```typescript
136
- * const isInRange0to10 = Num.isInRange(0, 10);
137
- * isInRange0to10(5); // true
138
- * isInRange0to10(0); // true (inclusive lower bound)
139
- * isInRange0to10(10); // false (exclusive upper bound)
140
- * isInRange0to10(-1); // false
117
+ *
118
+ * ```ts
119
+ * const isGrade = Num.isInRange(0, 100);
120
+ *
121
+ * assert.ok(isGrade(50));
122
+ * assert.notOk(isGrade(100));
141
123
  * ```
124
+ *
125
+ * @param lowerBound The lower bound (inclusive).
126
+ * @param upperBound The upper bound (exclusive).
127
+ * @returns A function that takes a number `x` and returns `true` if `x` is in
128
+ * the range, `false` otherwise.
142
129
  */
143
130
  Num.isInRange = (lowerBound, upperBound) => (x) => lowerBound <= x && x < upperBound;
144
131
  /**
145
- * Creates a function that checks if a number `x` is within the range `lowerBound <= x <= upperBound`.
146
- * @param lowerBound The lower bound (inclusive).
147
- * @param upperBound The upper bound (inclusive).
148
- * @returns A function that takes a number `x` and returns `true` if `x` is in the range, `false` otherwise.
132
+ * Creates a function that checks if a number `x` is within the range
133
+ * `lowerBound <= x <= upperBound`.
134
+ *
149
135
  * @example
150
- * ```typescript
151
- * const inRange = Num.isInRangeInclusive(1, 10);
152
- * console.log(inRange(1)); // true (lower bound)
153
- * console.log(inRange(5)); // true
154
- * console.log(inRange(10)); // true (upper bound)
155
- * console.log(inRange(11)); // false
136
+ *
137
+ * ```ts
138
+ * const isPercentage = Num.isInRangeInclusive(0, 100);
139
+ *
140
+ * assert.ok(isPercentage(100));
141
+ * assert.notOk(isPercentage(-1));
156
142
  * ```
143
+ *
144
+ * @param lowerBound The lower bound (inclusive).
145
+ * @param upperBound The upper bound (inclusive).
146
+ * @returns A function that takes a number `x` and returns `true` if `x` is in
147
+ * the range, `false` otherwise.
157
148
  */
158
149
  Num.isInRangeInclusive = (lowerBound, upperBound) => (x) => lowerBound <= x && x <= upperBound;
159
150
  /**
160
- * Creates a type guard that checks if a number is an unsigned integer within a specified range.
151
+ * Creates a type guard that checks if a number is an unsigned integer within
152
+ * a specified range.
161
153
  *
162
154
  * This function returns a predicate that validates whether a number is:
155
+ *
163
156
  * - A safe integer (no floating point)
164
157
  * - Within the range [lowerBound, upperBound)
165
158
  *
166
159
  * The returned type guard provides precise type narrowing when the bounds are
167
160
  * SmallUint literals, making it ideal for array index validation.
168
161
  *
162
+ * @example
163
+ *
164
+ * ```ts
165
+ * const indexGuard = Num.isUintInRange(0, 5);
166
+ *
167
+ * assert.ok(indexGuard(3));
168
+ * assert.notOk(indexGuard(5));
169
+ * assert.notOk(indexGuard(-1));
170
+ * ```
171
+ *
169
172
  * @template L - The lower bound as a SmallUint literal type
170
173
  * @template U - The upper bound as a SmallUint literal type
171
174
  * @param lowerBound - The minimum value (inclusive)
172
175
  * @param upperBound - The maximum value (exclusive)
173
176
  * @returns A type guard function that validates and narrows number types
174
- *
175
- * @example
176
- * ```typescript
177
- * // Custom range validation
178
- * const isValidPercentage = Num.isUintInRange(0, 101);
179
- * if (isValidPercentage(value)) {
180
- * // value is typed as 0 | 1 | ... | 100
181
- * }
182
- * ```
183
177
  */
184
178
  Num.isUintInRange = (lowerBound, upperBound) => (x) => Number.isSafeInteger(x) && lowerBound <= x && x < upperBound;
185
179
  /**
186
- * Creates a type guard that checks if a number is an unsigned integer within a specified inclusive range.
180
+ * Creates a type guard that checks if a number is an unsigned integer within
181
+ * a specified inclusive range.
187
182
  *
188
183
  * This function returns a predicate that validates whether a number is:
184
+ *
189
185
  * - A safe integer (no floating point)
190
186
  * - Within the range [lowerBound, upperBound] (both bounds inclusive)
191
187
  *
192
188
  * The returned type guard provides precise type narrowing when the bounds are
193
- * SmallUint literals, useful for validating scores, percentages, or other bounded values.
189
+ * SmallUint literals, useful for validating scores, percentages, or other
190
+ * bounded values.
191
+ *
192
+ * @example
193
+ *
194
+ * ```ts
195
+ * const inclusiveGuard = Num.isUintInRangeInclusive(0, 5);
196
+ *
197
+ * assert.ok(inclusiveGuard(5));
198
+ * assert.notOk(inclusiveGuard(6));
199
+ * ```
194
200
  *
195
201
  * @template L - The lower bound as a SmallUint literal type
196
202
  * @template U - The upper bound as a SmallUint literal type
197
203
  * @param lowerBound - The minimum value (inclusive)
198
204
  * @param upperBound - The maximum value (inclusive)
199
205
  * @returns A type guard function that validates and narrows number types
200
- *
201
- * @example
202
- * ```typescript
203
- * const isValidScore = Num.isUintInRangeInclusive(0, 100);
204
- * const score: number = getTestScore();
205
- * if (isValidScore(score)) {
206
- * // score is typed as 0 | 1 | 2 | ... | 100
207
- * const grade = calculateGrade(score);
208
- * }
209
- * ```
210
206
  */
211
207
  Num.isUintInRangeInclusive = (lowerBound, upperBound) => (x) => Number.isSafeInteger(x) && lowerBound <= x && x <= upperBound;
212
208
  function clamp(...args) {
@@ -227,31 +223,17 @@ var Num;
227
223
  /**
228
224
  * Performs type-safe division with compile-time zero-check.
229
225
  *
230
- * This function leverages TypeScript's type system to prevent division by zero
231
- * at compile time. The divisor must be typed as NonZeroNumber or a non-zero
232
- * numeric literal.
226
+ * This function leverages TypeScript's type system to prevent division by
227
+ * zero at compile time. The divisor must be typed as NonZeroNumber or a
228
+ * non-zero numeric literal.
233
229
  *
234
230
  * @param a - The dividend
235
231
  * @param b - The divisor (must be non-zero, enforced by types)
236
232
  * @returns The quotient of a / b
237
- *
238
- * @example
239
- * ```typescript
240
- * const result = Num.div(10, 2); // 5
241
- * // Num.div(10, 0); // ❌ TypeScript error: Type '0' is not assignable
242
- *
243
- * // With type guards
244
- * const divisor: number = getDivisor();
245
- * if (Num.isNonZero(divisor)) {
246
- * const result = Num.div(100, divisor); // ✅ Safe
247
- * }
248
- *
249
- * // With branded types
250
- * const nonZero = asNonZeroNumber(5);
251
- * const result3 = Num.div(20, nonZero); // 4
252
- * ```
253
233
  */
254
- Num.div = (a, b) => a / b;
234
+ Num.div = (a, b) =>
235
+ // eslint-disable-next-line total-functions/no-partial-division
236
+ a / b;
255
237
  /**
256
238
  * Performs integer division using floor division.
257
239
  *
@@ -264,32 +246,23 @@ var Num;
264
246
  * @param a - The dividend
265
247
  * @param b - The divisor
266
248
  * @returns The integer quotient, or `NaN` if b is zero
267
- *
268
- * @example
269
- * ```typescript
270
- * Num.divInt(10, 3); // 3
271
- * Num.divInt(10, -3); // -4 (floor division)
272
- * ```
273
249
  */
274
- Num.divInt = (a, b) => Math.floor(Math.floor(a) / Math.floor(b));
250
+ Num.divInt = (a, b) =>
251
+ // eslint-disable-next-line total-functions/no-partial-division
252
+ Math.floor(Math.floor(a) / Math.floor(b));
275
253
  /**
276
254
  * Rounds a number to a specified number of decimal places.
277
255
  *
278
- * Uses the standard rounding algorithm (round half up) to round the number
279
- * to the given precision. The precision must be a positive safe integer.
256
+ * Uses the standard rounding algorithm (round half up) to round the number to
257
+ * the given precision. The precision must be a positive safe integer.
280
258
  *
281
259
  * @param num - The number to round
282
260
  * @param precision - The number of decimal places (must be positive)
283
261
  * @returns The rounded number
284
- *
285
- * @example
286
- * ```typescript
287
- * Num.roundAt(3.14159, 2); // 3.14
288
- * Num.roundAt(10.5, 0); // 11
289
- * ```
290
262
  */
291
263
  Num.roundAt = (num, precision) => {
292
264
  const digit = 10 ** precision;
265
+ // eslint-disable-next-line total-functions/no-partial-division
293
266
  return Math.round(num * digit) / digit;
294
267
  };
295
268
  /**
@@ -301,35 +274,24 @@ var Num;
301
274
  *
302
275
  * @param num - The number to round
303
276
  * @returns The rounded integer as an Int branded type
304
- *
305
- * @example
306
- * ```typescript
307
- * Num.roundToInt(3.2); // 3
308
- * Num.roundToInt(3.5); // 4
309
- * ```
310
277
  */
311
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
278
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
312
279
  Num.roundToInt = (num) => (0 | (num + 0.5));
313
280
  /**
314
281
  * Creates a reusable rounding function with a fixed precision.
315
282
  *
316
- * This is a curried version of roundAt that returns a function configured
317
- * to always round to the specified number of decimal places. Useful for
318
- * creating consistent rounding behavior across multiple values.
283
+ * This is a curried version of roundAt that returns a function configured to
284
+ * always round to the specified number of decimal places. Useful for creating
285
+ * consistent rounding behavior across multiple values.
319
286
  *
320
287
  * @param digit - The number of decimal places for rounding
321
288
  * @returns A function that rounds numbers to the specified precision
322
- *
323
- * @example
324
- * ```typescript
325
- * const roundTo2 = Num.round(2);
326
- * roundTo2(3.14159); // 3.14
327
- * roundTo2(2.71828); // 2.72
328
- * ```
329
289
  */
330
290
  Num.round = (digit) => {
331
291
  const powAmount = 10 ** digit;
332
- return (target) => Num.roundToInt(powAmount * target) / powAmount;
292
+ return (target) =>
293
+ // eslint-disable-next-line total-functions/no-partial-division
294
+ Num.roundToInt(powAmount * target) / powAmount;
333
295
  };
334
296
  /**
335
297
  * Converts NaN values to undefined while preserving all other numbers.
@@ -341,56 +303,38 @@ var Num;
341
303
  * @template N - The numeric type (literal or number)
342
304
  * @param num - The number to check
343
305
  * @returns The original number if not NaN, otherwise undefined
344
- *
345
- * @example
346
- * ```typescript
347
- * Num.mapNaN2Undefined(42); // 42
348
- * Num.mapNaN2Undefined(NaN); // undefined
349
- * ```
350
306
  */
351
307
  Num.mapNaN2Undefined = (num) => Number.isNaN(num)
352
308
  ? undefined
353
- : // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
309
+ : // eslint-disable-next-line total-functions/no-unsafe-type-assertion
354
310
  num;
355
311
  /**
356
312
  * Type-safe increment operation for SmallUint values.
357
313
  *
358
- * Increments a SmallUint (0-40) by 1 with the result type computed at
359
- * compile time. This provides type-level arithmetic for small unsigned
360
- * integers, useful for type-safe counter operations.
314
+ * Increments a SmallUint (0-40) by 1 with the result type computed at compile
315
+ * time. This provides type-level arithmetic for small unsigned integers,
316
+ * useful for type-safe counter operations.
361
317
  *
362
318
  * @template N - A SmallUint literal type (0-40)
363
319
  * @param n - The SmallUint value to increment
364
320
  * @returns The incremented value with type Increment<N>
365
- *
366
- * @example
367
- * ```typescript
368
- * const zero = 0 as 0;
369
- * const one = Num.increment(zero); // type is 1, value is 1
370
- * ```
371
321
  */
372
322
  Num.increment = (n) =>
373
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
323
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
374
324
  (n + 1);
375
325
  /**
376
326
  * Type-safe decrement operation for positive SmallInt values.
377
327
  *
378
- * Decrements a positive SmallInt (1-40) by 1 with the result type computed
379
- * at compile time. This provides type-level arithmetic for small positive
328
+ * Decrements a positive SmallInt (1-40) by 1 with the result type computed at
329
+ * compile time. This provides type-level arithmetic for small positive
380
330
  * integers, useful for type-safe countdown operations.
381
331
  *
382
332
  * @template N - A positive SmallInt literal type (1-40)
383
333
  * @param n - The positive SmallInt value to decrement
384
334
  * @returns The decremented value with type Decrement<N>
385
- *
386
- * @example
387
- * ```typescript
388
- * const three = 3 as 3;
389
- * const two = Num.decrement(three); // type is 2, value is 2
390
- * ```
391
335
  */
392
336
  Num.decrement = (n) =>
393
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
337
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
394
338
  (n - 1);
395
339
  })(Num || (Num = {}));
396
340
 
@@ -1 +1 @@
1
- {"version":3,"file":"num.mjs","sources":["../../src/number/num.mts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;IACc;AAAjB,CAAA,UAAiB,GAAG,EAAA;AAClB;;;;;;;;;AASG;IACU,GAAA,CAAA,IAAI,GAA2B,MAAM;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;IACU,GAAA,CAAA,SAAS,GAAG,CACvB,GAAM,KAC0C,GAAG,KAAK,CAAC;AAI3D;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;IACU,GAAA,CAAA,aAAa,GAAG,CAC3B,GAAM,KAEN,GAAG,IAAI,CAAC;AAEV;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;IACU,GAAA,CAAA,UAAU,GAAG,CACxB,GAAM,KAEN,GAAG,GAAG,CAAC;AAET;;;;;;;;;;;;;AAaG;IACU,GAAA,CAAA,SAAS,GACpB,CAAC,UAAkB,EAAE,UAAkB,KACvC,CAAC,CAAS,KACR,UAAU,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