ts-data-forge 14.7.1 → 14.8.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 (281) hide show
  1. package/README.md +21 -34
  2. package/dist/array/impl/array-utils-creation.d.mts +3 -3
  3. package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
  4. package/dist/array/impl/array-utils-creation.mjs.map +1 -1
  5. package/dist/array/impl/array-utils-element-access.d.mts +2 -2
  6. package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
  7. package/dist/array/impl/array-utils-element-access.mjs +1 -1
  8. package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
  9. package/dist/array/impl/array-utils-iterators.d.mts +1 -1
  10. package/dist/array/impl/array-utils-iterators.d.mts.map +1 -1
  11. package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts +1 -1
  12. package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts.map +1 -1
  13. package/dist/array/impl/array-utils-length-bounded-array-guard.d.mts +9 -9
  14. package/dist/array/impl/array-utils-length-bounded-array-guard.d.mts.map +1 -1
  15. package/dist/array/impl/array-utils-length-bounded-array-guard.mjs +1 -1
  16. package/dist/array/impl/array-utils-length-bounded-array-guard.mjs.map +1 -1
  17. package/dist/array/impl/array-utils-length-bounded-tuple-cast.d.mts +2 -2
  18. package/dist/array/impl/array-utils-length-bounded-tuple-cast.d.mts.map +1 -1
  19. package/dist/array/impl/array-utils-length-bounded-tuple-guard.d.mts +3 -3
  20. package/dist/array/impl/array-utils-length-bounded-tuple-guard.d.mts.map +1 -1
  21. package/dist/array/impl/array-utils-length-bounded-tuple-guard.mjs +1 -1
  22. package/dist/array/impl/array-utils-length-bounded-tuple-guard.mjs.map +1 -1
  23. package/dist/array/impl/array-utils-modification.d.mts +2 -2
  24. package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
  25. package/dist/array/impl/array-utils-reducing-value.d.mts +2 -2
  26. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
  27. package/dist/array/impl/array-utils-reducing-value.mjs +3 -4
  28. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  29. package/dist/array/impl/array-utils-search.d.mts +1 -1
  30. package/dist/array/impl/array-utils-search.d.mts.map +1 -1
  31. package/dist/array/impl/array-utils-set-op.d.mts +1 -1
  32. package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
  33. package/dist/array/impl/array-utils-size.d.mts +2 -2
  34. package/dist/array/impl/array-utils-size.d.mts.map +1 -1
  35. package/dist/array/impl/array-utils-slice-clamped.d.mts +1 -1
  36. package/dist/array/impl/array-utils-slice-clamped.d.mts.map +1 -1
  37. package/dist/array/impl/array-utils-slicing.d.mts +2 -2
  38. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
  39. package/dist/array/impl/array-utils-transformation.d.mts +2 -2
  40. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
  41. package/dist/array/impl/array-utils-transformation.mjs +6 -3
  42. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  43. package/dist/array/impl/array-utils-validation.d.mts +2 -2
  44. package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
  45. package/dist/collections/imap-mapped.d.mts +2 -2
  46. package/dist/collections/imap-mapped.d.mts.map +1 -1
  47. package/dist/collections/imap-mapped.mjs +10 -7
  48. package/dist/collections/imap-mapped.mjs.map +1 -1
  49. package/dist/collections/imap.d.mts +2 -2
  50. package/dist/collections/imap.d.mts.map +1 -1
  51. package/dist/collections/imap.mjs +10 -7
  52. package/dist/collections/imap.mjs.map +1 -1
  53. package/dist/collections/iset-mapped.d.mts +2 -2
  54. package/dist/collections/iset-mapped.d.mts.map +1 -1
  55. package/dist/collections/iset-mapped.mjs +6 -3
  56. package/dist/collections/iset-mapped.mjs.map +1 -1
  57. package/dist/collections/iset.d.mts +2 -2
  58. package/dist/collections/iset.d.mts.map +1 -1
  59. package/dist/collections/iset.mjs +5 -5
  60. package/dist/collections/iset.mjs.map +1 -1
  61. package/dist/collections/queue.d.mts +1 -1
  62. package/dist/collections/queue.d.mts.map +1 -1
  63. package/dist/collections/stack.d.mts +1 -1
  64. package/dist/collections/stack.d.mts.map +1 -1
  65. package/dist/guard/is-non-empty-string.d.mts +1 -1
  66. package/dist/guard/is-non-empty-string.d.mts.map +1 -1
  67. package/dist/guard/is-primitive.d.mts +1 -1
  68. package/dist/guard/is-primitive.d.mts.map +1 -1
  69. package/dist/guard/is-type.d.mts +1 -1
  70. package/dist/guard/is-type.d.mts.map +1 -1
  71. package/dist/iterator/range.d.mts +5 -4
  72. package/dist/iterator/range.d.mts.map +1 -1
  73. package/dist/iterator/range.mjs.map +1 -1
  74. package/dist/json/json.d.mts +29 -32
  75. package/dist/json/json.d.mts.map +1 -1
  76. package/dist/json/json.mjs +1 -4
  77. package/dist/json/json.mjs.map +1 -1
  78. package/dist/number/branded-types/finite-number.d.mts +1 -1
  79. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  80. package/dist/number/branded-types/int.d.mts +2 -2
  81. package/dist/number/branded-types/int.d.mts.map +1 -1
  82. package/dist/number/branded-types/int16.d.mts +1 -1
  83. package/dist/number/branded-types/int16.d.mts.map +1 -1
  84. package/dist/number/branded-types/int32.d.mts +1 -1
  85. package/dist/number/branded-types/int32.d.mts.map +1 -1
  86. package/dist/number/branded-types/negative-finite-number.d.mts +1 -1
  87. package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
  88. package/dist/number/branded-types/negative-int.d.mts +1 -1
  89. package/dist/number/branded-types/negative-int.d.mts.map +1 -1
  90. package/dist/number/branded-types/negative-safe-int.d.mts +1 -1
  91. package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
  92. package/dist/number/branded-types/non-negative-finite-number.d.mts +1 -1
  93. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  94. package/dist/number/branded-types/non-negative-int16.d.mts +1 -1
  95. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  96. package/dist/number/branded-types/non-negative-int32.d.mts +1 -1
  97. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  98. package/dist/number/branded-types/non-positive-finite-number.d.mts +1 -1
  99. package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
  100. package/dist/number/branded-types/non-positive-int.d.mts +1 -1
  101. package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
  102. package/dist/number/branded-types/non-positive-safe-int.d.mts +1 -1
  103. package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
  104. package/dist/number/branded-types/non-zero-finite-number.d.mts +1 -1
  105. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  106. package/dist/number/branded-types/non-zero-int.d.mts +1 -1
  107. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  108. package/dist/number/branded-types/non-zero-int16.d.mts +1 -1
  109. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  110. package/dist/number/branded-types/non-zero-int32.d.mts +1 -1
  111. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  112. package/dist/number/branded-types/non-zero-safe-int.d.mts +1 -1
  113. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  114. package/dist/number/branded-types/non-zero-uint16.d.mts +1 -1
  115. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  116. package/dist/number/branded-types/non-zero-uint32.d.mts +1 -1
  117. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  118. package/dist/number/branded-types/positive-finite-number.d.mts +1 -1
  119. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  120. package/dist/number/branded-types/positive-int.d.mts +2 -2
  121. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  122. package/dist/number/branded-types/positive-int16.d.mts +1 -1
  123. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  124. package/dist/number/branded-types/positive-int32.d.mts +1 -1
  125. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  126. package/dist/number/branded-types/positive-safe-int.d.mts +2 -2
  127. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  128. package/dist/number/branded-types/positive-uint16.d.mts +1 -1
  129. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  130. package/dist/number/branded-types/positive-uint32.d.mts +1 -1
  131. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  132. package/dist/number/branded-types/safe-int.d.mts +2 -2
  133. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  134. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  135. package/dist/number/branded-types/safe-uint.d.mts +1 -1
  136. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  137. package/dist/number/branded-types/uint.d.mts +2 -2
  138. package/dist/number/branded-types/uint.d.mts.map +1 -1
  139. package/dist/number/branded-types/uint16.d.mts +1 -1
  140. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  141. package/dist/number/branded-types/uint32.d.mts +1 -1
  142. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  143. package/dist/number/enum/int8.d.mts +1 -1
  144. package/dist/number/enum/int8.d.mts.map +1 -1
  145. package/dist/number/enum/uint8.d.mts +1 -1
  146. package/dist/number/enum/uint8.d.mts.map +1 -1
  147. package/dist/number/num-arithmetic-types.d.mts +1 -1
  148. package/dist/number/num-arithmetic-types.d.mts.map +1 -1
  149. package/dist/number/num.d.mts +3 -3
  150. package/dist/number/num.d.mts.map +1 -1
  151. package/dist/number/refined-number-utils.d.mts +2 -2
  152. package/dist/number/refined-number-utils.d.mts.map +1 -1
  153. package/dist/number/refined-number-utils.mjs +6 -4
  154. package/dist/number/refined-number-utils.mjs.map +1 -1
  155. package/dist/object/object.d.mts +5 -8
  156. package/dist/object/object.d.mts.map +1 -1
  157. package/dist/object/object.mjs +16 -13
  158. package/dist/object/object.mjs.map +1 -1
  159. package/dist/others/cast-mutable.d.mts +1 -1
  160. package/dist/others/cast-mutable.d.mts.map +1 -1
  161. package/dist/others/cast-readonly.d.mts +1 -1
  162. package/dist/others/cast-readonly.d.mts.map +1 -1
  163. package/dist/others/debounce-function.d.mts.map +1 -1
  164. package/dist/others/debounce-function.mjs +1 -5
  165. package/dist/others/debounce-function.mjs.map +1 -1
  166. package/dist/others/memoize-function.d.mts +1 -1
  167. package/dist/others/memoize-function.d.mts.map +1 -1
  168. package/dist/string/str.d.mts +26 -18
  169. package/dist/string/str.d.mts.map +1 -1
  170. package/dist/string/str.mjs +9 -1
  171. package/dist/string/str.mjs.map +1 -1
  172. package/dist/types.d.mts +1 -1
  173. package/dist/types.d.mts.map +1 -1
  174. package/package.json +31 -30
  175. package/src/array/impl/array-utils-creation.mts +24 -22
  176. package/src/array/impl/array-utils-creation.test.mts +25 -22
  177. package/src/array/impl/array-utils-element-access.mts +7 -7
  178. package/src/array/impl/array-utils-element-access.test.mts +2 -2
  179. package/src/array/impl/array-utils-iterators.mts +1 -1
  180. package/src/array/impl/array-utils-iterators.test.mts +1 -1
  181. package/src/array/impl/array-utils-length-bounded-array-cast.mts +7 -7
  182. package/src/array/impl/array-utils-length-bounded-array-cast.test.mts +6 -6
  183. package/src/array/impl/array-utils-length-bounded-array-guard.mts +15 -15
  184. package/src/array/impl/array-utils-length-bounded-array-guard.test.mts +66 -54
  185. package/src/array/impl/array-utils-length-bounded-tuple-cast.mts +6 -6
  186. package/src/array/impl/array-utils-length-bounded-tuple-cast.test.mts +10 -10
  187. package/src/array/impl/array-utils-length-bounded-tuple-guard.mts +8 -8
  188. package/src/array/impl/array-utils-length-bounded-tuple-guard.test.mts +38 -28
  189. package/src/array/impl/array-utils-length-constraint-preservation.test.mts +14 -14
  190. package/src/array/impl/array-utils-modification.mts +12 -12
  191. package/src/array/impl/array-utils-modification.test.mts +7 -7
  192. package/src/array/impl/array-utils-overload-type-error.test.mts +1 -1
  193. package/src/array/impl/array-utils-reducing-value.mts +9 -11
  194. package/src/array/impl/array-utils-reducing-value.test.mts +2 -2
  195. package/src/array/impl/array-utils-search.mts +4 -4
  196. package/src/array/impl/array-utils-search.test.mts +25 -17
  197. package/src/array/impl/array-utils-set-op.mts +1 -1
  198. package/src/array/impl/array-utils-shape-invariants.test.mts +8 -8
  199. package/src/array/impl/array-utils-size.mts +5 -5
  200. package/src/array/impl/array-utils-slice-clamped.mts +2 -2
  201. package/src/array/impl/array-utils-slicing.mts +8 -8
  202. package/src/array/impl/array-utils-slicing.test.mts +1 -1
  203. package/src/array/impl/array-utils-transformation.mts +26 -24
  204. package/src/array/impl/array-utils-transformation.test.mts +12 -10
  205. package/src/array/impl/array-utils-validation.mts +7 -7
  206. package/src/array/impl/array-utils-validation.test.mts +39 -39
  207. package/src/array/impl/array.test.mts +1 -1
  208. package/src/collections/imap-mapped.mts +15 -9
  209. package/src/collections/imap-mapped.test.mts +1 -1
  210. package/src/collections/imap.mts +15 -9
  211. package/src/collections/imap.test.mts +7 -5
  212. package/src/collections/iset-mapped.mts +14 -8
  213. package/src/collections/iset.mts +12 -10
  214. package/src/collections/iset.test.mts +14 -12
  215. package/src/collections/queue.mts +1 -1
  216. package/src/collections/stack.mts +1 -1
  217. package/src/collections/stack.test.mts +8 -6
  218. package/src/guard/is-error.test.mts +6 -4
  219. package/src/guard/is-non-empty-string.mts +1 -1
  220. package/src/guard/is-non-empty-string.test.mts +15 -11
  221. package/src/guard/is-primitive.mts +1 -1
  222. package/src/guard/is-type.mts +1 -1
  223. package/src/guard/is-type.test.mts +87 -59
  224. package/src/iterator/range.mts +5 -9
  225. package/src/iterator/range.test.mts +29 -0
  226. package/src/json/json.mts +32 -35
  227. package/src/json/json.test.mts +106 -89
  228. package/src/number/branded-types/finite-number.mts +4 -4
  229. package/src/number/branded-types/int.mts +2 -2
  230. package/src/number/branded-types/int16.mts +1 -1
  231. package/src/number/branded-types/int32.mts +1 -1
  232. package/src/number/branded-types/negative-finite-number.mts +1 -1
  233. package/src/number/branded-types/negative-finite-number.test.mts +4 -4
  234. package/src/number/branded-types/negative-int.mts +3 -3
  235. package/src/number/branded-types/negative-int.test.mts +1 -1
  236. package/src/number/branded-types/negative-safe-int.mts +3 -3
  237. package/src/number/branded-types/negative-safe-int.test.mts +1 -1
  238. package/src/number/branded-types/non-negative-finite-number.mts +3 -3
  239. package/src/number/branded-types/non-negative-int16.mts +1 -1
  240. package/src/number/branded-types/non-negative-int32.mts +1 -1
  241. package/src/number/branded-types/non-positive-finite-number.mts +1 -1
  242. package/src/number/branded-types/non-positive-int.mts +1 -1
  243. package/src/number/branded-types/non-positive-safe-int.mts +1 -1
  244. package/src/number/branded-types/non-zero-finite-number.mts +5 -5
  245. package/src/number/branded-types/non-zero-int.mts +1 -1
  246. package/src/number/branded-types/non-zero-int16.mts +1 -1
  247. package/src/number/branded-types/non-zero-int32.mts +1 -1
  248. package/src/number/branded-types/non-zero-safe-int.mts +4 -4
  249. package/src/number/branded-types/non-zero-uint16.mts +1 -1
  250. package/src/number/branded-types/non-zero-uint32.mts +1 -1
  251. package/src/number/branded-types/positive-finite-number.mts +4 -4
  252. package/src/number/branded-types/positive-int.mts +2 -2
  253. package/src/number/branded-types/positive-int16.mts +1 -1
  254. package/src/number/branded-types/positive-int32.mts +1 -1
  255. package/src/number/branded-types/positive-safe-int.mts +4 -4
  256. package/src/number/branded-types/positive-uint16.mts +1 -1
  257. package/src/number/branded-types/positive-uint32.mts +1 -1
  258. package/src/number/branded-types/safe-int.mts +2 -5
  259. package/src/number/branded-types/safe-uint.mts +1 -1
  260. package/src/number/branded-types/uint.mts +2 -2
  261. package/src/number/branded-types/uint16.mts +1 -1
  262. package/src/number/branded-types/uint32.mts +1 -1
  263. package/src/number/enum/int8.mts +5 -5
  264. package/src/number/enum/uint8.mts +4 -4
  265. package/src/number/num-arithmetic-types.mts +27 -27
  266. package/src/number/num-arithmetic-types.test.mts +21 -21
  267. package/src/number/num-arithmetic.test.mts +6 -6
  268. package/src/number/num.mts +24 -24
  269. package/src/number/num.test.mts +1 -1
  270. package/src/number/refined-number-utils.mts +25 -21
  271. package/src/object/object.mts +46 -34
  272. package/src/object/object.test.mts +5 -5
  273. package/src/others/cast-mutable.mts +1 -1
  274. package/src/others/cast-readonly.mts +1 -1
  275. package/src/others/debounce-function.mts +1 -5
  276. package/src/others/fast-deep-equal.test.mts +1 -1
  277. package/src/others/map-nullable.test.mts +1 -1
  278. package/src/others/memoize-function.mts +1 -1
  279. package/src/string/str.mts +33 -25
  280. package/src/string/str.test.mts +48 -38
  281. package/src/types.mts +14 -14
