ts-data-forge 5.1.0 → 6.0.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 (230) 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/is-record.d.mts.map +1 -1
  82. package/dist/guard/is-record.mjs +1 -1
  83. package/dist/guard/is-record.mjs.map +1 -1
  84. package/dist/guard/key-is-in.d.mts +2 -2
  85. package/dist/guard/key-is-in.mjs +2 -2
  86. package/dist/json/json.d.mts +21 -21
  87. package/dist/json/json.mjs +21 -21
  88. package/dist/number/branded-types/int.d.mts +19 -19
  89. package/dist/number/branded-types/int.mjs +19 -19
  90. package/dist/number/branded-types/positive-int.d.mts +20 -20
  91. package/dist/number/branded-types/positive-int.mjs +20 -20
  92. package/dist/number/branded-types/positive-safe-int.d.mts +26 -26
  93. package/dist/number/branded-types/positive-safe-int.mjs +26 -26
  94. package/dist/number/branded-types/safe-int.d.mts +27 -27
  95. package/dist/number/branded-types/safe-int.mjs +27 -27
  96. package/dist/number/branded-types/uint.d.mts +19 -19
  97. package/dist/number/branded-types/uint.mjs +19 -19
  98. package/dist/number/num.d.mts +20 -20
  99. package/dist/number/num.mjs +16 -16
  100. package/dist/number/refined-number-utils.d.mts +11 -11
  101. package/dist/number/refined-number-utils.d.mts.map +1 -1
  102. package/dist/number/refined-number-utils.mjs +11 -11
  103. package/dist/object/object.d.mts +3 -3
  104. package/dist/object/object.d.mts.map +1 -1
  105. package/dist/object/object.mjs +3 -3
  106. package/dist/object/object.mjs.map +1 -1
  107. package/dist/others/tuple.d.mts +3 -3
  108. package/dist/others/tuple.mjs +3 -3
  109. package/dist/promise/promise.d.mts +4 -4
  110. package/dist/promise/promise.mjs +4 -4
  111. package/package.json +15 -13
  112. package/src/array/impl/array-utils-creation.test.mts +1 -1
  113. package/src/array/impl/array-utils-element-access.test.mts +16 -16
  114. package/src/array/impl/array-utils-modification.mts +38 -19
  115. package/src/array/impl/array-utils-reducing-value.mts +8 -8
  116. package/src/array/impl/array-utils-reducing-value.test.mts +23 -31
  117. package/src/array/impl/array-utils-search.mts +4 -4
  118. package/src/array/impl/array-utils-search.test.mts +10 -10
  119. package/src/array/impl/array-utils-set-op.mts +7 -7
  120. package/src/array/impl/array-utils-set-op.test.mts +13 -13
  121. package/src/array/impl/array-utils-size.mts +2 -2
  122. package/src/array/impl/array-utils-slicing.mts +2 -2
  123. package/src/array/impl/array-utils-transformation.test.mts +2 -2
  124. package/src/array/impl/array-utils-validation.mts +18 -18
  125. package/src/array/impl/array-utils-validation.test.mts +80 -78
  126. package/src/array/impl/array.test.mts +6 -6
  127. package/src/collections/imap-mapped.test.mts +16 -18
  128. package/src/collections/imap.mts +15 -15
  129. package/src/collections/imap.test.mts +31 -31
  130. package/src/collections/iset-mapped.mts +19 -19
  131. package/src/collections/iset-mapped.test.mts +52 -52
  132. package/src/collections/iset.mts +19 -19
  133. package/src/collections/iset.test.mts +130 -130
  134. package/src/collections/queue.mts +25 -25
  135. package/src/collections/queue.test.mts +33 -35
  136. package/src/collections/stack.mts +25 -25
  137. package/src/collections/stack.test.mts +15 -15
  138. package/src/functional/match.mts +1 -1
  139. package/src/functional/optional/impl/optional-expect-to-be.mts +2 -2
  140. package/src/functional/optional/impl/optional-is-none.mts +1 -1
  141. package/src/functional/optional/impl/optional-is-optional.mts +2 -2
  142. package/src/functional/optional/impl/optional-is-some.mts +1 -1
  143. package/src/functional/optional/impl/optional-none.mts +2 -2
  144. package/src/functional/optional/impl/optional-some.mts +2 -2
  145. package/src/functional/optional/impl/optional-to-nullable.mts +2 -2
  146. package/src/functional/optional/impl/optional-unwrap-or.mts +4 -4
  147. package/src/functional/optional/impl/optional-unwrap-throw.mts +1 -1
  148. package/src/functional/optional/impl/optional-unwrap.mts +2 -2
  149. package/src/functional/optional/impl/optional-zip.mts +1 -1
  150. package/src/functional/optional.test.mts +53 -54
  151. package/src/functional/pipe.mts +2 -2
  152. package/src/functional/pipe.test.mts +4 -4
  153. package/src/functional/result/impl/result-err.mts +1 -1
  154. package/src/functional/result/impl/result-expect-to-be.mts +2 -2
  155. package/src/functional/result/impl/result-from-promise.mts +1 -1
  156. package/src/functional/result/impl/result-from-throwable.mts +1 -1
  157. package/src/functional/result/impl/result-is-err.mts +2 -2
  158. package/src/functional/result/impl/result-is-ok.mts +2 -2
  159. package/src/functional/result/impl/result-is-result.mts +3 -3
  160. package/src/functional/result/impl/result-ok.mts +1 -1
  161. package/src/functional/result/impl/result-unwrap-err-or.mts +4 -4
  162. package/src/functional/result/impl/result-unwrap-err-throw.mts +1 -1
  163. package/src/functional/result/impl/result-unwrap-err.mts +2 -2
  164. package/src/functional/result/impl/result-unwrap-ok-or.mts +4 -4
  165. package/src/functional/result/impl/result-unwrap-ok.mts +2 -2
  166. package/src/functional/result/impl/result-unwrap-throw.mts +1 -1
  167. package/src/functional/result.test.mts +94 -152
  168. package/src/functional/ternary-result/impl/ternary-result-err.mts +1 -1
  169. package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +1 -1
  170. package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +1 -1
  171. package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +3 -3
  172. package/src/functional/ternary-result.test.mts +8 -8
  173. package/src/globals.d.mts +2 -1
  174. package/src/guard/has-key.mts +8 -5
  175. package/src/guard/has-key.test.mts +0 -5
  176. package/src/guard/is-error.test.mts +143 -0
  177. package/src/guard/is-non-empty-string.test.mts +24 -24
  178. package/src/guard/is-non-null-object.test.mts +26 -26
  179. package/src/guard/is-primitive.test.mts +28 -28
  180. package/src/guard/is-record.mts +1 -2
  181. package/src/guard/is-record.test.mts +57 -67
  182. package/src/guard/is-type.test.mts +151 -155
  183. package/src/guard/key-is-in.mts +2 -2
  184. package/src/guard/key-is-in.test.mts +2 -2
  185. package/src/json/json.mts +21 -21
  186. package/src/json/json.test.mts +135 -174
  187. package/src/number/branded-types/finite-number.test.mts +13 -11
  188. package/src/number/branded-types/int.mts +19 -19
  189. package/src/number/branded-types/int.test.mts +14 -14
  190. package/src/number/branded-types/int16.test.mts +16 -16
  191. package/src/number/branded-types/int32.test.mts +16 -16
  192. package/src/number/branded-types/non-negative-finite-number.test.mts +12 -12
  193. package/src/number/branded-types/non-negative-int16.test.mts +16 -16
  194. package/src/number/branded-types/non-negative-int32.test.mts +16 -16
  195. package/src/number/branded-types/non-zero-finite-number.test.mts +14 -14
  196. package/src/number/branded-types/non-zero-int.test.mts +19 -19
  197. package/src/number/branded-types/non-zero-int16.test.mts +16 -16
  198. package/src/number/branded-types/non-zero-int32.test.mts +16 -16
  199. package/src/number/branded-types/non-zero-safe-int.test.mts +23 -23
  200. package/src/number/branded-types/non-zero-uint16.test.mts +16 -16
  201. package/src/number/branded-types/non-zero-uint32.test.mts +16 -16
  202. package/src/number/branded-types/positive-finite-number.test.mts +14 -14
  203. package/src/number/branded-types/positive-int.mts +20 -20
  204. package/src/number/branded-types/positive-int.test.mts +17 -17
  205. package/src/number/branded-types/positive-int16.test.mts +15 -15
  206. package/src/number/branded-types/positive-int32.test.mts +15 -15
  207. package/src/number/branded-types/positive-safe-int.mts +26 -26
  208. package/src/number/branded-types/positive-safe-int.test.mts +19 -19
  209. package/src/number/branded-types/positive-uint16.test.mts +16 -16
  210. package/src/number/branded-types/positive-uint32.test.mts +16 -16
  211. package/src/number/branded-types/safe-int.mts +27 -27
  212. package/src/number/branded-types/safe-int.test.mts +18 -18
  213. package/src/number/branded-types/safe-uint.test.mts +17 -17
  214. package/src/number/branded-types/uint.mts +19 -19
  215. package/src/number/branded-types/uint.test.mts +15 -15
  216. package/src/number/branded-types/uint16.test.mts +15 -15
  217. package/src/number/branded-types/uint32.test.mts +15 -15
  218. package/src/number/enum/int8.test.mts +1 -1
  219. package/src/number/enum/uint8.test.mts +1 -1
  220. package/src/number/num.mts +20 -20
  221. package/src/number/num.test.mts +26 -26
  222. package/src/number/refined-number-utils.mts +13 -13
  223. package/src/object/object.mts +4 -3
  224. package/src/object/object.test.mts +6 -6
  225. package/src/others/cast-mutable.test.mts +1 -1
  226. package/src/others/cast-readonly.test.mts +4 -4
  227. package/src/others/if-then.test.mts +24 -24
  228. package/src/others/tuple.mts +3 -3
  229. package/src/promise/promise.mts +4 -4
  230. package/src/promise/promise.test.mts +7 -13
