ts-data-forge 5.1.0 → 5.1.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 (226) hide show
  1. package/README.md +46 -44
  2. package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  4. package/dist/array/impl/array-utils-reducing-value.d.mts +8 -8
  5. package/dist/array/impl/array-utils-search.d.mts +4 -4
  6. package/dist/array/impl/array-utils-set-op.d.mts +7 -7
  7. package/dist/array/impl/array-utils-set-op.mjs +7 -7
  8. package/dist/array/impl/array-utils-size.d.mts +2 -2
  9. package/dist/array/impl/array-utils-size.mjs +2 -2
  10. package/dist/array/impl/array-utils-slicing.d.mts +2 -2
  11. package/dist/array/impl/array-utils-slicing.mjs +2 -2
  12. package/dist/array/impl/array-utils-validation.d.mts +18 -18
  13. package/dist/array/impl/array-utils-validation.mjs +14 -14
  14. package/dist/collections/imap.d.mts +15 -15
  15. package/dist/collections/imap.mjs +3 -3
  16. package/dist/collections/iset-mapped.d.mts +19 -19
  17. package/dist/collections/iset-mapped.mjs +2 -2
  18. package/dist/collections/iset.d.mts +19 -19
  19. package/dist/collections/iset.mjs +2 -2
  20. package/dist/collections/queue.d.mts +25 -25
  21. package/dist/collections/queue.mjs +5 -5
  22. package/dist/collections/stack.d.mts +25 -25
  23. package/dist/collections/stack.mjs +5 -5
  24. package/dist/functional/match.d.mts +1 -1
  25. package/dist/functional/optional/impl/optional-expect-to-be.d.mts +2 -2
  26. package/dist/functional/optional/impl/optional-is-none.d.mts +1 -1
  27. package/dist/functional/optional/impl/optional-is-none.mjs +1 -1
  28. package/dist/functional/optional/impl/optional-is-optional.d.mts +2 -2
  29. package/dist/functional/optional/impl/optional-is-optional.mjs +2 -2
  30. package/dist/functional/optional/impl/optional-is-some.d.mts +1 -1
  31. package/dist/functional/optional/impl/optional-is-some.mjs +1 -1
  32. package/dist/functional/optional/impl/optional-none.d.mts +2 -2
  33. package/dist/functional/optional/impl/optional-none.mjs +2 -2
  34. package/dist/functional/optional/impl/optional-some.d.mts +2 -2
  35. package/dist/functional/optional/impl/optional-some.mjs +2 -2
  36. package/dist/functional/optional/impl/optional-to-nullable.d.mts +2 -2
  37. package/dist/functional/optional/impl/optional-to-nullable.mjs +2 -2
  38. package/dist/functional/optional/impl/optional-unwrap-or.d.mts +4 -4
  39. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +1 -1
  40. package/dist/functional/optional/impl/optional-unwrap-throw.mjs +1 -1
  41. package/dist/functional/optional/impl/optional-unwrap.d.mts +2 -2
  42. package/dist/functional/optional/impl/optional-zip.d.mts +1 -1
  43. package/dist/functional/optional/impl/optional-zip.mjs +1 -1
  44. package/dist/functional/pipe.d.mts +2 -2
  45. package/dist/functional/result/impl/result-err.d.mts +1 -1
  46. package/dist/functional/result/impl/result-err.mjs +1 -1
  47. package/dist/functional/result/impl/result-expect-to-be.d.mts +2 -2
  48. package/dist/functional/result/impl/result-from-promise.d.mts +1 -1
  49. package/dist/functional/result/impl/result-from-promise.mjs +1 -1
  50. package/dist/functional/result/impl/result-from-throwable.d.mts +1 -1
  51. package/dist/functional/result/impl/result-from-throwable.mjs +1 -1
  52. package/dist/functional/result/impl/result-is-err.d.mts +2 -2
  53. package/dist/functional/result/impl/result-is-err.mjs +2 -2
  54. package/dist/functional/result/impl/result-is-ok.d.mts +2 -2
  55. package/dist/functional/result/impl/result-is-ok.mjs +2 -2
  56. package/dist/functional/result/impl/result-is-result.d.mts +3 -3
  57. package/dist/functional/result/impl/result-is-result.mjs +3 -3
  58. package/dist/functional/result/impl/result-ok.d.mts +1 -1
  59. package/dist/functional/result/impl/result-ok.mjs +1 -1
  60. package/dist/functional/result/impl/result-unwrap-err-or.d.mts +4 -4
  61. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +1 -1
  62. package/dist/functional/result/impl/result-unwrap-err-throw.mjs +1 -1
  63. package/dist/functional/result/impl/result-unwrap-err.d.mts +2 -2
  64. package/dist/functional/result/impl/result-unwrap-err.mjs +2 -2
  65. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +4 -4
  66. package/dist/functional/result/impl/result-unwrap-ok.d.mts +2 -2
  67. package/dist/functional/result/impl/result-unwrap-throw.d.mts +1 -1
  68. package/dist/functional/result/impl/result-unwrap-throw.mjs +1 -1
  69. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +1 -1
  70. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +1 -1
  71. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +1 -1
  72. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +1 -1
  73. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +1 -1
  74. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +1 -1
  75. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +3 -3
  76. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +3 -3
  77. package/dist/globals.d.mts +2 -1
  78. package/dist/guard/has-key.d.mts +6 -3
  79. package/dist/guard/has-key.d.mts.map +1 -1
  80. package/dist/guard/has-key.mjs +2 -2
  81. package/dist/guard/key-is-in.d.mts +2 -2
  82. package/dist/guard/key-is-in.mjs +2 -2
  83. package/dist/json/json.d.mts +21 -21
  84. package/dist/json/json.mjs +21 -21
  85. package/dist/number/branded-types/int.d.mts +19 -19
  86. package/dist/number/branded-types/int.mjs +19 -19
  87. package/dist/number/branded-types/positive-int.d.mts +20 -20
  88. package/dist/number/branded-types/positive-int.mjs +20 -20
  89. package/dist/number/branded-types/positive-safe-int.d.mts +26 -26
  90. package/dist/number/branded-types/positive-safe-int.mjs +26 -26
  91. package/dist/number/branded-types/safe-int.d.mts +27 -27
  92. package/dist/number/branded-types/safe-int.mjs +27 -27
  93. package/dist/number/branded-types/uint.d.mts +19 -19
  94. package/dist/number/branded-types/uint.mjs +19 -19
  95. package/dist/number/num.d.mts +20 -20
  96. package/dist/number/num.mjs +16 -16
  97. package/dist/number/refined-number-utils.d.mts +11 -11
  98. package/dist/number/refined-number-utils.d.mts.map +1 -1
  99. package/dist/number/refined-number-utils.mjs +11 -11
  100. package/dist/object/object.d.mts +3 -3
  101. package/dist/object/object.d.mts.map +1 -1
  102. package/dist/object/object.mjs +3 -3
  103. package/dist/object/object.mjs.map +1 -1
  104. package/dist/others/tuple.d.mts +3 -3
  105. package/dist/others/tuple.mjs +3 -3
  106. package/dist/promise/promise.d.mts +4 -4
  107. package/dist/promise/promise.mjs +4 -4
  108. package/package.json +15 -13
  109. package/src/array/impl/array-utils-creation.test.mts +1 -1
  110. package/src/array/impl/array-utils-element-access.test.mts +16 -16
  111. package/src/array/impl/array-utils-modification.mts +38 -19
  112. package/src/array/impl/array-utils-reducing-value.mts +8 -8
  113. package/src/array/impl/array-utils-reducing-value.test.mts +23 -31
  114. package/src/array/impl/array-utils-search.mts +4 -4
  115. package/src/array/impl/array-utils-search.test.mts +10 -10
  116. package/src/array/impl/array-utils-set-op.mts +7 -7
  117. package/src/array/impl/array-utils-set-op.test.mts +13 -13
  118. package/src/array/impl/array-utils-size.mts +2 -2
  119. package/src/array/impl/array-utils-slicing.mts +2 -2
  120. package/src/array/impl/array-utils-transformation.test.mts +2 -2
  121. package/src/array/impl/array-utils-validation.mts +18 -18
  122. package/src/array/impl/array-utils-validation.test.mts +80 -78
  123. package/src/array/impl/array.test.mts +6 -6
  124. package/src/collections/imap-mapped.test.mts +16 -18
  125. package/src/collections/imap.mts +15 -15
  126. package/src/collections/imap.test.mts +31 -31
  127. package/src/collections/iset-mapped.mts +19 -19
  128. package/src/collections/iset-mapped.test.mts +52 -52
  129. package/src/collections/iset.mts +19 -19
  130. package/src/collections/iset.test.mts +130 -130
  131. package/src/collections/queue.mts +25 -25
  132. package/src/collections/queue.test.mts +33 -35
  133. package/src/collections/stack.mts +25 -25
  134. package/src/collections/stack.test.mts +15 -15
  135. package/src/functional/match.mts +1 -1
  136. package/src/functional/optional/impl/optional-expect-to-be.mts +2 -2
  137. package/src/functional/optional/impl/optional-is-none.mts +1 -1
  138. package/src/functional/optional/impl/optional-is-optional.mts +2 -2
  139. package/src/functional/optional/impl/optional-is-some.mts +1 -1
  140. package/src/functional/optional/impl/optional-none.mts +2 -2
  141. package/src/functional/optional/impl/optional-some.mts +2 -2
  142. package/src/functional/optional/impl/optional-to-nullable.mts +2 -2
  143. package/src/functional/optional/impl/optional-unwrap-or.mts +4 -4
  144. package/src/functional/optional/impl/optional-unwrap-throw.mts +1 -1
  145. package/src/functional/optional/impl/optional-unwrap.mts +2 -2
  146. package/src/functional/optional/impl/optional-zip.mts +1 -1
  147. package/src/functional/optional.test.mts +53 -54
  148. package/src/functional/pipe.mts +2 -2
  149. package/src/functional/pipe.test.mts +4 -4
  150. package/src/functional/result/impl/result-err.mts +1 -1
  151. package/src/functional/result/impl/result-expect-to-be.mts +2 -2
  152. package/src/functional/result/impl/result-from-promise.mts +1 -1
  153. package/src/functional/result/impl/result-from-throwable.mts +1 -1
  154. package/src/functional/result/impl/result-is-err.mts +2 -2
  155. package/src/functional/result/impl/result-is-ok.mts +2 -2
  156. package/src/functional/result/impl/result-is-result.mts +3 -3
  157. package/src/functional/result/impl/result-ok.mts +1 -1
  158. package/src/functional/result/impl/result-unwrap-err-or.mts +4 -4
  159. package/src/functional/result/impl/result-unwrap-err-throw.mts +1 -1
  160. package/src/functional/result/impl/result-unwrap-err.mts +2 -2
  161. package/src/functional/result/impl/result-unwrap-ok-or.mts +4 -4
  162. package/src/functional/result/impl/result-unwrap-ok.mts +2 -2
  163. package/src/functional/result/impl/result-unwrap-throw.mts +1 -1
  164. package/src/functional/result.test.mts +94 -152
  165. package/src/functional/ternary-result/impl/ternary-result-err.mts +1 -1
  166. package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +1 -1
  167. package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +1 -1
  168. package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +3 -3
  169. package/src/functional/ternary-result.test.mts +8 -8
  170. package/src/globals.d.mts +2 -1
  171. package/src/guard/has-key.mts +8 -5
  172. package/src/guard/has-key.test.mts +0 -5
  173. package/src/guard/is-error.test.mts +143 -0
  174. package/src/guard/is-non-empty-string.test.mts +24 -24
  175. package/src/guard/is-non-null-object.test.mts +26 -26
  176. package/src/guard/is-primitive.test.mts +28 -28
  177. package/src/guard/is-record.test.mts +7 -7
  178. package/src/guard/is-type.test.mts +151 -155
  179. package/src/guard/key-is-in.mts +2 -2
  180. package/src/guard/key-is-in.test.mts +2 -2
  181. package/src/json/json.mts +21 -21
  182. package/src/json/json.test.mts +135 -174
  183. package/src/number/branded-types/finite-number.test.mts +13 -11
  184. package/src/number/branded-types/int.mts +19 -19
  185. package/src/number/branded-types/int.test.mts +14 -14
  186. package/src/number/branded-types/int16.test.mts +16 -16
  187. package/src/number/branded-types/int32.test.mts +16 -16
  188. package/src/number/branded-types/non-negative-finite-number.test.mts +12 -12
  189. package/src/number/branded-types/non-negative-int16.test.mts +16 -16
  190. package/src/number/branded-types/non-negative-int32.test.mts +16 -16
  191. package/src/number/branded-types/non-zero-finite-number.test.mts +14 -14
  192. package/src/number/branded-types/non-zero-int.test.mts +19 -19
  193. package/src/number/branded-types/non-zero-int16.test.mts +16 -16
  194. package/src/number/branded-types/non-zero-int32.test.mts +16 -16
  195. package/src/number/branded-types/non-zero-safe-int.test.mts +23 -23
  196. package/src/number/branded-types/non-zero-uint16.test.mts +16 -16
  197. package/src/number/branded-types/non-zero-uint32.test.mts +16 -16
  198. package/src/number/branded-types/positive-finite-number.test.mts +14 -14
  199. package/src/number/branded-types/positive-int.mts +20 -20
  200. package/src/number/branded-types/positive-int.test.mts +17 -17
  201. package/src/number/branded-types/positive-int16.test.mts +15 -15
  202. package/src/number/branded-types/positive-int32.test.mts +15 -15
  203. package/src/number/branded-types/positive-safe-int.mts +26 -26
  204. package/src/number/branded-types/positive-safe-int.test.mts +19 -19
  205. package/src/number/branded-types/positive-uint16.test.mts +16 -16
  206. package/src/number/branded-types/positive-uint32.test.mts +16 -16
  207. package/src/number/branded-types/safe-int.mts +27 -27
  208. package/src/number/branded-types/safe-int.test.mts +18 -18
  209. package/src/number/branded-types/safe-uint.test.mts +17 -17
  210. package/src/number/branded-types/uint.mts +19 -19
  211. package/src/number/branded-types/uint.test.mts +15 -15
  212. package/src/number/branded-types/uint16.test.mts +15 -15
  213. package/src/number/branded-types/uint32.test.mts +15 -15
  214. package/src/number/enum/int8.test.mts +1 -1
  215. package/src/number/enum/uint8.test.mts +1 -1
  216. package/src/number/num.mts +20 -20
  217. package/src/number/num.test.mts +26 -26
  218. package/src/number/refined-number-utils.mts +13 -13
  219. package/src/object/object.mts +4 -3
  220. package/src/object/object.test.mts +6 -6
  221. package/src/others/cast-mutable.test.mts +1 -1
  222. package/src/others/cast-readonly.test.mts +4 -4
  223. package/src/others/if-then.test.mts +24 -24
  224. package/src/others/tuple.mts +3 -3
  225. package/src/promise/promise.mts +4 -4
  226. package/src/promise/promise.test.mts +7 -13