@@ -1,6 +1,6 @@
1
- import {
2
- type SafeUint,
3
- type PositiveSafeInt as TtfImported_PositiveSafeInt,
1
+ import type {
2
+ SafeUint,
3
+ PositiveSafeInt as TtfImported_PositiveSafeInt,
4
4
  } from 'ts-type-forge';
5
5
  import { expectType } from '../../expect-type.mjs';
6
6
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
@@ -206,7 +206,7 @@ export const PositiveSafeInt = {
206
206
  *
207
207
  * assert.isTrue(PositiveSafeInt.is(randomValue));
208
208
  *
209
- * assert.isTrue(randomValue >= 1 && randomValue <= 6);
209
+ * assert.isTrue(1 <= randomValue && randomValue <= 6);
210
210
  * ```
211
211
  *
212
212
  * @param min - The minimum value (inclusive)
@@ -1,4 +1,4 @@
1
- import { type PositiveUint16 as TtfImported_PositiveUint16 } from 'ts-type-forge';
1
+ import type { PositiveUint16 as TtfImported_PositiveUint16 } from 'ts-type-forge';
2
2
  import { expectType } from '../../expect-type.mjs';
3
3
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { type PositiveUint32 as TtfImported_PositiveUint32 } from 'ts-type-forge';
1
+ import type { PositiveUint32 as TtfImported_PositiveUint32 } from 'ts-type-forge';
2
2
  import { expectType } from '../../expect-type.mjs';
3
3
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
4
4
 
@@ -1,7 +1,4 @@
1
- import {
2
- type SafeUint,
3
- type SafeInt as TtfImported_SafeInt,
4
- } from 'ts-type-forge';
1
+ import type { SafeUint, SafeInt as TtfImported_SafeInt } from 'ts-type-forge';
5
2
  import { expectType } from '../../expect-type.mjs';
6
3
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
7
4
 
@@ -217,7 +214,7 @@ export const SafeInt = {
217
214
  *
218
215
  * assert.isTrue(SafeInt.is(randomValue));
219
216
  *
220
- * assert.isTrue(randomValue >= -10 && randomValue <= 10);
217
+ * assert.isTrue(-10 <= randomValue && randomValue <= 10);
221
218
  * ```
222
219
  *
223
220
  * @param min - The minimum value (inclusive)
@@ -1,4 +1,4 @@
1
- import { type SafeUint as TtfImported_SafeUint } from 'ts-type-forge';
1
+ import type { SafeUint as TtfImported_SafeUint } from 'ts-type-forge';
2
2
  import { expectType } from '../../expect-type.mjs';
3
3
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { type Uint as TtfImported_Uint } from 'ts-type-forge';
1
+ import type { Uint as TtfImported_Uint } from 'ts-type-forge';
2
2
  import { expectType } from '../../expect-type.mjs';
3
3
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
4
4
 
@@ -184,7 +184,7 @@ export const Uint = {
184
184
  *
185
185
  * assert.isTrue(Uint.is(randomValue));
186
186
  *
187
- * assert.isTrue(randomValue >= 0 && randomValue <= 3);
187
+ * assert.isTrue(0 <= randomValue && randomValue <= 3);
188
188
  * ```
189
189
  *
190
190
  * @param min - The minimum value (inclusive)
@@ -1,4 +1,4 @@
1
- import { type Uint16 as TtfImported_Uint16 } from 'ts-type-forge';
1
+ import type { Uint16 as TtfImported_Uint16 } from 'ts-type-forge';
2
2
  import { expectType } from '../../expect-type.mjs';
3
3
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { type Uint32 as TtfImported_Uint32 } from 'ts-type-forge';
1
+ import type { Uint32 as TtfImported_Uint32 } from 'ts-type-forge';
2
2
  import { expectType } from '../../expect-type.mjs';
3
3
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
4
4
 
@@ -1,8 +1,8 @@
1
- import {
2
- type AbsoluteValue,
3
- type Int16,
4
- type StrictExclude,
5
- type Int8 as TtfImported_Int8,
1
+ import type {
2
+ AbsoluteValue,
3
+ Int16,
4
+ StrictExclude,
5
+ Int8 as TtfImported_Int8,
6
6
  } from 'ts-type-forge';
7
7
  import { expectType } from '../../expect-type.mjs';
8
8
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
@@ -1,7 +1,7 @@
1
- import {
2
- type StrictExclude,
3
- type Uint8 as TtfImported_Uint8,
4
- type Uint16,
1
+ import type {
2
+ StrictExclude,
3
+ Uint8 as TtfImported_Uint8,
4
+ Uint16,
5
5
  } from 'ts-type-forge';
6
6
  import { expectType } from '../../expect-type.mjs';
7
7
  import { TsDataForgeInternals } from '../refined-number-utils.mjs';
@@ -1,30 +1,30 @@
1
- import {
2
- type BoolAnd,
3
- type BoolOr,
4
- type FiniteNumber,
5
- type Int,
6
- type NegativeFiniteNumber,
7
- type NegativeInt,
8
- type NegativeNumber,
9
- type NegativeSafeInt,
10
- type NonNegativeFiniteNumber,
11
- type NonNegativeInt,
12
- type NonNegativeNumber,
13
- type NonPositiveFiniteNumber,
14
- type NonPositiveInt,
15
- type NonPositiveNumber,
16
- type NonPositiveSafeInt,
17
- type NonZeroFiniteNumber,
18
- type NonZeroInt,
19
- type NonZeroNumber,
20
- type NonZeroSafeInt,
21
- type PositiveFiniteNumber,
22
- type PositiveInt,
23
- type PositiveNumber,
24
- type PositiveSafeInt,
25
- type SafeInt,
26
- type SafeUint,
27
- type Uint,
1
+ import type {
2
+ BoolAnd,
3
+ BoolOr,
4
+ FiniteNumber,
5
+ Int,
6
+ NegativeFiniteNumber,
7
+ NegativeInt,
8
+ NegativeNumber,
9
+ NegativeSafeInt,
10
+ NonNegativeFiniteNumber,
11
+ NonNegativeInt,
12
+ NonNegativeNumber,
13
+ NonPositiveFiniteNumber,
14
+ NonPositiveInt,
15
+ NonPositiveNumber,
16
+ NonPositiveSafeInt,
17
+ NonZeroFiniteNumber,
18
+ NonZeroInt,
19
+ NonZeroNumber,
20
+ NonZeroSafeInt,
21
+ PositiveFiniteNumber,
22
+ PositiveInt,
23
+ PositiveNumber,
24
+ PositiveSafeInt,
25
+ SafeInt,
26
+ SafeUint,
27
+ Uint,
28
28
  } from 'ts-type-forge';
29
29
  import { expectType } from '../expect-type.mjs';
30
30
 
@@ -1,26 +1,26 @@
1
- import {
2
- type FiniteNumber,
3
- type Int,
4
- type NegativeFiniteNumber,
5
- type NegativeInt,
6
- type NonNegativeFiniteNumber,
7
- type NonPositiveInt,
8
- type NonZeroInt,
9
- type PositiveFiniteNumber,
10
- type PositiveInt,
11
- type PositiveSafeInt,
12
- type SafeUint,
13
- type Uint,
1
+ import type {
2
+ FiniteNumber,
3
+ Int,
4
+ NegativeFiniteNumber,
5
+ NegativeInt,
6
+ NonNegativeFiniteNumber,
7
+ NonPositiveInt,
8
+ NonZeroInt,
9
+ PositiveFiniteNumber,
10
+ PositiveInt,
11
+ PositiveSafeInt,
12
+ SafeUint,
13
+ Uint,
14
14
  } from 'ts-type-forge';
15
15
  import { expectType } from '../expect-type.mjs';
16
- import {
17
- type AddResult,
18
- type DivIntResult,
19
- type DivResult,
20
- type LevelOf,
21
- type MulResult,
22
- type SignOf,
23
- type SubResult,
16
+ import type {
17
+ AddResult,
18
+ DivIntResult,
19
+ DivResult,
20
+ LevelOf,
21
+ MulResult,
22
+ SignOf,
23
+ SubResult,
24
24
  } from './num-arithmetic-types.mjs';
25
25
 
26
26
  describe('NumericArithmetic type-level', () => {
@@ -1,9 +1,9 @@
1
- import {
2
- type Int,
3
- type NegativeInt,
4
- type PositiveFiniteNumber,
5
- type PositiveInt,
6
- type Uint,
1
+ import type {
2
+ Int,
3
+ NegativeInt,
4
+ PositiveFiniteNumber,
5
+ PositiveInt,
6
+ Uint,
7
7
  } from 'ts-type-forge';
8
8
  import { expectType } from '../expect-type.mjs';
9
9
  import {
@@ -1,31 +1,31 @@
1
1
  import { SafeNumber } from 'ts-std-forge';
2
- import {
3
- type Decrement,
4
- type FiniteNumber,
5
- type Increment,
6
- type Index,
7
- type Int,
8
- type Min,
9
- type NaNType,
10
- type NegativeIndex,
11
- type NonNegativeNumber,
12
- type NonZeroNumber,
13
- type PositiveNumber,
14
- type PositiveSafeIntWithSmallInt,
15
- type RelaxedExclude,
16
- type SmallInt,
17
- type SmallUint,
18
- type UnknownBrand,
2
+ import type {
3
+ Decrement,
4
+ FiniteNumber,
5
+ Increment,
6
+ Index,
7
+ Int,
8
+ Min,
9
+ NaNType,
10
+ NegativeIndex,
11
+ NonNegativeNumber,
12
+ NonZeroNumber,
13
+ PositiveNumber,
14
+ PositiveSafeIntWithSmallInt,
15
+ RelaxedExclude,
16
+ SmallInt,
17
+ SmallUint,
18
+ UnknownBrand,
19
19
  } from 'ts-type-forge';
20
20
  import { expectType } from '../expect-type.mjs';
21
21
  import { Result } from '../functional/index.mjs';
22
- import { type SmallPositiveInt } from '../types.mjs';
23
- import {
24
- type AddResult,
25
- type DivIntResult,
26
- type DivResult,
27
- type MulResult,
28
- type SubResult,
22
+ import type { SmallPositiveInt } from '../types.mjs';
23
+ import type {
24
+ AddResult,
25
+ DivIntResult,
26
+ DivResult,
27
+ MulResult,
28
+ SubResult,
29
29
  } from './num-arithmetic-types.mjs';
30
30
 
31
31
  /**
@@ -1,4 +1,4 @@
1
- import { type FixedLengthTuple, type NonZeroNumber } from 'ts-type-forge';
1
+ import type { FixedLengthTuple, NonZeroNumber } from 'ts-type-forge';
2
2
  import { expectType } from '../expect-type.mjs';
3
3
  import { pipe, Result } from '../functional/index.mjs';
4
4
  import { asNonZeroFiniteNumber } from './branded-types/index.mjs';
@@ -1,19 +1,19 @@
1
- import {
2
- type Brand,
3
- type ChangeBaseBrand,
4
- type GetBrandValuePart,
5
- type Int,
6
- type IntersectBrand,
7
- type NonNegativeNumber,
8
- type NonZeroNumber,
9
- type PositiveNumber,
10
- type RelaxedExclude,
11
- type StrictPick,
12
- type TypeEq,
13
- type UnknownBrand,
14
- type UnwrapBrandFalseKeys,
15
- type UnwrapBrandTrueKeys,
16
- type WithSmallInt,
1
+ import type {
2
+ Brand,
3
+ ChangeBaseBrand,
4
+ GetBrandValuePart,
5
+ Int,
6
+ IntersectBrand,
7
+ NonNegativeNumber,
8
+ NonZeroNumber,
9
+ PositiveNumber,
10
+ RelaxedExclude,
11
+ StrictPick,
12
+ TypeEq,
13
+ UnknownBrand,
14
+ UnwrapBrandFalseKeys,
15
+ UnwrapBrandTrueKeys,
16
+ WithSmallInt,
17
17
  } from 'ts-type-forge';
18
18
  import { expectType } from '../expect-type.mjs';
19
19
  import { pipe } from '../functional/index.mjs';
@@ -392,7 +392,7 @@ export namespace TsDataForgeInternals {
392
392
  (integerOrSafeInteger === 'Integer'
393
393
  ? Number.isInteger(a)
394
394
  : Number.isSafeInteger(a)) &&
395
- (nonZero === true ? a !== 0 : true) &&
395
+ (nonZero !== true || a !== 0) &&
396
396
  (isFnOrUndefined(MIN_VALUE, MAX_VALUE)?.(a) ?? true);
397
397
 
398
398
  const castType = castTypeImpl<ElementType>(is, typeNameInMessage);
@@ -469,7 +469,9 @@ export namespace TsDataForgeInternals {
469
469
  while (true) {
470
470
  const r = randomImpl(min, max);
471
471
 
472
- if (Num.isNonZero(r)) return clampOrCastFn(r);
472
+ if (Num.isNonZero(r)) {
473
+ return clampOrCastFn(r);
474
+ }
473
475
  }
474
476
  };
475
477
 
@@ -576,7 +578,7 @@ export namespace TsDataForgeInternals {
576
578
  *
577
579
  * assert.isTrue(coerced >= Number.MIN_VALUE);
578
580
  *
579
- * assert.isTrue(boundedRandom >= 10 && boundedRandom <= 20);
581
+ * assert.isTrue(10 <= boundedRandom && boundedRandom <= 20);
580
582
  *
581
583
  * assert.isTrue(nonZeroRandom > 0);
582
584
  * ```
@@ -611,7 +613,7 @@ export namespace TsDataForgeInternals {
611
613
  }>): OperatorsForFloat<ElementType, MIN_VALUE, MAX_VALUE> => {
612
614
  const is = (a: number): a is ElementType =>
613
615
  Number.isFinite(a) &&
614
- (nonZero === true ? a !== 0 : true) &&
616
+ (nonZero !== true || a !== 0) &&
615
617
  (isFnOrUndefined(MIN_VALUE, MAX_VALUE)?.(a) ?? true);
616
618
 
617
619
  const castType = castTypeImpl<ElementType>(is, typeNameInMessage);
@@ -667,7 +669,9 @@ export namespace TsDataForgeInternals {
667
669
  while (true) {
668
670
  const r = random(min, max);
669
671
 
670
- if (isNonZero(r)) return r;
672
+ if (isNonZero(r)) {
673
+ return r;
674
+ }
671
675
  }
672
676
  };
673
677
 
@@ -1,20 +1,20 @@
1
- import {
2
- type ArrayElement,
3
- type Decrement,
4
- type DeepOmit,
5
- type DeepPick,
6
- type IsFixedLengthList,
7
- type IsUnion,
8
- type List,
9
- type ReadonlyRecord,
10
- type RelaxedExclude,
11
- type RelaxedOmit,
12
- type RelaxedPick,
13
- type StrictOmit,
14
- type StrictPick,
15
- type ToString,
16
- type TypeEq,
17
- type UnknownRecord,
1
+ import type {
2
+ ArrayElement,
3
+ Decrement,
4
+ DeepOmit,
5
+ DeepPick,
6
+ IsFixedLengthList,
7
+ IsUnion,
8
+ List,
9
+ ReadonlyRecord,
10
+ RelaxedExclude,
11
+ RelaxedOmit,
12
+ RelaxedPick,
13
+ StrictOmit,
14
+ StrictPick,
15
+ ToString,
16
+ TypeEq,
17
+ UnknownRecord,
18
18
  } from 'ts-type-forge';
19
19
  import { Arr } from '../array/index.mjs';
20
20
  import { Optional } from '../functional/index.mjs';
@@ -53,13 +53,10 @@ export namespace Obj {
53
53
  *
54
54
  * const obj5 = { value: 1.00001 } as const;
55
55
  *
56
- * const closeEnough = (a: unknown, b: unknown): boolean => {
57
- * if (typeof a === 'number' && typeof b === 'number') {
58
- * return Math.abs(a - b) < 0.001;
59
- * }
60
- *
61
- * return Object.is(a, b);
62
- * };
56
+ * const closeEnough = (a: unknown, b: unknown): boolean =>
57
+ * typeof a === 'number' && typeof b === 'number'
58
+ * ? Math.abs(a - b) < 0.001
59
+ * : Object.is(a, b);
63
60
  *
64
61
  * assert.isTrue(Obj.shallowEq(obj4, obj5, closeEnough));
65
62
  * ```
@@ -80,9 +77,10 @@ export namespace Obj {
80
77
 
81
78
  const bEntries = Object.entries(b);
82
79
 
83
- if (aEntries.length !== bEntries.length) return false;
84
-
85
- return aEntries.every(([k, v]) => eq(b[k], v));
80
+ return (
81
+ aEntries.length === bEntries.length &&
82
+ aEntries.every(([k, v]) => eq(b[k], v))
83
+ );
86
84
  };
87
85
 
88
86
  /**
@@ -721,19 +719,27 @@ const deepPickImpl = (
721
719
  record: UnknownRecord,
722
720
  path: readonly (string | number)[],
723
721
  ): UnknownRecord => {
724
- if (!Arr.isNonEmpty(path)) return record;
722
+ if (!Arr.isNonEmpty(path)) {
723
+ return record;
724
+ }
725
725
 
726
726
  const head = path[0];
727
727
 
728
- if (!hasKey(record, head)) return {};
728
+ if (!hasKey(record, head)) {
729
+ return {};
730
+ }
729
731
 
730
732
  const value = record[head];
731
733
 
732
734
  const tail = path.slice(1);
733
735
 
734
- if (!Arr.isNonEmpty(tail)) return { [head]: value };
736
+ if (!Arr.isNonEmpty(tail)) {
737
+ return { [head]: value };
738
+ }
735
739
 
736
- if (!isRecord(value)) return { [head]: {} };
740
+ if (!isRecord(value)) {
741
+ return { [head]: {} };
742
+ }
737
743
 
738
744
  return {
739
745
  [head]: deepPickImpl(value, tail),
@@ -744,11 +750,15 @@ const deepOmitImpl = (
744
750
  record: UnknownRecord,
745
751
  path: readonly (string | number)[],
746
752
  ): UnknownRecord => {
747
- if (!Arr.isNonEmpty(path)) return record;
753
+ if (!Arr.isNonEmpty(path)) {
754
+ return record;
755
+ }
748
756
 
749
757
  const head = path[0];
750
758
 
751
- if (!hasKey(record, head)) return record;
759
+ if (!hasKey(record, head)) {
760
+ return record;
761
+ }
752
762
 
753
763
  const tail = path.slice(1);
754
764
 
@@ -760,7 +770,9 @@ const deepOmitImpl = (
760
770
 
761
771
  const value = record[head];
762
772
 
763
- if (!isRecord(value)) return record;
773
+ if (!isRecord(value)) {
774
+ return record;
775
+ }
764
776
 
765
777
  return {
766
778
  ...record,
@@ -1,8 +1,8 @@
1
- import {
2
- type DeepReadonly,
3
- type FixedLengthTuple,
4
- type ReadonlyRecord,
5
- type UnknownRecord,
1
+ import type {
2
+ DeepReadonly,
3
+ FixedLengthTuple,
4
+ ReadonlyRecord,
5
+ UnknownRecord,
6
6
  } from 'ts-type-forge';
7
7
  import { expectType } from '../expect-type.mjs';
8
8
  import { Optional, pipe } from '../functional/index.mjs';
@@ -1,4 +1,4 @@
1
- import { type DeepMutable, type Mutable } from 'ts-type-forge';
1
+ import type { DeepMutable, Mutable } from 'ts-type-forge';
2
2
 
3
3
  /**
4
4
  * Casts a readonly type `T` to its `Mutable<T>` equivalent.
@@ -1,4 +1,4 @@
1
- import { type DeepReadonly } from 'ts-type-forge';
1
+ import type { DeepReadonly } from 'ts-type-forge';
2
2
 
3
3
  /**
4
4
  * Casts a mutable type `T` to its `Readonly<T>` equivalent.
@@ -11,11 +11,7 @@ export const debounce = <Args extends readonly unknown[]>(
11
11
  func: (...args: Args) => void,
12
12
  waitMilliseconds: number,
13
13
  ): ((...args: Args) => void) => {
14
- // Not `ReturnType<typeof setTimeout>`: with both the DOM and Node
15
- // declarations in scope that resolves to `unknown`, which `clearTimeout`
16
- // will not take. Naming what `clearTimeout` accepts says the same thing and
17
- // stays true in either environment.
18
- let mut_timeoutId: Parameters<typeof clearTimeout>[0];
14
+ let mut_timeoutId: ReturnType<typeof setTimeout> | undefined = undefined;
19
15
 
20
16
  return (...args: Args): void => {
21
17
  clearTimeout(mut_timeoutId);
@@ -4,7 +4,7 @@
4
4
  /* eslint-disable no-restricted-globals */
5
5
  /* eslint-disable functional/no-class-inheritance */
6
6
  import * as React from 'react';
7
- import { type ReadonlyRecord } from 'ts-type-forge';
7
+ import type { ReadonlyRecord } from 'ts-type-forge';
8
8
  import { fastDeepEqual } from './fast-deep-equal.mjs';
9
9
 
10
10
  const fastDeepEqualUntyped = (a: any, b: any): boolean => fastDeepEqual(a, b);
@@ -1,4 +1,4 @@
1
- import { type DeepReadonly } from 'ts-type-forge';
1
+ import type { DeepReadonly } from 'ts-type-forge';
2
2
  import { expectType } from '../expect-type.mjs';
3
3
  import { pipe, Result } from '../functional/index.mjs';
4
4
  import { Num } from '../number/index.mjs';
@@ -1,4 +1,4 @@
1
- import { type Primitive } from 'ts-type-forge';
1
+ import type { Primitive } from 'ts-type-forge';
2
2
 
3
3
  /**
4
4
  * Creates a memoized version of a function that caches results based on input