@@ -44,17 +44,17 @@ export type Queue<T> = Readonly<{
44
44
  * ```ts
45
45
  * const queue = createQueue<number>();
46
46
  *
47
- * assert.ok(queue.isEmpty);
47
+ * assert.isTrue(queue.isEmpty);
48
48
  *
49
- * assert(queue.size === 0);
49
+ * assert.isTrue(queue.size === 0);
50
50
  *
51
51
  * queue.enqueue(1);
52
52
  *
53
53
  * queue.enqueue(2);
54
54
  *
55
- * assert.notOk(queue.isEmpty);
55
+ * assert.isFalse(queue.isEmpty);
56
56
  *
57
- * assert(queue.size === 2);
57
+ * assert.isTrue(queue.size === 2);
58
58
  *
59
59
  * assert.deepStrictEqual(queue.dequeue(), Optional.some(1));
60
60
  *
@@ -64,7 +64,7 @@ export type Queue<T> = Readonly<{
64
64
  *
65
65
  * const seededQueue = createQueue(['first', 'second']);
66
66
  *
67
- * assert(seededQueue.size === 2);
67
+ * assert.isTrue(seededQueue.size === 2);
68
68
  *
69
69
  * assert.deepStrictEqual(seededQueue.dequeue(), Optional.some('first'));
70
70
  *
@@ -81,17 +81,17 @@ export type Queue<T> = Readonly<{
81
81
  * ```ts
82
82
  * const queue = createQueue<number>();
83
83
  *
84
- * assert.ok(queue.isEmpty);
84
+ * assert.isTrue(queue.isEmpty);
85
85
  *
86
- * assert(queue.size === 0);
86
+ * assert.isTrue(queue.size === 0);
87
87
  *
88
88
  * queue.enqueue(1);
89
89
  *
90
90
  * queue.enqueue(2);
91
91
  *
92
- * assert.notOk(queue.isEmpty);
92
+ * assert.isFalse(queue.isEmpty);
93
93
  *
94
- * assert(queue.size === 2);
94
+ * assert.isTrue(queue.size === 2);
95
95
  *
96
96
  * assert.deepStrictEqual(queue.dequeue(), Optional.some(1));
97
97
  *
@@ -101,7 +101,7 @@ export type Queue<T> = Readonly<{
101
101
  *
102
102
  * const seededQueue = createQueue(['first', 'second']);
103
103
  *
104
- * assert(seededQueue.size === 2);
104
+ * assert.isTrue(seededQueue.size === 2);
105
105
  *
106
106
  * assert.deepStrictEqual(seededQueue.dequeue(), Optional.some('first'));
107
107
  *
@@ -118,17 +118,17 @@ export type Queue<T> = Readonly<{
118
118
  * ```ts
119
119
  * const queue = createQueue<number>();
120
120
  *
121
- * assert.ok(queue.isEmpty);
121
+ * assert.isTrue(queue.isEmpty);
122
122
  *
123
- * assert(queue.size === 0);
123
+ * assert.isTrue(queue.size === 0);
124
124
  *
125
125
  * queue.enqueue(1);
126
126
  *
127
127
  * queue.enqueue(2);
128
128
  *
129
- * assert.notOk(queue.isEmpty);
129
+ * assert.isFalse(queue.isEmpty);
130
130
  *
131
- * assert(queue.size === 2);
131
+ * assert.isTrue(queue.size === 2);
132
132
  *
133
133
  * assert.deepStrictEqual(queue.dequeue(), Optional.some(1));
134
134
  *
@@ -138,7 +138,7 @@ export type Queue<T> = Readonly<{
138
138
  *
139
139
  * const seededQueue = createQueue(['first', 'second']);
140
140
  *
141
- * assert(seededQueue.size === 2);
141
+ * assert.isTrue(seededQueue.size === 2);
142
142
  *
143
143
  * assert.deepStrictEqual(seededQueue.dequeue(), Optional.some('first'));
144
144
  *
@@ -158,17 +158,17 @@ export type Queue<T> = Readonly<{
158
158
  * ```ts
159
159
  * const queue = createQueue<number>();
160
160
  *
161
- * assert.ok(queue.isEmpty);
161
+ * assert.isTrue(queue.isEmpty);
162
162
  *
163
- * assert(queue.size === 0);
163
+ * assert.isTrue(queue.size === 0);
164
164
  *
165
165
  * queue.enqueue(1);
166
166
  *
167
167
  * queue.enqueue(2);
168
168
  *
169
- * assert.notOk(queue.isEmpty);
169
+ * assert.isFalse(queue.isEmpty);
170
170
  *
171
- * assert(queue.size === 2);
171
+ * assert.isTrue(queue.size === 2);
172
172
  *
173
173
  * assert.deepStrictEqual(queue.dequeue(), Optional.some(1));
174
174
  *
@@ -178,7 +178,7 @@ export type Queue<T> = Readonly<{
178
178
  *
179
179
  * const seededQueue = createQueue(['first', 'second']);
180
180
  *
181
- * assert(seededQueue.size === 2);
181
+ * assert.isTrue(seededQueue.size === 2);
182
182
  *
183
183
  * assert.deepStrictEqual(seededQueue.dequeue(), Optional.some('first'));
184
184
  *
@@ -381,17 +381,17 @@ class QueueClass<T> implements Queue<T> {
381
381
  * ```ts
382
382
  * const queue = createQueue<number>();
383
383
  *
384
- * assert.ok(queue.isEmpty);
384
+ * assert.isTrue(queue.isEmpty);
385
385
  *
386
- * assert(queue.size === 0);
386
+ * assert.isTrue(queue.size === 0);
387
387
  *
388
388
  * queue.enqueue(1);
389
389
  *
390
390
  * queue.enqueue(2);
391
391
  *
392
- * assert.notOk(queue.isEmpty);
392
+ * assert.isFalse(queue.isEmpty);
393
393
  *
394
- * assert(queue.size === 2);
394
+ * assert.isTrue(queue.size === 2);
395
395
  *
396
396
  * assert.deepStrictEqual(queue.dequeue(), Optional.some(1));
397
397
  *
@@ -401,7 +401,7 @@ class QueueClass<T> implements Queue<T> {
401
401
  *
402
402
  * const seededQueue = createQueue(['first', 'second']);
403
403
  *
404
- * assert(seededQueue.size === 2);
404
+ * assert.isTrue(seededQueue.size === 2);
405
405
  *
406
406
  * assert.deepStrictEqual(seededQueue.dequeue(), Optional.some('first'));
407
407
  *
@@ -9,7 +9,7 @@ describe('Queue test', () => {
9
9
  test('should be empty if initialized without values', () => {
10
10
  const q = createQueue();
11
11
 
12
- expect(q.isEmpty).toBe(true);
12
+ assert.isTrue(q.isEmpty);
13
13
 
14
14
  expect(q.size).toBe(0);
15
15
  });
@@ -17,7 +17,7 @@ describe('Queue test', () => {
17
17
  test('should not be empty if initialized with values', () => {
18
18
  const q = createQueue([1, 2, 3]);
19
19
 
20
- expect(q.isEmpty).toBe(false);
20
+ assert.isFalse(q.isEmpty);
21
21
 
22
22
  expect(q.size).toBe(3);
23
23
  });
@@ -34,7 +34,7 @@ describe('Queue test', () => {
34
34
  test('should increase size and not be empty after enqueueing to an empty queue', () => {
35
35
  mut_q.enqueue(1);
36
36
 
37
- expect(mut_q.isEmpty).toBe(false);
37
+ assert.isFalse(mut_q.isEmpty);
38
38
 
39
39
  expect(mut_q.size).toBe(1);
40
40
  });
@@ -54,9 +54,9 @@ describe('Queue test', () => {
54
54
 
55
55
  const result = q.dequeue();
56
56
 
57
- expect(Optional.isNone(result)).toBe(true);
57
+ assert.isTrue(Optional.isNone(result));
58
58
 
59
- expect(q.isEmpty).toBe(true);
59
+ assert.isTrue(q.isEmpty);
60
60
 
61
61
  expect(q.size).toBe(0);
62
62
  });
@@ -68,7 +68,7 @@ describe('Queue test', () => {
68
68
 
69
69
  const result1 = q.dequeue(); // Dequeues 1 (first element)
70
70
 
71
- expect(Optional.isSome(result1)).toBe(true);
71
+ assert.isTrue(Optional.isSome(result1));
72
72
 
73
73
  if (Optional.isSome(result1)) {
74
74
  expect(result1.value).toBe(1);
@@ -78,7 +78,7 @@ describe('Queue test', () => {
78
78
 
79
79
  const result2 = q.dequeue(); // Dequeues 2
80
80
 
81
- expect(Optional.isSome(result2)).toBe(true);
81
+ assert.isTrue(Optional.isSome(result2));
82
82
 
83
83
  if (Optional.isSome(result2)) {
84
84
  expect(result2.value).toBe(2);
@@ -94,13 +94,13 @@ describe('Queue test', () => {
94
94
 
95
95
  q.dequeue(); // Dequeues 2
96
96
 
97
- expect(q.isEmpty).toBe(true);
97
+ assert.isTrue(q.isEmpty);
98
98
 
99
99
  expect(q.size).toBe(0);
100
100
 
101
101
  const result = q.dequeue(); // Dequeue from empty
102
102
 
103
- expect(Optional.isNone(result)).toBe(true);
103
+ assert.isTrue(Optional.isNone(result));
104
104
  });
105
105
  });
106
106
 
@@ -118,27 +118,27 @@ describe('Queue test', () => {
118
118
 
119
119
  let mut_result = q.dequeue(); // Dequeues 1 (first in)
120
120
 
121
- expect(Optional.isSome(mut_result) && mut_result.value === 1).toBe(true);
121
+ assert.isTrue(Optional.isSome(mut_result) && mut_result.value === 1);
122
122
 
123
123
  expect(q.size).toBe(2);
124
124
 
125
125
  mut_result = q.dequeue(); // Dequeues 2
126
126
 
127
- expect(Optional.isSome(mut_result) && mut_result.value === 2).toBe(true);
127
+ assert.isTrue(Optional.isSome(mut_result) && mut_result.value === 2);
128
128
 
129
129
  expect(q.size).toBe(1);
130
130
 
131
131
  mut_result = q.dequeue(); // Dequeues 3
132
132
 
133
- expect(Optional.isSome(mut_result) && mut_result.value === 3).toBe(true);
133
+ assert.isTrue(Optional.isSome(mut_result) && mut_result.value === 3);
134
134
 
135
135
  expect(q.size).toBe(0);
136
136
 
137
- expect(q.isEmpty).toBe(true);
137
+ assert.isTrue(q.isEmpty);
138
138
 
139
139
  mut_result = q.dequeue();
140
140
 
141
- expect(Optional.isNone(mut_result)).toBe(true);
141
+ assert.isTrue(Optional.isNone(mut_result));
142
142
  });
143
143
 
144
144
  test('initial values are dequeued in the same order (FIFO)', () => {
@@ -148,17 +148,17 @@ describe('Queue test', () => {
148
148
 
149
149
  const result1 = q.dequeue(); // Dequeues 1 (first element)
150
150
 
151
- expect(Optional.isSome(result1) && result1.value === 1).toBe(true);
151
+ assert.isTrue(Optional.isSome(result1) && result1.value === 1);
152
152
 
153
153
  const result2 = q.dequeue(); // Dequeues 2
154
154
 
155
- expect(Optional.isSome(result2) && result2.value === 2).toBe(true);
155
+ assert.isTrue(Optional.isSome(result2) && result2.value === 2);
156
156
 
157
157
  const result3 = q.dequeue(); // Dequeues 3
158
158
 
159
- expect(Optional.isSome(result3) && result3.value === 3).toBe(true);
159
+ assert.isTrue(Optional.isSome(result3) && result3.value === 3);
160
160
 
161
- expect(q.isEmpty).toBe(true);
161
+ assert.isTrue(q.isEmpty);
162
162
  });
163
163
 
164
164
  test('mixed enqueue and dequeue operations maintain FIFO order', () => {
@@ -170,7 +170,7 @@ describe('Queue test', () => {
170
170
 
171
171
  const result1 = q.dequeue();
172
172
 
173
- expect(Optional.isSome(result1) && result1.value === 'A').toBe(true);
173
+ assert.isTrue(Optional.isSome(result1) && result1.value === 'A');
174
174
 
175
175
  q.enqueue('C');
176
176
 
@@ -178,17 +178,17 @@ describe('Queue test', () => {
178
178
 
179
179
  const result2 = q.dequeue();
180
180
 
181
- expect(Optional.isSome(result2) && result2.value === 'B').toBe(true);
181
+ assert.isTrue(Optional.isSome(result2) && result2.value === 'B');
182
182
 
183
183
  const result3 = q.dequeue();
184
184
 
185
- expect(Optional.isSome(result3) && result3.value === 'C').toBe(true);
185
+ assert.isTrue(Optional.isSome(result3) && result3.value === 'C');
186
186
 
187
187
  const result4 = q.dequeue();
188
188
 
189
- expect(Optional.isSome(result4) && result4.value === 'D').toBe(true);
189
+ assert.isTrue(Optional.isSome(result4) && result4.value === 'D');
190
190
 
191
- expect(q.isEmpty).toBe(true);
191
+ assert.isTrue(q.isEmpty);
192
192
  });
193
193
  });
194
194
 
@@ -226,7 +226,7 @@ describe('Queue test', () => {
226
226
 
227
227
  expect(Optional.unwrap(q.dequeue())).toBe(8);
228
228
 
229
- expect(q.isEmpty).toBe(true);
229
+ assert.isTrue(q.isEmpty);
230
230
  });
231
231
 
232
232
  test('should automatically resize when buffer becomes full', () => {
@@ -243,10 +243,10 @@ describe('Queue test', () => {
243
243
  for (const i of range(1, 21)) {
244
244
  const result = q.dequeue();
245
245
 
246
- expect(Optional.isSome(result) && result.value === i).toBe(true);
246
+ assert.isTrue(Optional.isSome(result) && result.value === i);
247
247
  }
248
248
 
249
- expect(q.isEmpty).toBe(true);
249
+ assert.isTrue(q.isEmpty);
250
250
  });
251
251
 
252
252
  test('should handle multiple resize operations', () => {
@@ -280,7 +280,7 @@ describe('Queue test', () => {
280
280
  expect(Optional.unwrap(q.dequeue())).toBe(i);
281
281
  }
282
282
 
283
- expect(q.isEmpty).toBe(true);
283
+ assert.isTrue(q.isEmpty);
284
284
  });
285
285
 
286
286
  test('should handle edge case of single element operations', () => {
@@ -294,11 +294,9 @@ describe('Queue test', () => {
294
294
 
295
295
  const result = q.dequeue();
296
296
 
297
- expect(Optional.isSome(result) && result.value === `item-${i}`).toBe(
298
- true,
299
- );
297
+ assert.isTrue(Optional.isSome(result) && result.value === `item-${i}`);
300
298
 
301
- expect(q.isEmpty).toBe(true);
299
+ assert.isTrue(q.isEmpty);
302
300
  }
303
301
  });
304
302
 
@@ -314,7 +312,7 @@ describe('Queue test', () => {
314
312
  expect(Optional.unwrap(q.dequeue())).toBe(i);
315
313
  }
316
314
 
317
- expect(q.isEmpty).toBe(true);
315
+ assert.isTrue(q.isEmpty);
318
316
  });
319
317
 
320
318
  test('should properly clean up references for garbage collection', () => {
@@ -331,17 +329,17 @@ describe('Queue test', () => {
331
329
  for (const i of range(0, 5)) {
332
330
  const result = q.dequeue();
333
331
 
334
- expect(Optional.isSome(result) && result.value.id === i).toBe(true);
332
+ assert.isTrue(Optional.isSome(result) && result.value.id === i);
335
333
  }
336
334
 
337
335
  // Remaining objects should still be accessible
338
336
  for (const i of range(5, 10)) {
339
337
  const result = q.dequeue();
340
338
 
341
- expect(Optional.isSome(result) && result.value.id === i).toBe(true);
339
+ assert.isTrue(Optional.isSome(result) && result.value.id === i);
342
340
  }
343
341
 
344
- expect(q.isEmpty).toBe(true);
342
+ assert.isTrue(q.isEmpty);
345
343
  });
346
344
  });
347
345
  });
@@ -44,18 +44,18 @@ export type Stack<T> = Readonly<{
44
44
  * ```ts
45
45
  * const stack = createStack<string>();
46
46
  *
47
- * assert.ok(stack.isEmpty);
47
+ * assert.isTrue(stack.isEmpty);
48
48
  *
49
- * assert(stack.size === 0);
49
+ * assert.isTrue(stack.size === 0);
50
50
  *
51
51
  * stack.push('first');
52
52
  *
53
53
  * // eslint-disable-next-line unicorn/prefer-single-call
54
54
  * stack.push('second');
55
55
  *
56
- * assert.notOk(stack.isEmpty);
56
+ * assert.isFalse(stack.isEmpty);
57
57
  *
58
- * assert(stack.size === 2);
58
+ * assert.isTrue(stack.size === 2);
59
59
  *
60
60
  * assert.deepStrictEqual(stack.pop(), Optional.some('second'));
61
61
  *
@@ -65,7 +65,7 @@ export type Stack<T> = Readonly<{
65
65
  *
66
66
  * const seededStack = createStack([10, 20, 30]);
67
67
  *
68
- * assert(seededStack.size === 3);
68
+ * assert.isTrue(seededStack.size === 3);
69
69
  *
70
70
  * assert.deepStrictEqual(seededStack.pop(), Optional.some(30));
71
71
  * ```
@@ -80,18 +80,18 @@ export type Stack<T> = Readonly<{
80
80
  * ```ts
81
81
  * const stack = createStack<string>();
82
82
  *
83
- * assert.ok(stack.isEmpty);
83
+ * assert.isTrue(stack.isEmpty);
84
84
  *
85
- * assert(stack.size === 0);
85
+ * assert.isTrue(stack.size === 0);
86
86
  *
87
87
  * stack.push('first');
88
88
  *
89
89
  * // eslint-disable-next-line unicorn/prefer-single-call
90
90
  * stack.push('second');
91
91
  *
92
- * assert.notOk(stack.isEmpty);
92
+ * assert.isFalse(stack.isEmpty);
93
93
  *
94
- * assert(stack.size === 2);
94
+ * assert.isTrue(stack.size === 2);
95
95
  *
96
96
  * assert.deepStrictEqual(stack.pop(), Optional.some('second'));
97
97
  *
@@ -101,7 +101,7 @@ export type Stack<T> = Readonly<{
101
101
  *
102
102
  * const seededStack = createStack([10, 20, 30]);
103
103
  *
104
- * assert(seededStack.size === 3);
104
+ * assert.isTrue(seededStack.size === 3);
105
105
  *
106
106
  * assert.deepStrictEqual(seededStack.pop(), Optional.some(30));
107
107
  * ```
@@ -116,18 +116,18 @@ export type Stack<T> = Readonly<{
116
116
  * ```ts
117
117
  * const stack = createStack<string>();
118
118
  *
119
- * assert.ok(stack.isEmpty);
119
+ * assert.isTrue(stack.isEmpty);
120
120
  *
121
- * assert(stack.size === 0);
121
+ * assert.isTrue(stack.size === 0);
122
122
  *
123
123
  * stack.push('first');
124
124
  *
125
125
  * // eslint-disable-next-line unicorn/prefer-single-call
126
126
  * stack.push('second');
127
127
  *
128
- * assert.notOk(stack.isEmpty);
128
+ * assert.isFalse(stack.isEmpty);
129
129
  *
130
- * assert(stack.size === 2);
130
+ * assert.isTrue(stack.size === 2);
131
131
  *
132
132
  * assert.deepStrictEqual(stack.pop(), Optional.some('second'));
133
133
  *
@@ -137,7 +137,7 @@ export type Stack<T> = Readonly<{
137
137
  *
138
138
  * const seededStack = createStack([10, 20, 30]);
139
139
  *
140
- * assert(seededStack.size === 3);
140
+ * assert.isTrue(seededStack.size === 3);
141
141
  *
142
142
  * assert.deepStrictEqual(seededStack.pop(), Optional.some(30));
143
143
  * ```
@@ -155,18 +155,18 @@ export type Stack<T> = Readonly<{
155
155
  * ```ts
156
156
  * const stack = createStack<string>();
157
157
  *
158
- * assert.ok(stack.isEmpty);
158
+ * assert.isTrue(stack.isEmpty);
159
159
  *
160
- * assert(stack.size === 0);
160
+ * assert.isTrue(stack.size === 0);
161
161
  *
162
162
  * stack.push('first');
163
163
  *
164
164
  * // eslint-disable-next-line unicorn/prefer-single-call
165
165
  * stack.push('second');
166
166
  *
167
- * assert.notOk(stack.isEmpty);
167
+ * assert.isFalse(stack.isEmpty);
168
168
  *
169
- * assert(stack.size === 2);
169
+ * assert.isTrue(stack.size === 2);
170
170
  *
171
171
  * assert.deepStrictEqual(stack.pop(), Optional.some('second'));
172
172
  *
@@ -176,7 +176,7 @@ export type Stack<T> = Readonly<{
176
176
  *
177
177
  * const seededStack = createStack([10, 20, 30]);
178
178
  *
179
- * assert(seededStack.size === 3);
179
+ * assert.isTrue(seededStack.size === 3);
180
180
  *
181
181
  * assert.deepStrictEqual(seededStack.pop(), Optional.some(30));
182
182
  * ```
@@ -356,18 +356,18 @@ class StackClass<T> implements Stack<T> {
356
356
  * ```ts
357
357
  * const stack = createStack<string>();
358
358
  *
359
- * assert.ok(stack.isEmpty);
359
+ * assert.isTrue(stack.isEmpty);
360
360
  *
361
- * assert(stack.size === 0);
361
+ * assert.isTrue(stack.size === 0);
362
362
  *
363
363
  * stack.push('first');
364
364
  *
365
365
  * // eslint-disable-next-line unicorn/prefer-single-call
366
366
  * stack.push('second');
367
367
  *
368
- * assert.notOk(stack.isEmpty);
368
+ * assert.isFalse(stack.isEmpty);
369
369
  *
370
- * assert(stack.size === 2);
370
+ * assert.isTrue(stack.size === 2);
371
371
  *
372
372
  * assert.deepStrictEqual(stack.pop(), Optional.some('second'));
373
373
  *
@@ -377,7 +377,7 @@ class StackClass<T> implements Stack<T> {
377
377
  *
378
378
  * const seededStack = createStack([10, 20, 30]);
379
379
  *
380
- * assert(seededStack.size === 3);
380
+ * assert.isTrue(seededStack.size === 3);
381
381
  *
382
382
  * assert.deepStrictEqual(seededStack.pop(), Optional.some(30));
383
383
  * ```
@@ -31,7 +31,7 @@ describe('Stack test', () => {
31
31
  test('should be empty when created without initial values', () => {
32
32
  const stack = createStack<string>();
33
33
 
34
- expect(stack.isEmpty).toBe(true);
34
+ assert.isTrue(stack.isEmpty);
35
35
 
36
36
  expect(stack.size).toBe(0);
37
37
  });
@@ -39,7 +39,7 @@ describe('Stack test', () => {
39
39
  test('should create with initial values', () => {
40
40
  const stack = createStack<number>([1, 2, 3]);
41
41
 
42
- expect(stack.isEmpty).toBe(false);
42
+ assert.isFalse(stack.isEmpty);
43
43
 
44
44
  expect(stack.size).toBe(3);
45
45
 
@@ -50,7 +50,7 @@ describe('Stack test', () => {
50
50
 
51
51
  expect(Optional.unwrap(stack.pop())).toBe(1);
52
52
 
53
- expect(stack.isEmpty).toBe(true);
53
+ assert.isTrue(stack.isEmpty);
54
54
  });
55
55
 
56
56
  test('should implement LIFO behavior correctly', () => {
@@ -66,7 +66,7 @@ describe('Stack test', () => {
66
66
 
67
67
  expect(stack.size).toBe(3);
68
68
 
69
- expect(stack.isEmpty).toBe(false);
69
+ assert.isFalse(stack.isEmpty);
70
70
 
71
71
  // LIFO: Last In, First Out
72
72
  expect(Optional.unwrap(stack.pop())).toBe('third');
@@ -75,7 +75,7 @@ describe('Stack test', () => {
75
75
 
76
76
  expect(Optional.unwrap(stack.pop())).toBe('first');
77
77
 
78
- expect(stack.isEmpty).toBe(true);
78
+ assert.isTrue(stack.isEmpty);
79
79
 
80
80
  expect(stack.size).toBe(0);
81
81
  });
@@ -85,9 +85,9 @@ describe('Stack test', () => {
85
85
 
86
86
  const result = stack.pop();
87
87
 
88
- expect(Optional.isNone(result)).toBe(true);
88
+ assert.isTrue(Optional.isNone(result));
89
89
 
90
- expect(stack.isEmpty).toBe(true);
90
+ assert.isTrue(stack.isEmpty);
91
91
 
92
92
  expect(stack.size).toBe(0);
93
93
  });
@@ -121,7 +121,7 @@ describe('Stack test', () => {
121
121
 
122
122
  expect(stack.size).toBe(0);
123
123
 
124
- expect(stack.isEmpty).toBe(true);
124
+ assert.isTrue(stack.isEmpty);
125
125
  });
126
126
 
127
127
  test('should handle mixed push and pop operations', () => {
@@ -145,7 +145,7 @@ describe('Stack test', () => {
145
145
 
146
146
  expect(Optional.unwrap(stack.pop())).toBe('a');
147
147
 
148
- expect(stack.isEmpty).toBe(true);
148
+ assert.isTrue(stack.isEmpty);
149
149
  });
150
150
 
151
151
  test('should work with object types', () => {
@@ -166,7 +166,7 @@ describe('Stack test', () => {
166
166
 
167
167
  assert.deepStrictEqual(Optional.unwrap(stack.pop()), item1);
168
168
 
169
- expect(stack.isEmpty).toBe(true);
169
+ assert.isTrue(stack.isEmpty);
170
170
  });
171
171
 
172
172
  test('should handle large number of operations efficiently', () => {
@@ -181,18 +181,18 @@ describe('Stack test', () => {
181
181
 
182
182
  expect(stack.size).toBe(n);
183
183
 
184
- expect(stack.isEmpty).toBe(false);
184
+ assert.isFalse(stack.isEmpty);
185
185
 
186
186
  // Pop all elements and verify LIFO order
187
187
  for (const i of range(asSafeInt(n - 1), -1, -1)) {
188
188
  const result = stack.pop();
189
189
 
190
- expect(Optional.isSome(result)).toBe(true);
190
+ assert.isTrue(Optional.isSome(result));
191
191
 
192
192
  expect(Optional.unwrap(result)).toBe(i);
193
193
  }
194
194
 
195
- expect(stack.isEmpty).toBe(true);
195
+ assert.isTrue(stack.isEmpty);
196
196
 
197
197
  expect(stack.size).toBe(0);
198
198
  });
@@ -237,7 +237,7 @@ describe('Stack test', () => {
237
237
 
238
238
  expect(Optional.unwrap(stack.pop())).toBe('value');
239
239
 
240
- expect(stack.isEmpty).toBe(true);
240
+ assert.isTrue(stack.isEmpty);
241
241
  });
242
242
 
243
243
  test('should maintain performance characteristics', () => {
@@ -288,6 +288,6 @@ describe('Stack test', () => {
288
288
  expect(Optional.unwrap(result)).toBe(i);
289
289
  }
290
290
 
291
- expect(stack.isEmpty).toBe(true);
291
+ assert.isTrue(stack.isEmpty);
292
292
  });
293
293
  });
@@ -34,7 +34,7 @@ import { keyIsIn } from '../guard/index.mjs';
34
34
  * published: 'Complete',
35
35
  * });
36
36
  *
37
- * assert(message === 'Work in progress');
37
+ * assert.isTrue(message === 'Work in progress');
38
38
  * ```
39
39
  *
40
40
  * @param target - The value to match against
@@ -11,13 +11,13 @@ import { type Unwrap } from './types.mjs';
11
11
  * ```ts
12
12
  * const optionalValue = Optional.some('data');
13
13
  *
14
- * assert(Optional.expectToBe(optionalValue, 'value expected') === 'data');
14
+ * assert.isTrue(Optional.expectToBe(optionalValue, 'value expected') === 'data');
15
15
  *
16
16
  * const expectValue = Optional.expectToBe<string>('missing optional');
17
17
  *
18
18
  * assert.throws(() => expectValue(Optional.none), /missing optional/u);
19
19
  *
20
- * assert(expectValue(Optional.some('present')) === 'present');
20
+ * assert.isTrue(expectValue(Optional.some('present')) === 'present');
21
21
  * ```
22
22
  *
23
23
  * @template O The `UnknownOptional` type to unwrap.
@@ -11,7 +11,7 @@ import { type NarrowToNone } from './types.mjs';
11
11
  *
12
12
  * if (Optional.isNone(optionalValue)) {
13
13
  * // Type narrowed to None
14
- * assert.ok(true); // optionalValue is None
14
+ * assert.isTrue(true); // optionalValue is None
15
15
  * }
16
16
  * ```
17
17
  *