@@ -26,7 +26,7 @@ export namespace Num {
26
26
  *
27
27
  * const result = Num.from(input);
28
28
  *
29
- * assert(result === 123.45);
29
+ * assert.isTrue(result === 123.45);
30
30
  * ```
31
31
  *
32
32
  * @param n The value to convert.
@@ -51,10 +51,10 @@ export namespace Num {
51
51
  * // eslint-disable-next-line total-functions/no-partial-division
52
52
  * const inverted = 1 / value;
53
53
  *
54
- * assert(inverted === 0.2);
54
+ * assert.isTrue(inverted === 0.2);
55
55
  * }
56
56
  *
57
- * assert.notOk(Num.isNonZero(0));
57
+ * assert.isFalse(Num.isNonZero(0));
58
58
  * ```
59
59
  *
60
60
  * @template N - The numeric literal type or number type to check
@@ -83,10 +83,10 @@ export namespace Num {
83
83
  * if (Num.isNonNegative(candidate)) {
84
84
  * const index: number = candidate;
85
85
  *
86
- * assert(index === 10);
86
+ * assert.isTrue(index === 10);
87
87
  * }
88
88
  *
89
- * assert.notOk(Num.isNonNegative(-1));
89
+ * assert.isFalse(Num.isNonNegative(-1));
90
90
  * ```
91
91
  *
92
92
  * @template N - The numeric literal type or number type to check
@@ -111,10 +111,10 @@ export namespace Num {
111
111
  * const amount = 42;
112
112
  *
113
113
  * if (Num.isPositive(amount)) {
114
- * assert.ok(amount > 0);
114
+ * assert.isTrue(amount > 0);
115
115
  * }
116
116
  *
117
- * assert.notOk(Num.isPositive(0));
117
+ * assert.isFalse(Num.isPositive(0));
118
118
  * ```
119
119
  *
120
120
  * @template N - The numeric literal type or number type to check
@@ -135,9 +135,9 @@ export namespace Num {
135
135
  * ```ts
136
136
  * const isGrade = Num.isInRange(0, 100);
137
137
  *
138
- * assert.ok(isGrade(50));
138
+ * assert.isTrue(isGrade(50));
139
139
  *
140
- * assert.notOk(isGrade(100));
140
+ * assert.isFalse(isGrade(100));
141
141
  * ```
142
142
  *
143
143
  * @param lowerBound The lower bound (inclusive).
@@ -159,9 +159,9 @@ export namespace Num {
159
159
  * ```ts
160
160
  * const isPercentage = Num.isInRangeInclusive(0, 100);
161
161
  *
162
- * assert.ok(isPercentage(100));
162
+ * assert.isTrue(isPercentage(100));
163
163
  *
164
- * assert.notOk(isPercentage(-1));
164
+ * assert.isFalse(isPercentage(-1));
165
165
  * ```
166
166
  *
167
167
  * @param lowerBound The lower bound (inclusive).
@@ -219,11 +219,11 @@ export namespace Num {
219
219
  * ```ts
220
220
  * const indexGuard = Num.isUintInRange(0, 5);
221
221
  *
222
- * assert.ok(indexGuard(3));
222
+ * assert.isTrue(indexGuard(3));
223
223
  *
224
- * assert.notOk(indexGuard(5));
224
+ * assert.isFalse(indexGuard(5));
225
225
  *
226
- * assert.notOk(indexGuard(-1));
226
+ * assert.isFalse(indexGuard(-1));
227
227
  * ```
228
228
  *
229
229
  * @template L - The lower bound as a SmallUint literal type
@@ -255,9 +255,9 @@ export namespace Num {
255
255
  * ```ts
256
256
  * const inclusiveGuard = Num.isUintInRangeInclusive(0, 5);
257
257
  *
258
- * assert.ok(inclusiveGuard(5));
258
+ * assert.isTrue(inclusiveGuard(5));
259
259
  *
260
- * assert.notOk(inclusiveGuard(6));
260
+ * assert.isFalse(inclusiveGuard(6));
261
261
  * ```
262
262
  *
263
263
  * @template L - The lower bound as a SmallUint literal type
@@ -284,15 +284,15 @@ export namespace Num {
284
284
  * @example
285
285
  *
286
286
  * ```ts
287
- * assert(Num.clamp(150, 0, 100) === 100);
287
+ * assert.isTrue(Num.clamp(150, 0, 100) === 100);
288
288
  *
289
- * assert(Num.clamp(-50, 0, 100) === 0);
289
+ * assert.isTrue(Num.clamp(-50, 0, 100) === 0);
290
290
  *
291
291
  * const clampToPercentage = Num.clamp(0, 100);
292
292
  *
293
- * assert(clampToPercentage(75) === 75);
293
+ * assert.isTrue(clampToPercentage(75) === 75);
294
294
  *
295
- * assert(clampToPercentage(150) === 100);
295
+ * assert.isTrue(clampToPercentage(150) === 100);
296
296
  * ```
297
297
  */
298
298
  export function clamp(
@@ -93,7 +93,7 @@ describe('Num test', () => {
93
93
  expectType<typeof x, number>('=');
94
94
  }
95
95
 
96
- expect(f(x)).toBe(true);
96
+ assert.isTrue(f(x));
97
97
  });
98
98
 
99
99
  test('falsy case', () => {
@@ -107,7 +107,7 @@ describe('Num test', () => {
107
107
  expectType<typeof x, number>('=');
108
108
  }
109
109
 
110
- expect(f(x)).toBe(false);
110
+ assert.isFalse(f(x));
111
111
  });
112
112
  });
113
113
 
@@ -135,15 +135,15 @@ describe('Num test', () => {
135
135
  test('checks range (lower inclusive, upper exclusive)', () => {
136
136
  const inRange = Num.isInRange(0, 10);
137
137
 
138
- expect(inRange(5)).toBe(true);
138
+ assert.isTrue(inRange(5));
139
139
 
140
- expect(inRange(0)).toBe(true); // inclusive lower bound
140
+ assert.isTrue(inRange(0)); // inclusive lower bound
141
141
 
142
- expect(inRange(10)).toBe(false); // exclusive upper bound
142
+ assert.isFalse(inRange(10)); // exclusive upper bound
143
143
 
144
- expect(inRange(-1)).toBe(false);
144
+ assert.isFalse(inRange(-1));
145
145
 
146
- expect(inRange(15)).toBe(false);
146
+ assert.isFalse(inRange(15));
147
147
  });
148
148
  });
149
149
 
@@ -151,15 +151,15 @@ describe('Num test', () => {
151
151
  test('checks range (inclusive)', () => {
152
152
  const inRange = Num.isInRangeInclusive(0, 10);
153
153
 
154
- expect(inRange(5)).toBe(true);
154
+ assert.isTrue(inRange(5));
155
155
 
156
- expect(inRange(0)).toBe(true); // inclusive
156
+ assert.isTrue(inRange(0)); // inclusive
157
157
 
158
- expect(inRange(10)).toBe(true); // inclusive
158
+ assert.isTrue(inRange(10)); // inclusive
159
159
 
160
- expect(inRange(-1)).toBe(false);
160
+ assert.isFalse(inRange(-1));
161
161
 
162
- expect(inRange(15)).toBe(false);
162
+ assert.isFalse(inRange(15));
163
163
  });
164
164
  });
165
165
 
@@ -167,13 +167,13 @@ describe('Num test', () => {
167
167
  test('checks uint range (lower inclusive, upper exclusive)', () => {
168
168
  const inRange = Num.isUintInRange(0, 5);
169
169
 
170
- expect(inRange(2)).toBe(true);
170
+ assert.isTrue(inRange(2));
171
171
 
172
- expect(inRange(0)).toBe(true); // inclusive lower bound
172
+ assert.isTrue(inRange(0)); // inclusive lower bound
173
173
 
174
- expect(inRange(5)).toBe(false); // exclusive upper bound
174
+ assert.isFalse(inRange(5)); // exclusive upper bound
175
175
 
176
- expect(inRange(-1)).toBe(false);
176
+ assert.isFalse(inRange(-1));
177
177
  });
178
178
  });
179
179
 
@@ -185,33 +185,33 @@ describe('Num test', () => {
185
185
  expectType<typeof x, NonZeroNumber>('=');
186
186
  }
187
187
 
188
- expect(Num.isNonZero(5)).toBe(true);
188
+ assert.isTrue(Num.isNonZero(5));
189
189
 
190
- expect(Num.isNonZero(-3)).toBe(true);
190
+ assert.isTrue(Num.isNonZero(-3));
191
191
 
192
- expect(Num.isNonZero(0)).toBe(false);
192
+ assert.isFalse(Num.isNonZero(0));
193
193
  });
194
194
  });
195
195
 
196
196
  describe('isNonNegative', () => {
197
197
  test('type guard for non-negative numbers', () => {
198
- expect(Num.isNonNegative(5)).toBe(true);
198
+ assert.isTrue(Num.isNonNegative(5));
199
199
 
200
- expect(Num.isNonNegative(0)).toBe(true);
200
+ assert.isTrue(Num.isNonNegative(0));
201
201
 
202
- expect(Num.isNonNegative(-1)).toBe(false);
202
+ assert.isFalse(Num.isNonNegative(-1));
203
203
  });
204
204
  });
205
205
 
206
206
  describe('isPositive', () => {
207
207
  test('type guard for positive numbers', () => {
208
- expect(Num.isPositive(5)).toBe(true);
208
+ assert.isTrue(Num.isPositive(5));
209
209
 
210
- expect(Num.isPositive(0.1)).toBe(true);
210
+ assert.isTrue(Num.isPositive(0.1));
211
211
 
212
- expect(Num.isPositive(0)).toBe(false);
212
+ assert.isFalse(Num.isPositive(0));
213
213
 
214
- expect(Num.isPositive(-1)).toBe(false);
214
+ assert.isFalse(Num.isPositive(-1));
215
215
  });
216
216
  });
217
217
 
@@ -224,8 +224,8 @@ export namespace TsDataForgeInternals {
224
224
  ElementType extends Int,
225
225
  MIN_VALUE extends number,
226
226
  MAX_VALUE extends number,
227
- ElementTypeWithSmallInt extends
228
- WithSmallInt<ElementType> = WithSmallInt<ElementType>,
227
+ ElementTypeWithSmallInt extends WithSmallInt<ElementType> =
228
+ WithSmallInt<ElementType>,
229
229
  > = Readonly<{
230
230
  MIN_VALUE: MIN_VALUE;
231
231
  MAX_VALUE: MAX_VALUE;
@@ -324,17 +324,17 @@ export namespace TsDataForgeInternals {
324
324
  *
325
325
  * const randomValue = intOps.random();
326
326
  *
327
- * assert(sum === 10);
327
+ * assert.isTrue(sum === 10);
328
328
  *
329
- * assert(difference === 2);
329
+ * assert.isTrue(difference === 2);
330
330
  *
331
- * assert(product === 24);
331
+ * assert.isTrue(product === 24);
332
332
  *
333
- * assert(quotient === 3);
333
+ * assert.isTrue(quotient === 3);
334
334
  *
335
- * assert(roundedClamp === 2);
335
+ * assert.isTrue(roundedClamp === 2);
336
336
  *
337
- * assert.ok(Number.isSafeInteger(randomValue));
337
+ * assert.isTrue(Number.isSafeInteger(randomValue));
338
338
  * ```
339
339
  *
340
340
  * @template ElementType - The integer branded type
@@ -552,15 +552,15 @@ export namespace TsDataForgeInternals {
552
552
  *
553
553
  * const nonZeroRandom = floatOps.randomNonZero();
554
554
  *
555
- * assert(sum === 50);
555
+ * assert.isTrue(sum === 50);
556
556
  *
557
- * assert(ratio === 5);
557
+ * assert.isTrue(ratio === 5);
558
558
  *
559
- * assert.ok(clamped >= Number.MIN_VALUE);
559
+ * assert.isTrue(clamped >= Number.MIN_VALUE);
560
560
  *
561
- * assert.ok(boundedRandom >= 10 && boundedRandom <= 20);
561
+ * assert.isTrue(boundedRandom >= 10 && boundedRandom <= 20);
562
562
  *
563
- * assert.ok(nonZeroRandom > 0);
563
+ * assert.isTrue(nonZeroRandom > 0);
564
564
  * ```
565
565
  *
566
566
  * @template ElementType - The floating-point branded type
@@ -22,9 +22,9 @@ export namespace Obj {
22
22
  *
23
23
  * const obj3 = { name: 'Alice', age: 31 };
24
24
  *
25
- * assert.ok(Obj.shallowEq(obj1, obj2));
25
+ * assert.isTrue(Obj.shallowEq(obj1, obj2));
26
26
  *
27
- * assert.notOk(Obj.shallowEq(obj1, obj3));
27
+ * assert.isFalse(Obj.shallowEq(obj1, obj3));
28
28
  *
29
29
  * // Custom equality function
30
30
  * const obj4 = { value: 1 };
@@ -39,7 +39,7 @@ export namespace Obj {
39
39
  * return Object.is(a, b);
40
40
  * };
41
41
  *
42
- * assert.ok(Obj.shallowEq(obj4, obj5, closeEnough));
42
+ * assert.isTrue(Obj.shallowEq(obj4, obj5, closeEnough));
43
43
  * ```
44
44
  *
45
45
  * @param a - The first record to compare
@@ -370,6 +370,7 @@ export namespace Obj {
370
370
  : TypeEq<Entries['length'], 0> extends true
371
371
  ? K
372
372
  : ValuesOfEntriesImpl<
373
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
373
374
  K | Entries[0][1],
374
375
  List.Tail<Entries>,
375
376
  Decrement<RemainingNumRecursions>
@@ -4,27 +4,27 @@ import { Obj } from './object.mjs';
4
4
 
5
5
  describe('shallowEq', () => {
6
6
  test('truthy case 1', () => {
7
- expect(Obj.shallowEq({ x: 0 }, { x: 0 })).toBe(true);
7
+ assert.isTrue(Obj.shallowEq({ x: 0 }, { x: 0 }));
8
8
  });
9
9
 
10
10
  test('truthy case 2', () => {
11
- expect(Obj.shallowEq({}, {})).toBe(true);
11
+ assert.isTrue(Obj.shallowEq({}, {}));
12
12
  });
13
13
 
14
14
  test('falsy case 1', () => {
15
- expect(Obj.shallowEq({ x: 0 }, { x: 0, y: 0 })).toBe(false);
15
+ assert.isFalse(Obj.shallowEq({ x: 0 }, { x: 0, y: 0 }));
16
16
  });
17
17
 
18
18
  test('falsy case 2', () => {
19
- expect(Obj.shallowEq({ x: 0, y: 0 }, { x: 0 })).toBe(false);
19
+ assert.isFalse(Obj.shallowEq({ x: 0, y: 0 }, { x: 0 }));
20
20
  });
21
21
 
22
22
  test('falsy case 3', () => {
23
- expect(Obj.shallowEq({ x: 0 }, { y: 0 })).toBe(false);
23
+ assert.isFalse(Obj.shallowEq({ x: 0 }, { y: 0 }));
24
24
  });
25
25
 
26
26
  test('falsy case 4', () => {
27
- expect(Obj.shallowEq({ x: [] }, { y: 0 })).toBe(false);
27
+ assert.isFalse(Obj.shallowEq({ x: [] }, { y: 0 }));
28
28
  });
29
29
  });
30
30
 
@@ -67,7 +67,7 @@ describe(castDeepMutable, () => {
67
67
  };
68
68
  };
69
69
 
70
- expectType<typeof mut_state, MutableState>('~=');
70
+ expectType<typeof mut_state, MutableState>('=');
71
71
 
72
72
  mut_state.user.profile.tags.push('editor');
73
73
 
@@ -28,7 +28,7 @@ describe(castReadonly, () => {
28
28
 
29
29
  expect(readonly.value).toBe(42);
30
30
 
31
- expect(Object.is(readonly, original)).toBe(true);
31
+ assert.isTrue(Object.is(readonly, original));
32
32
  });
33
33
 
34
34
  test('castReadonly should work with primitives', () => {
@@ -36,7 +36,7 @@ describe(castReadonly, () => {
36
36
 
37
37
  expect(castReadonly('hello')).toBe('hello');
38
38
 
39
- expect(castReadonly(true)).toBe(true);
39
+ assert.isTrue(castReadonly(true));
40
40
  });
41
41
 
42
42
  test('castReadonly should work with null and undefined', () => {
@@ -75,7 +75,7 @@ describe(castDeepReadonly, () => {
75
75
 
76
76
  expect(readonly.users[0]?.profile.name).toBe('Alice');
77
77
 
78
- expect(readonly.settings.options.debug).toBe(true);
78
+ assert.isTrue(readonly.settings.options.debug);
79
79
  });
80
80
 
81
81
  test('should work with arrays of objects', () => {
@@ -98,7 +98,7 @@ describe(castDeepReadonly, () => {
98
98
 
99
99
  expect(castDeepReadonly('hello')).toBe('hello');
100
100
 
101
- expect(castDeepReadonly(true)).toBe(true);
101
+ assert.isTrue(castDeepReadonly(true));
102
102
  });
103
103
 
104
104
  test('castDeepReadonly should work with null and undefined', () => {
@@ -3,16 +3,16 @@ import { ifThen } from './if-then.mjs';
3
3
  describe(ifThen, () => {
4
4
  test('should implement logical implication truth table', () => {
5
5
  // True antecedent, true consequent -> true
6
- expect(ifThen(true, true)).toBe(true);
6
+ assert.isTrue(ifThen(true, true));
7
7
 
8
8
  // True antecedent, false consequent -> false
9
- expect(ifThen(true, false)).toBe(false);
9
+ assert.isFalse(ifThen(true, false));
10
10
 
11
11
  // False antecedent, true consequent -> true (vacuously true)
12
- expect(ifThen(false, true)).toBe(true);
12
+ assert.isTrue(ifThen(false, true));
13
13
 
14
14
  // False antecedent, false consequent -> true (vacuously true)
15
- expect(ifThen(false, false)).toBe(true);
15
+ assert.isTrue(ifThen(false, false));
16
16
  });
17
17
 
18
18
  test('should work for validation logic', () => {
@@ -22,13 +22,13 @@ describe(ifThen, () => {
22
22
  return ifThen(isRequired, hasValue);
23
23
  };
24
24
 
25
- expect(validateField('hello', true)).toBe(true); // required and has value
25
+ assert.isTrue(validateField('hello', true)); // required and has value
26
26
 
27
- expect(validateField('', true)).toBe(false); // required but no value
27
+ assert.isFalse(validateField('', true)); // required but no value
28
28
 
29
- expect(validateField('', false)).toBe(true); // not required, so valid
29
+ assert.isTrue(validateField('', false)); // not required, so valid
30
30
 
31
- expect(validateField('hello', false)).toBe(true); // not required, has value
31
+ assert.isTrue(validateField('hello', false)); // not required, has value
32
32
  });
33
33
 
34
34
  test('should work for access control logic', () => {
@@ -39,13 +39,13 @@ describe(ifThen, () => {
39
39
  // If admin, then must have permission
40
40
  ifThen(isAdmin, hasPermission);
41
41
 
42
- expect(checkPermission(true, true)).toBe(true); // admin with permission
42
+ assert.isTrue(checkPermission(true, true)); // admin with permission
43
43
 
44
- expect(checkPermission(true, false)).toBe(false); // admin without permission
44
+ assert.isFalse(checkPermission(true, false)); // admin without permission
45
45
 
46
- expect(checkPermission(false, true)).toBe(true); // non-admin with permission
46
+ assert.isTrue(checkPermission(false, true)); // non-admin with permission
47
47
 
48
- expect(checkPermission(false, false)).toBe(true); // non-admin without permission
48
+ assert.isTrue(checkPermission(false, false)); // non-admin without permission
49
49
  });
50
50
 
51
51
  test('should work for contract validation', () => {
@@ -56,26 +56,26 @@ describe(ifThen, () => {
56
56
  // If premium, then all premium features must be enabled
57
57
  ifThen(isPremium, hasAllFeatures);
58
58
 
59
- expect(validateSubscription(true, true)).toBe(true); // premium with all features
59
+ assert.isTrue(validateSubscription(true, true)); // premium with all features
60
60
 
61
- expect(validateSubscription(true, false)).toBe(false); // premium without all features
61
+ assert.isFalse(validateSubscription(true, false)); // premium without all features
62
62
 
63
- expect(validateSubscription(false, true)).toBe(true); // non-premium with features
63
+ assert.isTrue(validateSubscription(false, true)); // non-premium with features
64
64
 
65
- expect(validateSubscription(false, false)).toBe(true); // non-premium without features
65
+ assert.isTrue(validateSubscription(false, false)); // non-premium without features
66
66
  });
67
67
 
68
68
  test('should work in chaining scenarios', () => {
69
69
  const validateChain = (a: boolean, b: boolean, c: boolean): boolean =>
70
70
  ifThen(a, b) && ifThen(b, c);
71
71
 
72
- expect(validateChain(true, true, true)).toBe(true); // valid chain
72
+ assert.isTrue(validateChain(true, true, true)); // valid chain
73
73
 
74
- expect(validateChain(true, false, true)).toBe(false); // breaks at first implication
74
+ assert.isFalse(validateChain(true, false, true)); // breaks at first implication
75
75
 
76
- expect(validateChain(false, false, false)).toBe(true); // vacuously true chain
76
+ assert.isTrue(validateChain(false, false, false)); // vacuously true chain
77
77
 
78
- expect(validateChain(true, true, false)).toBe(false); // breaks at second implication
78
+ assert.isFalse(validateChain(true, true, false)); // breaks at second implication
79
79
  });
80
80
 
81
81
  test('should work with negation patterns', () => {
@@ -83,12 +83,12 @@ describe(ifThen, () => {
83
83
  // "If not expired then valid" is equivalent to "expired OR valid"
84
84
  ifThen(!isExpired, isValid);
85
85
 
86
- expect(checkExpiredLogic(false, true)).toBe(true); // not expired and valid
86
+ assert.isTrue(checkExpiredLogic(false, true)); // not expired and valid
87
87
 
88
- expect(checkExpiredLogic(false, false)).toBe(false); // not expired but invalid
88
+ assert.isFalse(checkExpiredLogic(false, false)); // not expired but invalid
89
89
 
90
- expect(checkExpiredLogic(true, true)).toBe(true); // expired but valid (vacuous)
90
+ assert.isTrue(checkExpiredLogic(true, true)); // expired but valid (vacuous)
91
91
 
92
- expect(checkExpiredLogic(true, false)).toBe(true); // expired and invalid (vacuous)
92
+ assert.isTrue(checkExpiredLogic(true, false)); // expired and invalid (vacuous)
93
93
  });
94
94
  });
@@ -35,11 +35,11 @@
35
35
  *
36
36
  * expectType<typeof rgb, readonly [255, 128, 0]>('=');
37
37
  *
38
- * assert(rgb[0] === 255);
38
+ * assert.isTrue(rgb[0] === 255);
39
39
  *
40
- * assert(rgb[1] === 128);
40
+ * assert.isTrue(rgb[1] === 128);
41
41
  *
42
- * assert(rgb[2] === 0);
42
+ * assert.isTrue(rgb[2] === 0);
43
43
  * ```
44
44
  *
45
45
  * @template T - A tuple type with literal types inferred from the arguments
@@ -18,10 +18,10 @@ import { Result } from '../functional/index.mjs';
18
18
  *
19
19
  * const successResult = await successPromise;
20
20
  *
21
- * assert.ok(Result.isOk(successResult));
21
+ * assert.isTrue(Result.isOk(successResult));
22
22
  *
23
23
  * if (Result.isOk(successResult)) {
24
- * assert(successResult.value === 42);
24
+ * assert.isTrue(successResult.value === 42);
25
25
  * }
26
26
  *
27
27
  * // Create a promise that rejects with an error
@@ -33,10 +33,10 @@ import { Result } from '../functional/index.mjs';
33
33
  *
34
34
  * const errorResult = await errorPromise;
35
35
  *
36
- * assert.ok(Result.isErr(errorResult));
36
+ * assert.isTrue(Result.isErr(errorResult));
37
37
  *
38
38
  * if (Result.isErr(errorResult)) {
39
- * assert(errorResult.value === 'Something went wrong');
39
+ * assert.isTrue(errorResult.value === 'Something went wrong');
40
40
  * }
41
41
  * ```
42
42
  *
@@ -12,11 +12,9 @@ describe(createPromise, () => {
12
12
 
13
13
  const result = await resultPromise;
14
14
 
15
- expect(Result.isOk(result)).toBe(true);
15
+ assert.isTrue(Result.isOk(result));
16
16
 
17
- if (Result.isOk(result)) {
18
- expect(result.value).toBe(42);
19
- }
17
+ expect(result.value).toBe(42);
20
18
  });
21
19
 
22
20
  test('resolves to Result.err when executor rejects', async () => {
@@ -26,11 +24,9 @@ describe(createPromise, () => {
26
24
  reject(rejection);
27
25
  });
28
26
 
29
- expect(Result.isErr(result)).toBe(true);
27
+ assert.isTrue(Result.isErr(result));
30
28
 
31
- if (Result.isErr(result)) {
32
- expect(result.value).toBe(rejection);
33
- }
29
+ expect(result.value).toBe(rejection);
34
30
  });
35
31
 
36
32
  test('supports non-Error rejection reasons', async () => {
@@ -38,12 +34,10 @@ describe(createPromise, () => {
38
34
  reject('failure');
39
35
  });
40
36
 
41
- expect(Result.isErr(result)).toBe(true);
37
+ assert.isTrue(Result.isErr(result));
42
38
 
43
- if (Result.isErr(result)) {
44
- expectType<typeof result.value, string>('=');
39
+ expectType<typeof result.value, string>('=');
45
40
 
46
- expect(result.value).toBe('failure');
47
- }
41
+ expect(result.value).toBe('failure');
48
42
  });
49
43
  });