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
@@ -13,25 +13,25 @@ import {
13
13
  describe('Arr validations', () => {
14
14
  describe(isArray, () => {
15
15
  test('should return true for arrays', () => {
16
- expect(isArray([1, 2, 3])).toBe(true);
16
+ assert.isTrue(isArray([1, 2, 3]));
17
17
 
18
- expect(isArray([])).toBe(true);
18
+ assert.isTrue(isArray([]));
19
19
 
20
- expect(isArray(['a', 'b'])).toBe(true);
20
+ assert.isTrue(isArray(['a', 'b']));
21
21
  });
22
22
 
23
23
  test('should return false for non-arrays', () => {
24
- expect(isArray('hello')).toBe(false);
24
+ assert.isFalse(isArray('hello'));
25
25
 
26
- expect(isArray(123)).toBe(false);
26
+ assert.isFalse(isArray(123));
27
27
 
28
- expect(isArray(null)).toBe(false);
28
+ assert.isFalse(isArray(null));
29
29
 
30
- expect(isArray(undefined)).toBe(false);
30
+ assert.isFalse(isArray(undefined));
31
31
 
32
- expect(isArray({})).toBe(false);
32
+ assert.isFalse(isArray({}));
33
33
 
34
- expect(isArray(new Set())).toBe(false);
34
+ assert.isFalse(isArray(new Set()));
35
35
  });
36
36
 
37
37
  test('should refine union types correctly', () => {
@@ -139,23 +139,23 @@ describe('Arr validations', () => {
139
139
  });
140
140
 
141
141
  test('should return true for arrays (additional)', () => {
142
- expect(isArray([])).toBe(true);
142
+ assert.isTrue(isArray([]));
143
143
 
144
- expect(isArray([1, 2, 3])).toBe(true);
144
+ assert.isTrue(isArray([1, 2, 3]));
145
145
 
146
- expect(isArray(['a', 'b'])).toBe(true);
146
+ assert.isTrue(isArray(['a', 'b']));
147
147
  });
148
148
 
149
149
  test('should return false for non-arrays (additional)', () => {
150
- expect(isArray('string')).toBe(false);
150
+ assert.isFalse(isArray('string'));
151
151
 
152
- expect(isArray(123)).toBe(false);
152
+ assert.isFalse(isArray(123));
153
153
 
154
- expect(isArray({})).toBe(false);
154
+ assert.isFalse(isArray({}));
155
155
 
156
- expect(isArray(null)).toBe(false);
156
+ assert.isFalse(isArray(null));
157
157
 
158
- expect(isArray(undefined)).toBe(false);
158
+ assert.isFalse(isArray(undefined));
159
159
  });
160
160
 
161
161
  test('should work as type guard (additional)', () => {
@@ -171,7 +171,7 @@ describe('Arr validations', () => {
171
171
  test('should handle array-like objects', () => {
172
172
  const arrayLike = { 0: 'a', 1: 'b', length: 2 };
173
173
 
174
- expect(isArray(arrayLike)).toBe(false);
174
+ assert.isFalse(isArray(arrayLike));
175
175
  });
176
176
 
177
177
  describe('comprehensive type guard tests', () => {
@@ -377,11 +377,11 @@ describe('Arr validations', () => {
377
377
  expectType<typeof result, boolean>('=');
378
378
 
379
379
  test('case 1', () => {
380
- expect(result).toBe(false);
380
+ assert.isFalse(result);
381
381
  });
382
382
 
383
383
  test('case 2', () => {
384
- expect(isEmpty([])).toBe(true);
384
+ assert.isTrue(isEmpty([]));
385
385
  });
386
386
  });
387
387
 
@@ -393,11 +393,11 @@ describe('Arr validations', () => {
393
393
  expectType<typeof result, boolean>('=');
394
394
 
395
395
  test('case 1', () => {
396
- expect(result).toBe(true);
396
+ assert.isTrue(result);
397
397
  });
398
398
 
399
399
  test('case 2', () => {
400
- expect(isNonEmpty([])).toBe(false);
400
+ assert.isFalse(isNonEmpty([]));
401
401
  });
402
402
  });
403
403
 
@@ -405,7 +405,7 @@ describe('Arr validations', () => {
405
405
  test('should return true if array has specified length', () => {
406
406
  const arr = [1, 2, 3] as const;
407
407
 
408
- expect(isArrayOfLength(arr, 3)).toBe(true);
408
+ assert.isTrue(isArrayOfLength(arr, 3));
409
409
 
410
410
  if (isArrayOfLength(arr, 3)) {
411
411
  expectType<typeof arr, readonly [1, 2, 3]>('=');
@@ -415,13 +415,13 @@ describe('Arr validations', () => {
415
415
  test('should return false if array does not have specified length', () => {
416
416
  const arr = [1, 2, 3] as const;
417
417
 
418
- expect(isArrayOfLength(arr, 2)).toBe(false);
418
+ assert.isFalse(isArrayOfLength(arr, 2));
419
419
  });
420
420
 
421
421
  test('should return true for empty array and length 0', () => {
422
422
  const arr = [] as const;
423
423
 
424
- expect(isArrayOfLength(arr, 0)).toBe(true);
424
+ assert.isTrue(isArrayOfLength(arr, 0));
425
425
 
426
426
  if (isArrayOfLength(arr, 0)) {
427
427
  expectType<typeof arr, readonly []>('=');
@@ -431,47 +431,47 @@ describe('Arr validations', () => {
431
431
  test('should return false for non-empty array and length 0', () => {
432
432
  const arr = [1] as const;
433
433
 
434
- expect(isArrayOfLength(arr, 0)).toBe(false);
434
+ assert.isFalse(isArrayOfLength(arr, 0));
435
435
  });
436
436
 
437
437
  test('should work with unknown array type', () => {
438
438
  const arr: number[] = [1, 2];
439
439
 
440
- expect(isArrayOfLength(arr, 2)).toBe(true);
440
+ assert.isTrue(isArrayOfLength(arr, 2));
441
441
 
442
442
  if (isArrayOfLength(arr, 2)) {
443
443
  expectType<typeof arr, number[] & ArrayOfLength<2, number>>('=');
444
444
  }
445
445
 
446
- expect(isArrayOfLength(arr, 3)).toBe(false);
446
+ assert.isFalse(isArrayOfLength(arr, 3));
447
447
  });
448
448
 
449
449
  test('should work with unknown readonly array type', () => {
450
450
  const arr: readonly number[] = [1, 2];
451
451
 
452
- expect(isArrayOfLength(arr, 2)).toBe(true);
452
+ assert.isTrue(isArrayOfLength(arr, 2));
453
453
 
454
454
  if (isArrayOfLength(arr, 2)) {
455
455
  expectType<typeof arr, ArrayOfLength<2, number>>('=');
456
456
  }
457
457
 
458
- expect(isArrayOfLength(arr, 3)).toBe(false);
458
+ assert.isFalse(isArrayOfLength(arr, 3));
459
459
  });
460
460
 
461
461
  test('should return true for arrays of exact length (additional)', () => {
462
- expect(isArrayOfLength([1, 2, 3], 3)).toBe(true);
462
+ assert.isTrue(isArrayOfLength([1, 2, 3], 3));
463
463
 
464
- expect(isArrayOfLength([], 0)).toBe(true);
464
+ assert.isTrue(isArrayOfLength([], 0));
465
465
 
466
- expect(isArrayOfLength(['a'], 1)).toBe(true);
466
+ assert.isTrue(isArrayOfLength(['a'], 1));
467
467
  });
468
468
 
469
469
  test('should return false for arrays of different length (additional)', () => {
470
- expect(isArrayOfLength([1, 2, 3], 2)).toBe(false);
470
+ assert.isFalse(isArrayOfLength([1, 2, 3], 2));
471
471
 
472
- expect(isArrayOfLength([1, 2, 3], 4)).toBe(false);
472
+ assert.isFalse(isArrayOfLength([1, 2, 3], 4));
473
473
 
474
- expect(isArrayOfLength([], 1)).toBe(false);
474
+ assert.isFalse(isArrayOfLength([], 1));
475
475
  });
476
476
 
477
477
  test('should work as type guard with exact length (additional)', () => {
@@ -489,13 +489,13 @@ describe('Arr validations', () => {
489
489
  test('should return true if array length is greater than or equal to specified length', () => {
490
490
  const arr = [1, 2, 3] as const;
491
491
 
492
- expect(isArrayAtLeastLength(arr, 3)).toBe(true);
492
+ assert.isTrue(isArrayAtLeastLength(arr, 3));
493
493
 
494
494
  if (isArrayAtLeastLength(arr, 3)) {
495
495
  expectType<typeof arr, readonly [1, 2, 3]>('=');
496
496
  }
497
497
 
498
- expect(isArrayAtLeastLength(arr, 2)).toBe(true);
498
+ assert.isTrue(isArrayAtLeastLength(arr, 2));
499
499
 
500
500
  if (isArrayAtLeastLength(arr, 2)) {
501
501
  expectType<typeof arr, readonly [1, 2, 3]>('=');
@@ -505,13 +505,13 @@ describe('Arr validations', () => {
505
505
  test('should return false if array length is less than specified length', () => {
506
506
  const arr = [1, 2, 3] as const;
507
507
 
508
- expect(isArrayAtLeastLength(arr, 4)).toBe(false);
508
+ assert.isFalse(isArrayAtLeastLength(arr, 4));
509
509
  });
510
510
 
511
511
  test('should return true for empty array and length 0', () => {
512
512
  const arr = [] as const;
513
513
 
514
- expect(isArrayAtLeastLength(arr, 0)).toBe(true);
514
+ assert.isTrue(isArrayAtLeastLength(arr, 0));
515
515
 
516
516
  if (isArrayAtLeastLength(arr, 0)) {
517
517
  expectType<typeof arr, readonly []>('=');
@@ -521,41 +521,43 @@ describe('Arr validations', () => {
521
521
  test('should return false for empty array and positive length', () => {
522
522
  const arr = [] as const;
523
523
 
524
- expect(isArrayAtLeastLength(arr, 1)).toBe(false);
524
+ assert.isFalse(isArrayAtLeastLength(arr, 1));
525
525
  });
526
526
 
527
527
  test('should work with unknown array type', () => {
528
528
  const arr: number[] = [1, 2];
529
529
 
530
- expect(isArrayAtLeastLength(arr, 2)).toBe(true);
530
+ assert.isTrue(isArrayAtLeastLength(arr, 2));
531
531
 
532
- if (isArrayAtLeastLength(arr, 2)) {
533
- expectType<typeof arr, number[] & ArrayAtLeastLen<2, number>>('=');
534
- }
532
+ expectType<typeof arr, number[] & ArrayAtLeastLen<2, number>>('=');
535
533
 
536
- expect(isArrayAtLeastLength(arr, 1)).toBe(true);
534
+ assert.isFalse(isArrayAtLeastLength(arr, 3));
535
+ });
537
536
 
538
- if (isArrayAtLeastLength(arr, 1)) {
539
- expectType<typeof arr, number[] & ArrayAtLeastLen<1, number>>('=');
540
- }
537
+ test('should work with unknown array type 2', () => {
538
+ const arr: number[] = [1, 2];
539
+
540
+ assert.isTrue(isArrayAtLeastLength(arr, 1));
541
+
542
+ expectType<typeof arr, number[] & ArrayAtLeastLen<1, number>>('=');
541
543
 
542
- expect(isArrayAtLeastLength(arr, 3)).toBe(false);
544
+ assert.isFalse(isArrayAtLeastLength(arr, 3));
543
545
  });
544
546
 
545
547
  test('should return true for arrays of at least specified length (additional)', () => {
546
- expect(isArrayAtLeastLength([1, 2, 3], 3)).toBe(true);
548
+ assert.isTrue(isArrayAtLeastLength([1, 2, 3], 3));
547
549
 
548
- expect(isArrayAtLeastLength([1, 2, 3], 2)).toBe(true);
550
+ assert.isTrue(isArrayAtLeastLength([1, 2, 3], 2));
549
551
 
550
- expect(isArrayAtLeastLength([1, 2, 3], 1)).toBe(true);
552
+ assert.isTrue(isArrayAtLeastLength([1, 2, 3], 1));
551
553
 
552
- expect(isArrayAtLeastLength([1, 2, 3], 0)).toBe(true);
554
+ assert.isTrue(isArrayAtLeastLength([1, 2, 3], 0));
553
555
  });
554
556
 
555
557
  test('should return false for arrays shorter than specified length (additional)', () => {
556
- expect(isArrayAtLeastLength([1, 2, 3], 4)).toBe(false);
558
+ assert.isFalse(isArrayAtLeastLength([1, 2, 3], 4));
557
559
 
558
- expect(isArrayAtLeastLength([], 1)).toBe(false);
560
+ assert.isFalse(isArrayAtLeastLength([], 1));
559
561
  });
560
562
 
561
563
  test('should work as type guard for at least length (additional)', () => {
@@ -575,7 +577,7 @@ describe('Arr validations', () => {
575
577
 
576
578
  const allEven = every(evens, (n) => n % 2 === 0);
577
579
 
578
- expect(allEven).toBe(true);
580
+ assert.isTrue(allEven);
579
581
  });
580
582
 
581
583
  test('should return false when not all elements satisfy predicate', () => {
@@ -583,7 +585,7 @@ describe('Arr validations', () => {
583
585
 
584
586
  const allEven = every(mixed, (n) => n % 2 === 0);
585
587
 
586
- expect(allEven).toBe(false);
588
+ assert.isFalse(allEven);
587
589
  });
588
590
 
589
591
  test('should work as type guard', () => {
@@ -591,7 +593,7 @@ describe('Arr validations', () => {
591
593
 
592
594
  if (every(mixed, (x): x is string => typeof x === 'string')) {
593
595
  // TypeScript narrows mixed to readonly string[] here
594
- expect(mixed.every((s) => typeof s === 'string')).toBe(true);
596
+ assert.isTrue(mixed.every((s) => typeof s === 'string'));
595
597
  }
596
598
  });
597
599
 
@@ -600,9 +602,9 @@ describe('Arr validations', () => {
600
602
 
601
603
  const allPositive = every(isPositive);
602
604
 
603
- expect(allPositive([1, 2, 3])).toBe(true);
605
+ assert.isTrue(allPositive([1, 2, 3]));
604
606
 
605
- expect(allPositive([1, -2, 3])).toBe(false);
607
+ assert.isFalse(allPositive([1, -2, 3]));
606
608
  });
607
609
 
608
610
  test('should work with curried type guards', () => {
@@ -623,7 +625,7 @@ describe('Arr validations', () => {
623
625
 
624
626
  const result = every(empty, (n) => n > 0);
625
627
 
626
- expect(result).toBe(true);
628
+ assert.isTrue(result);
627
629
  });
628
630
 
629
631
  test('should pass index to predicate', () => {
@@ -631,7 +633,7 @@ describe('Arr validations', () => {
631
633
 
632
634
  const indexMatchesValue = every(numbers, (val, idx) => val === idx);
633
635
 
634
- expect(indexMatchesValue).toBe(true);
636
+ assert.isTrue(indexMatchesValue);
635
637
  });
636
638
  });
637
639
 
@@ -641,7 +643,7 @@ describe('Arr validations', () => {
641
643
 
642
644
  const hasEven = some(numbers, (n) => n % 2 === 0);
643
645
 
644
- expect(hasEven).toBe(true);
646
+ assert.isTrue(hasEven);
645
647
  });
646
648
 
647
649
  test('should return false when no elements satisfy predicate', () => {
@@ -649,7 +651,7 @@ describe('Arr validations', () => {
649
651
 
650
652
  const hasEven = some(odds, (n) => n % 2 === 0);
651
653
 
652
- expect(hasEven).toBe(false);
654
+ assert.isFalse(hasEven);
653
655
  });
654
656
 
655
657
  test('should work with curried version', () => {
@@ -657,9 +659,9 @@ describe('Arr validations', () => {
657
659
 
658
660
  const hasNegative = some(isNegative);
659
661
 
660
- expect(hasNegative([1, 2, -3])).toBe(true);
662
+ assert.isTrue(hasNegative([1, 2, -3]));
661
663
 
662
- expect(hasNegative([1, 2, 3])).toBe(false);
664
+ assert.isFalse(hasNegative([1, 2, 3]));
663
665
  });
664
666
 
665
667
  test('should return false for empty array', () => {
@@ -667,7 +669,7 @@ describe('Arr validations', () => {
667
669
 
668
670
  const result = some(empty, (n) => n > 0);
669
671
 
670
- expect(result).toBe(false);
672
+ assert.isFalse(result);
671
673
  });
672
674
 
673
675
  test('should pass index to predicate', () => {
@@ -678,7 +680,7 @@ describe('Arr validations', () => {
678
680
  (val, idx) => val === idx * 10,
679
681
  );
680
682
 
681
- expect(hasValueMatchingIndex).toBe(true);
683
+ assert.isTrue(hasValueMatchingIndex);
682
684
  });
683
685
  });
684
686
 
@@ -686,38 +688,38 @@ describe('Arr validations', () => {
686
688
  test('should return true for valid indices', () => {
687
689
  const array = ['a', 'b', 'c'];
688
690
 
689
- expect(indexIsInRange(array, 0)).toBe(true);
691
+ assert.isTrue(indexIsInRange(array, 0));
690
692
 
691
- expect(indexIsInRange(array, 1)).toBe(true);
693
+ assert.isTrue(indexIsInRange(array, 1));
692
694
 
693
- expect(indexIsInRange(array, 2)).toBe(true);
695
+ assert.isTrue(indexIsInRange(array, 2));
694
696
  });
695
697
 
696
698
  test('should return false for invalid indices', () => {
697
699
  const array = ['a', 'b', 'c'];
698
700
 
699
- expect(indexIsInRange(array, 3)).toBe(false);
701
+ assert.isFalse(indexIsInRange(array, 3));
700
702
 
701
- expect(indexIsInRange(array, 10)).toBe(false);
703
+ assert.isFalse(indexIsInRange(array, 10));
702
704
  });
703
705
 
704
706
  test('should work with empty array', () => {
705
707
  const empty: readonly string[] = [];
706
708
 
707
- expect(indexIsInRange(empty, 0)).toBe(false);
709
+ assert.isFalse(indexIsInRange(empty, 0));
708
710
 
709
711
  // @ts-expect-error negative indices should not be allowed
710
- expect(indexIsInRange(empty, -1)).toBe(false);
712
+ assert.isFalse(indexIsInRange(empty, -1));
711
713
  });
712
714
 
713
715
  test('should be type error with floating point indices', () => {
714
716
  const array = [1, 2, 3];
715
717
 
716
718
  // @ts-expect-error floating point indices should not be allowed
717
- expect(indexIsInRange(array, 1.5)).toBe(true); // JavaScript arrays accept floating point indices
719
+ assert.isTrue(indexIsInRange(array, 1.5)); // JavaScript arrays accept floating point indices
718
720
 
719
721
  // @ts-expect-error floating point indices should not be allowed
720
- expect(indexIsInRange(array, 3.1)).toBe(false);
722
+ assert.isFalse(indexIsInRange(array, 3.1));
721
723
  });
722
724
  });
723
725
  });
@@ -10,11 +10,11 @@ describe('Array.every', () => {
10
10
  }
11
11
 
12
12
  test('case 1', () => {
13
- expect(xs.every((x): x is 1 => x === 1)).toBe(false);
13
+ assert.isFalse(xs.every((x): x is 1 => x === 1));
14
14
  });
15
15
 
16
16
  test('case 2', () => {
17
- expect(xs.every((x) => 1 <= x && x <= 3)).toBe(true);
17
+ assert.isTrue(xs.every((x) => 1 <= x && x <= 3));
18
18
  });
19
19
  });
20
20
 
@@ -22,11 +22,11 @@ describe('Array.some', () => {
22
22
  const xs = [1, 2, 3] as const;
23
23
 
24
24
  test('case 1', () => {
25
- expect(xs.some((x): x is 1 => x === 1)).toBe(true);
25
+ assert.isTrue(xs.some((x): x is 1 => x === 1));
26
26
  });
27
27
 
28
28
  test('case 2', () => {
29
- expect(xs.some((x) => x <= 1 && 3 <= x)).toBe(false);
29
+ assert.isFalse(xs.some((x) => x <= 1 && 3 <= x));
30
30
  });
31
31
  });
32
32
 
@@ -54,7 +54,7 @@ describe('Array.includes', () => {
54
54
  expectType<typeof result, boolean>('=');
55
55
 
56
56
  test('case 1', () => {
57
- expect(result).toBe(true);
57
+ assert.isTrue(result);
58
58
  });
59
59
  }
60
60
 
@@ -66,7 +66,7 @@ describe('Array.includes', () => {
66
66
  expectType<typeof result, boolean>('=');
67
67
 
68
68
  test('case 2', () => {
69
- expect(result).toBe(false);
69
+ assert.isFalse(result);
70
70
  });
71
71
  }
72
72
  });
@@ -150,9 +150,9 @@ describe('IMapMapped.equal', () => {
150
150
  // Test structural equality, not reference equality
151
151
  expect(map1.size).toBe(map2.size);
152
152
 
153
- expect(map1.has({ id: 1, type: 'user' })).toBe(true);
153
+ assert.isTrue(map1.has({ id: 1, type: 'user' }));
154
154
 
155
- expect(map2.has({ id: 1, type: 'user' })).toBe(true);
155
+ assert.isTrue(map2.has({ id: 1, type: 'user' }));
156
156
 
157
157
  expect(Optional.unwrap(map1.get({ id: 1, type: 'user' }))).toBe(
158
158
  Optional.unwrap(map2.get({ id: 1, type: 'user' })),
@@ -178,7 +178,7 @@ describe('IMapMapped.equal', () => {
178
178
  stringToTestKey,
179
179
  );
180
180
 
181
- expect(IMapMapped.equal(map1, map2)).toBe(false);
181
+ assert.isFalse(IMapMapped.equal(map1, map2));
182
182
  });
183
183
 
184
184
  test('should return false for maps with different keys', () => {
@@ -200,7 +200,7 @@ describe('IMapMapped.equal', () => {
200
200
  stringToTestKey,
201
201
  );
202
202
 
203
- expect(IMapMapped.equal(map1, map2)).toBe(false);
203
+ assert.isFalse(IMapMapped.equal(map1, map2));
204
204
  });
205
205
 
206
206
  test('should return true for empty maps', () => {
@@ -216,7 +216,7 @@ describe('IMapMapped.equal', () => {
216
216
  stringToTestKey,
217
217
  );
218
218
 
219
- expect(IMapMapped.equal(map1, map2)).toBe(true);
219
+ assert.isTrue(IMapMapped.equal(map1, map2));
220
220
  });
221
221
  });
222
222
 
@@ -248,7 +248,7 @@ describe('IMapMapped.has', () => {
248
248
  fromKey,
249
249
  );
250
250
 
251
- expect(s0.has({ v: 3 })).toBe(true);
251
+ assert.isTrue(s0.has({ v: 3 }));
252
252
  });
253
253
 
254
254
  test('case 2', () => {
@@ -262,7 +262,7 @@ describe('IMapMapped.has', () => {
262
262
  fromKey,
263
263
  );
264
264
 
265
- expect(s0.has({ v: 4 })).toBe(false);
265
+ assert.isFalse(s0.has({ v: 4 }));
266
266
  });
267
267
 
268
268
  test('case 3', () => {
@@ -272,7 +272,7 @@ describe('IMapMapped.has', () => {
272
272
  fromKey,
273
273
  );
274
274
 
275
- expect(s0.has({ v: 3 })).toBe(false);
275
+ assert.isFalse(s0.has({ v: 3 }));
276
276
  });
277
277
  });
278
278
 
@@ -438,7 +438,7 @@ describe('IMapMapped.update', () => {
438
438
 
439
439
  expect(updated).toBe(map);
440
440
 
441
- expect(Optional.isNone(updated.get({ id: 2, type: 'user' }))).toBe(true);
441
+ assert.isTrue(Optional.isNone(updated.get({ id: 2, type: 'user' })));
442
442
  });
443
443
  });
444
444
 
@@ -560,7 +560,7 @@ describe('IMapMapped.every', () => {
560
560
  stringToTestKey,
561
561
  );
562
562
 
563
- expect(map.every((value) => typeof value === 'string')).toBe(true);
563
+ assert.isTrue(map.every((value) => typeof value === 'string'));
564
564
  });
565
565
 
566
566
  test('should return false when some values do not satisfy predicate', () => {
@@ -573,7 +573,7 @@ describe('IMapMapped.every', () => {
573
573
  stringToTestKey,
574
574
  );
575
575
 
576
- expect(map.every((value) => value.length > 5)).toBe(false);
576
+ assert.isFalse(map.every((value) => value.length > 5));
577
577
  });
578
578
 
579
579
  test('should return true for empty map', () => {
@@ -583,7 +583,7 @@ describe('IMapMapped.every', () => {
583
583
  stringToTestKey,
584
584
  );
585
585
 
586
- expect(map.every((value) => value.length > 0)).toBe(true);
586
+ assert.isTrue(map.every((value) => value.length > 0));
587
587
  });
588
588
  });
589
589
 
@@ -599,7 +599,7 @@ describe('IMapMapped.some', () => {
599
599
  );
600
600
 
601
601
  // eslint-disable-next-line unicorn/prefer-includes
602
- expect(map.some((value) => value === 'Alice')).toBe(true);
602
+ assert.isTrue(map.some((value) => value === 'Alice'));
603
603
  });
604
604
 
605
605
  test('should return false when no values satisfy predicate', () => {
@@ -613,7 +613,7 @@ describe('IMapMapped.some', () => {
613
613
  );
614
614
 
615
615
  // eslint-disable-next-line unicorn/prefer-includes
616
- expect(map.some((value) => value === 'Charlie')).toBe(false);
616
+ assert.isFalse(map.some((value) => value === 'Charlie'));
617
617
  });
618
618
 
619
619
  test('should return false for empty map', () => {
@@ -623,7 +623,7 @@ describe('IMapMapped.some', () => {
623
623
  stringToTestKey,
624
624
  );
625
625
 
626
- expect(map.some((value) => value.length > 0)).toBe(false);
626
+ assert.isFalse(map.some((value) => value.length > 0));
627
627
  });
628
628
  });
629
629
 
@@ -724,9 +724,7 @@ describe('IMapMapped.mapKeys', () => {
724
724
 
725
725
  const transformed = map.mapKeys((key) => ({ ...key, id: key.id * 10 }));
726
726
 
727
- expect(Optional.isNone(transformed.get({ id: 1, type: 'user' }))).toBe(
728
- true,
729
- );
727
+ assert.isTrue(Optional.isNone(transformed.get({ id: 1, type: 'user' })));
730
728
 
731
729
  expect(Optional.unwrap(transformed.get({ id: 10, type: 'user' }))).toBe(
732
730
  'Alice',