ts-data-forge 4.0.0 → 5.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 (245) hide show
  1. package/dist/entry-point.mjs +2 -0
  2. package/dist/entry-point.mjs.map +1 -1
  3. package/dist/functional/index.d.mts +1 -0
  4. package/dist/functional/index.d.mts.map +1 -1
  5. package/dist/functional/index.mjs +2 -0
  6. package/dist/functional/index.mjs.map +1 -1
  7. package/dist/functional/ternary-result/impl/index.d.mts +29 -0
  8. package/dist/functional/ternary-result/impl/index.d.mts.map +1 -0
  9. package/dist/functional/ternary-result/impl/index.mjs +28 -0
  10. package/dist/functional/ternary-result/impl/index.mjs.map +1 -0
  11. package/dist/functional/ternary-result/impl/tag.d.mts +7 -0
  12. package/dist/functional/ternary-result/impl/tag.d.mts.map +1 -0
  13. package/dist/functional/ternary-result/impl/tag.mjs +9 -0
  14. package/dist/functional/ternary-result/impl/tag.mjs.map +1 -0
  15. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +14 -0
  16. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -0
  17. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +21 -0
  18. package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -0
  19. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +18 -0
  20. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -0
  21. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs +24 -0
  22. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -0
  23. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +29 -0
  24. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -0
  25. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs +41 -0
  26. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -0
  27. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +27 -0
  28. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +1 -0
  29. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs +36 -0
  30. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -0
  31. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +20 -0
  32. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +1 -0
  33. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +24 -0
  34. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -0
  35. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +17 -0
  36. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +1 -0
  37. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +33 -0
  38. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -0
  39. package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts +20 -0
  40. package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts.map +1 -0
  41. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs +23 -0
  42. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs.map +1 -0
  43. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +21 -0
  44. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +1 -0
  45. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +24 -0
  46. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -0
  47. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +17 -0
  48. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +1 -0
  49. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +28 -0
  50. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -0
  51. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +21 -0
  52. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +1 -0
  53. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +24 -0
  54. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -0
  55. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +23 -0
  56. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +1 -0
  57. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs +26 -0
  58. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -0
  59. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +21 -0
  60. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +1 -0
  61. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs +29 -0
  62. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -0
  63. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +29 -0
  64. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +1 -0
  65. package/dist/functional/ternary-result/impl/ternary-result-map.mjs +35 -0
  66. package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -0
  67. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +16 -0
  68. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -0
  69. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs +23 -0
  70. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -0
  71. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +26 -0
  72. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -0
  73. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs +19 -0
  74. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -0
  75. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +16 -0
  76. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +1 -0
  77. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +25 -0
  78. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -0
  79. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +22 -0
  80. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -0
  81. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs +17 -0
  82. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -0
  83. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +18 -0
  84. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +1 -0
  85. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +36 -0
  86. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -0
  87. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +17 -0
  88. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +1 -0
  89. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +22 -0
  90. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -0
  91. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +22 -0
  92. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -0
  93. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs +17 -0
  94. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -0
  95. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +17 -0
  96. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +1 -0
  97. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs +13 -0
  98. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -0
  99. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +18 -0
  100. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +1 -0
  101. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +36 -0
  102. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -0
  103. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +19 -0
  104. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -0
  105. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs +17 -0
  106. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -0
  107. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +18 -0
  108. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +1 -0
  109. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +32 -0
  110. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -0
  111. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +17 -0
  112. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +1 -0
  113. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +22 -0
  114. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -0
  115. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +18 -0
  116. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -0
  117. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs +26 -0
  118. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -0
  119. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +26 -0
  120. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +1 -0
  121. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +48 -0
  122. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -0
  123. package/dist/functional/ternary-result/impl/types.d.mts +25 -0
  124. package/dist/functional/ternary-result/impl/types.d.mts.map +1 -0
  125. package/dist/functional/ternary-result/impl/types.mjs +2 -0
  126. package/dist/functional/ternary-result/impl/types.mjs.map +1 -0
  127. package/dist/functional/ternary-result/impl/variant-name.d.mts +3 -0
  128. package/dist/functional/ternary-result/impl/variant-name.d.mts.map +1 -0
  129. package/dist/functional/ternary-result/impl/variant-name.mjs +16 -0
  130. package/dist/functional/ternary-result/impl/variant-name.mjs.map +1 -0
  131. package/dist/functional/ternary-result/index.d.mts +2 -0
  132. package/dist/functional/ternary-result/index.d.mts.map +1 -0
  133. package/dist/functional/ternary-result/index.mjs +3 -0
  134. package/dist/functional/ternary-result/index.mjs.map +1 -0
  135. package/dist/globals.d.mts +55 -2
  136. package/dist/json/json.d.mts +9 -3
  137. package/dist/json/json.d.mts.map +1 -1
  138. package/dist/json/json.mjs +6 -0
  139. package/dist/json/json.mjs.map +1 -1
  140. package/package.json +13 -13
  141. package/src/array/impl/array-utils-creation.test.mts +187 -74
  142. package/src/array/impl/array-utils-element-access.test.mts +19 -3
  143. package/src/array/impl/array-utils-iterators.test.mts +44 -24
  144. package/src/array/impl/array-utils-modification.test.mts +36 -33
  145. package/src/array/impl/array-utils-reducing-value.test.mts +47 -16
  146. package/src/array/impl/array-utils-search.test.mts +42 -9
  147. package/src/array/impl/array-utils-set-op.test.mts +54 -26
  148. package/src/array/impl/array-utils-size.test.mts +1 -0
  149. package/src/array/impl/array-utils-slice-clamped.test.mts +20 -11
  150. package/src/array/impl/array-utils-slicing.test.mts +27 -21
  151. package/src/array/impl/array-utils-transformation.test.mts +140 -92
  152. package/src/array/impl/array-utils-validation.test.mts +58 -10
  153. package/src/array/impl/array.test.mts +5 -5
  154. package/src/collections/imap-mapped.test.mts +63 -18
  155. package/src/collections/imap.test.mts +74 -26
  156. package/src/collections/iset-mapped.test.mts +81 -30
  157. package/src/collections/iset.test.mts +168 -68
  158. package/src/collections/queue.test.mts +32 -1
  159. package/src/collections/stack.test.mts +22 -8
  160. package/src/functional/index.mts +1 -0
  161. package/src/functional/match.test.mts +1 -1
  162. package/src/functional/optional.test.mts +61 -4
  163. package/src/functional/pipe.test.mts +10 -1
  164. package/src/functional/result.test.mts +127 -4
  165. package/src/functional/ternary-result/impl/index.mts +28 -0
  166. package/src/functional/ternary-result/impl/tag.mts +11 -0
  167. package/src/functional/ternary-result/impl/ternary-result-err.mts +18 -0
  168. package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +53 -0
  169. package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +95 -0
  170. package/src/functional/ternary-result/impl/ternary-result-fold.mts +93 -0
  171. package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +27 -0
  172. package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +31 -0
  173. package/src/functional/ternary-result/impl/ternary-result-is-err.mts +23 -0
  174. package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +24 -0
  175. package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +27 -0
  176. package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +24 -0
  177. package/src/functional/ternary-result/impl/ternary-result-map-err.mts +64 -0
  178. package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +66 -0
  179. package/src/functional/ternary-result/impl/ternary-result-map.mts +81 -0
  180. package/src/functional/ternary-result/impl/ternary-result-ok.mts +20 -0
  181. package/src/functional/ternary-result/impl/ternary-result-or-else.mts +66 -0
  182. package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +25 -0
  183. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +45 -0
  184. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +40 -0
  185. package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +22 -0
  186. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +45 -0
  187. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +32 -0
  188. package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +45 -0
  189. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +42 -0
  190. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +38 -0
  191. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +22 -0
  192. package/src/functional/ternary-result/impl/ternary-result-warn.mts +23 -0
  193. package/src/functional/ternary-result/impl/ternary-result-zip.mts +53 -0
  194. package/src/functional/ternary-result/impl/types.mts +39 -0
  195. package/src/functional/ternary-result/impl/variant-name.mts +17 -0
  196. package/src/functional/ternary-result/index.mts +1 -0
  197. package/src/functional/ternary-result.test.mts +214 -0
  198. package/src/globals.d.mts +55 -2
  199. package/src/guard/is-non-empty-string.test.mts +5 -2
  200. package/src/guard/is-non-null-object.test.mts +3 -5
  201. package/src/guard/is-primitive.test.mts +5 -3
  202. package/src/guard/is-record.test.mts +1 -1
  203. package/src/guard/is-type.test.mts +35 -20
  204. package/src/guard/key-is-in.test.mts +1 -1
  205. package/src/iterator/range.test.mts +22 -16
  206. package/src/json/json.mts +9 -3
  207. package/src/json/json.test.mts +140 -64
  208. package/src/number/branded-types/finite-number.test.mts +3 -2
  209. package/src/number/branded-types/int.test.mts +4 -3
  210. package/src/number/branded-types/int16.test.mts +9 -3
  211. package/src/number/branded-types/int32.test.mts +9 -3
  212. package/src/number/branded-types/non-negative-finite-number.test.mts +6 -4
  213. package/src/number/branded-types/non-negative-int16.test.mts +8 -3
  214. package/src/number/branded-types/non-negative-int32.test.mts +8 -3
  215. package/src/number/branded-types/non-zero-finite-number.test.mts +6 -3
  216. package/src/number/branded-types/non-zero-int.test.mts +6 -3
  217. package/src/number/branded-types/non-zero-int16.test.mts +9 -3
  218. package/src/number/branded-types/non-zero-int32.test.mts +9 -3
  219. package/src/number/branded-types/non-zero-safe-int.test.mts +10 -3
  220. package/src/number/branded-types/non-zero-uint16.test.mts +8 -3
  221. package/src/number/branded-types/non-zero-uint32.test.mts +8 -3
  222. package/src/number/branded-types/positive-finite-number.test.mts +7 -3
  223. package/src/number/branded-types/positive-int.test.mts +5 -3
  224. package/src/number/branded-types/positive-int16.test.mts +8 -3
  225. package/src/number/branded-types/positive-int32.test.mts +8 -3
  226. package/src/number/branded-types/positive-safe-int.test.mts +8 -3
  227. package/src/number/branded-types/positive-uint16.test.mts +8 -3
  228. package/src/number/branded-types/positive-uint32.test.mts +8 -3
  229. package/src/number/branded-types/safe-int.test.mts +8 -2
  230. package/src/number/branded-types/safe-uint.test.mts +8 -3
  231. package/src/number/branded-types/uint.test.mts +5 -3
  232. package/src/number/branded-types/uint16.test.mts +8 -3
  233. package/src/number/branded-types/uint32.test.mts +8 -3
  234. package/src/number/enum/int8.test.mts +8 -3
  235. package/src/number/enum/uint8.test.mts +6 -3
  236. package/src/number/num.test.mts +16 -2
  237. package/src/object/object.test.mts +26 -13
  238. package/src/others/cast-mutable.test.mts +10 -8
  239. package/src/others/cast-readonly.test.mts +9 -5
  240. package/src/others/if-then.test.mts +4 -1
  241. package/src/others/map-nullable.test.mts +28 -1
  242. package/src/others/memoize-function.test.mts +20 -17
  243. package/src/others/tuple.test.mts +3 -2
  244. package/src/others/unknown-to-string.test.mts +15 -2
  245. package/src/promise/promise.test.mts +6 -1
@@ -21,27 +21,29 @@ import {
21
21
  } from './array-utils-transformation.mjs';
22
22
 
23
23
  describe('Arr transformations', () => {
24
- describe('map', () => {
24
+ describe(map, () => {
25
25
  const mapped = map([1, 2, 3], (x, i): number => x * x * i);
26
26
 
27
27
  expectType<typeof mapped, ArrayOfLength<3, number>>('=');
28
28
 
29
29
  test('case 1', () => {
30
- expect(mapped).toStrictEqual([0, 4, 18]);
30
+ assert.deepStrictEqual(mapped, [0, 4, 18]);
31
31
  });
32
32
 
33
33
  test('should work with empty tuple', () => {
34
34
  const empty = [] as const;
35
35
  const mappedEmpty = map(empty, (x) => String(x));
36
36
  expectType<typeof mappedEmpty, readonly []>('=');
37
- expect(mappedEmpty).toStrictEqual([]);
37
+
38
+ assert.deepStrictEqual(mappedEmpty, []);
38
39
  });
39
40
 
40
41
  test('should preserve tuple length with different types', () => {
41
42
  const mixed = [1, 'hello', true] as const;
42
43
  const mappedMixed = map(mixed, (x) => typeof x);
43
44
  expectType<typeof mappedMixed, readonly [string, string, string]>('<=');
44
- expect(mappedMixed).toStrictEqual(['number', 'string', 'boolean']);
45
+
46
+ assert.deepStrictEqual(mappedMixed, ['number', 'string', 'boolean']);
45
47
  });
46
48
 
47
49
  test('should work with index parameter', () => {
@@ -50,24 +52,27 @@ describe('Arr transformations', () => {
50
52
  expectType<typeof mappedWithIndex, readonly [string, string, string]>(
51
53
  '<=',
52
54
  );
53
- expect(mappedWithIndex).toStrictEqual(['0:a', '1:b', '2:c']);
55
+
56
+ assert.deepStrictEqual(mappedWithIndex, ['0:a', '1:b', '2:c']);
54
57
  });
55
58
  });
56
59
 
57
- describe('scan', () => {
60
+ describe(scan, () => {
58
61
  test('should compute running sum', () => {
59
62
  const numbers = [1, 2, 3, 4];
60
63
  const runningSum = scan(numbers, (acc, curr) => acc + curr, 0);
61
64
 
62
65
  expectType<typeof runningSum, readonly [number, ...number[]]>('<=');
63
- expect(runningSum).toStrictEqual([0, 1, 3, 6, 10]);
66
+
67
+ assert.deepStrictEqual(runningSum, [0, 1, 3, 6, 10]);
64
68
  });
65
69
 
66
70
  test('should include initial value as first element', () => {
67
71
  const numbers = [10, 20, 30];
68
72
  const result = scan(numbers, (acc, curr) => acc + curr, 100);
69
73
 
70
- expect(result).toStrictEqual([100, 110, 130, 160]);
74
+ assert.deepStrictEqual(result, [100, 110, 130, 160]);
75
+
71
76
  expect(result).toHaveLength(4); // original length + 1
72
77
  });
73
78
 
@@ -77,8 +82,8 @@ describe('Arr transformations', () => {
77
82
  const result1 = scanSum([1, 2, 3]);
78
83
  const result2 = scanSum([5, 10]);
79
84
 
80
- expect(result1).toStrictEqual([0, 1, 3, 6]);
81
- expect(result2).toStrictEqual([0, 5, 15]);
85
+ assert.deepStrictEqual(result1, [0, 1, 3, 6]);
86
+ assert.deepStrictEqual(result2, [0, 5, 15]);
82
87
  });
83
88
 
84
89
  test('should provide index to reducer', () => {
@@ -94,14 +99,14 @@ describe('Arr transformations', () => {
94
99
  0,
95
100
  );
96
101
 
97
- expect(mut_indices).toStrictEqual([0, 1, 2]);
102
+ assert.deepStrictEqual(mut_indices, [0, 1, 2]);
98
103
  });
99
104
 
100
105
  test('should work with empty array', () => {
101
106
  const empty: readonly number[] = [];
102
107
  const result = scan(empty, (acc, curr) => acc + curr, 42);
103
108
 
104
- expect(result).toStrictEqual([42]);
109
+ assert.deepStrictEqual(result, [42]);
105
110
  });
106
111
 
107
112
  test('should work with different accumulator and element types', () => {
@@ -109,14 +114,15 @@ describe('Arr transformations', () => {
109
114
  const result = scan(strings, (acc, curr) => acc + curr.length, 0);
110
115
 
111
116
  expectType<typeof result, readonly [number, ...number[]]>('<=');
112
- expect(result).toStrictEqual([0, 1, 2, 3]);
117
+
118
+ assert.deepStrictEqual(result, [0, 1, 2, 3]);
113
119
  });
114
120
 
115
121
  test('should compute running product', () => {
116
122
  const numbers = [2, 3, 4];
117
123
  const runningProduct = scan(numbers, (acc, curr) => acc * curr, 1);
118
124
 
119
- expect(runningProduct).toStrictEqual([1, 2, 6, 24]);
125
+ assert.deepStrictEqual(runningProduct, [1, 2, 6, 24]);
120
126
  });
121
127
 
122
128
  test('should work with objects', () => {
@@ -124,7 +130,7 @@ describe('Arr transformations', () => {
124
130
 
125
131
  const result = scan(items, (acc, curr) => acc + curr.value, 0);
126
132
 
127
- expect(result).toStrictEqual([0, 10, 30, 60]);
133
+ assert.deepStrictEqual(result, [0, 10, 30, 60]);
128
134
  });
129
135
 
130
136
  test('should preserve all intermediate values', () => {
@@ -132,11 +138,11 @@ describe('Arr transformations', () => {
132
138
  const result = scan(numbers, (acc, curr) => acc - curr, 10);
133
139
 
134
140
  // 10 -> 10-1=9 -> 9-2=7 -> 7-3=4
135
- expect(result).toStrictEqual([10, 9, 7, 4]);
141
+ assert.deepStrictEqual(result, [10, 9, 7, 4]);
136
142
  });
137
143
  });
138
144
 
139
- describe('toReversed', () => {
145
+ describe(toReversed, () => {
140
146
  {
141
147
  const xs = [1, 2, 3] as const;
142
148
  const _nativeResult = xs.toReversed();
@@ -148,7 +154,7 @@ describe('Arr transformations', () => {
148
154
  expectType<typeof result, readonly [3, 2, 1]>('=');
149
155
 
150
156
  test('case 1', () => {
151
- expect(result).toStrictEqual([3, 2, 1]);
157
+ assert.deepStrictEqual(result, [3, 2, 1]);
152
158
  });
153
159
  }
154
160
 
@@ -156,25 +162,28 @@ describe('Arr transformations', () => {
156
162
  const empty = [] as const;
157
163
  const reversed = toReversed(empty);
158
164
  expectType<typeof reversed, readonly []>('=');
159
- expect(reversed).toStrictEqual([]);
165
+
166
+ assert.deepStrictEqual(reversed, []);
160
167
  });
161
168
 
162
169
  test('should work with single element', () => {
163
170
  const single = [42] as const;
164
171
  const reversed = toReversed(single);
165
172
  expectType<typeof reversed, readonly [42]>('=');
166
- expect(reversed).toStrictEqual([42]);
173
+
174
+ assert.deepStrictEqual(reversed, [42]);
167
175
  });
168
176
 
169
177
  test('should preserve mixed types in reverse order', () => {
170
178
  const mixed = [1, 'hello', true, null] as const;
171
179
  const reversed = toReversed(mixed);
172
180
  expectType<typeof reversed, readonly [null, true, 'hello', 1]>('=');
173
- expect(reversed).toStrictEqual([null, true, 'hello', 1]);
181
+
182
+ assert.deepStrictEqual(reversed, [null, true, 'hello', 1]);
174
183
  });
175
184
  });
176
185
 
177
- describe('toSorted', () => {
186
+ describe(toSorted, () => {
178
187
  {
179
188
  const xs = [2, 1, 3] as const;
180
189
  const result = toSorted(xs);
@@ -182,7 +191,7 @@ describe('Arr transformations', () => {
182
191
  expectType<typeof result, ArrayOfLength<3, 1 | 2 | 3>>('=');
183
192
 
184
193
  test('case 1', () => {
185
- expect(result).toStrictEqual([1, 2, 3]);
194
+ assert.deepStrictEqual(result, [1, 2, 3]);
186
195
  });
187
196
  }
188
197
  {
@@ -192,7 +201,7 @@ describe('Arr transformations', () => {
192
201
  expectType<typeof result, ArrayOfLength<3, 1 | 2 | 3>>('=');
193
202
 
194
203
  test('case 2', () => {
195
- expect(result).toStrictEqual([1, 2, 3]);
204
+ assert.deepStrictEqual(result, [1, 2, 3]);
196
205
  });
197
206
  }
198
207
  {
@@ -202,12 +211,12 @@ describe('Arr transformations', () => {
202
211
  expectType<typeof result, ArrayOfLength<3, 1 | 2 | 3>>('=');
203
212
 
204
213
  test('case 3', () => {
205
- expect(result).toStrictEqual([3, 2, 1]);
214
+ assert.deepStrictEqual(result, [3, 2, 1]);
206
215
  });
207
216
  }
208
217
  });
209
218
 
210
- describe('toSortedBy', () => {
219
+ describe(toSortedBy, () => {
211
220
  {
212
221
  const xs = [{ v: 2 }, { v: 1 }, { v: 3 }] as const;
213
222
  const sorted = toSortedBy(xs, (x) => x.v);
@@ -218,7 +227,7 @@ describe('Arr transformations', () => {
218
227
  >('=');
219
228
 
220
229
  test('case 1', () => {
221
- expect(sorted).toStrictEqual([{ v: 1 }, { v: 2 }, { v: 3 }]);
230
+ assert.deepStrictEqual(sorted, [{ v: 1 }, { v: 2 }, { v: 3 }]);
222
231
  });
223
232
  }
224
233
  {
@@ -235,7 +244,7 @@ describe('Arr transformations', () => {
235
244
  >('=');
236
245
 
237
246
  test('case 2', () => {
238
- expect(sorted).toStrictEqual([{ v: 1 }, { v: 2 }, { v: 3 }]);
247
+ assert.deepStrictEqual(sorted, [{ v: 1 }, { v: 2 }, { v: 3 }]);
239
248
  });
240
249
  }
241
250
 
@@ -260,33 +269,38 @@ describe('Arr transformations', () => {
260
269
  (word: string) => word,
261
270
  (a: string, b: string) => a.localeCompare(b),
262
271
  );
263
- expect(result).toStrictEqual(['apple', 'banana', 'cherry']);
272
+
273
+ assert.deepStrictEqual(result, ['apple', 'banana', 'cherry']);
264
274
  });
265
275
 
266
276
  test('should work with custom key extraction', () => {
267
277
  const items = ['hello', 'hi', 'welcome', 'bye'];
268
278
  const result = toSortedBy(items, (item) => item.length);
269
- expect(result).toStrictEqual(['hi', 'bye', 'hello', 'welcome']);
279
+
280
+ assert.deepStrictEqual(result, ['hi', 'bye', 'hello', 'welcome']);
270
281
  });
271
282
 
272
283
  test('should work with empty array', () => {
273
284
  const empty: readonly { value: number }[] = [];
274
285
  const result = toSortedBy(empty, (item) => item.value);
275
- expect(result).toStrictEqual([]);
286
+
287
+ assert.deepStrictEqual(result, []);
276
288
  });
277
289
 
278
290
  test('toSortedBy should work with empty array', () => {
279
291
  const empty: readonly { value: number }[] = [];
280
292
  const result = toSortedBy(empty, (item) => item.value);
281
- expect(result).toStrictEqual([]);
293
+
294
+ assert.deepStrictEqual(result, []);
282
295
  });
283
296
  });
284
297
 
285
- describe('filter', () => {
298
+ describe(filter, () => {
286
299
  test('should filter array with predicate', () => {
287
300
  const numbers = [1, 2, 3, 4, 5];
288
301
  const evens = filter(numbers, (n) => n % 2 === 0);
289
- expect(evens).toStrictEqual([2, 4]);
302
+
303
+ assert.deepStrictEqual(evens, [2, 4]);
290
304
  });
291
305
 
292
306
  test('should work with type guards', () => {
@@ -299,14 +313,16 @@ describe('Arr transformations', () => {
299
313
  ];
300
314
  const strings = filter(mixed, (x): x is string => typeof x === 'string');
301
315
  expectType<typeof strings, readonly string[]>('=');
302
- expect(strings).toStrictEqual(['hello', 'world']);
316
+
317
+ assert.deepStrictEqual(strings, ['hello', 'world']);
303
318
  });
304
319
 
305
320
  test('should work with curried version', () => {
306
321
  const isPositive = (n: number): boolean => n > 0;
307
322
  const filterPositive = filter(isPositive);
308
323
  const result = filterPositive([-1, 2, -3, 4]);
309
- expect(result).toStrictEqual([2, 4]);
324
+
325
+ assert.deepStrictEqual(result, [2, 4]);
310
326
  });
311
327
 
312
328
  test('should work with curried type guards', () => {
@@ -314,67 +330,75 @@ describe('Arr transformations', () => {
314
330
  const filterStrings = filter(isString);
315
331
  const result = filterStrings(['a', 1, 'b', 2]);
316
332
  expectType<typeof result, readonly string[]>('=');
317
- expect(result).toStrictEqual(['a', 'b']);
333
+
334
+ assert.deepStrictEqual(result, ['a', 'b']);
318
335
  });
319
336
 
320
337
  test('should preserve array type with generic predicate', () => {
321
338
  const tuple = [1, 2, 3] as const;
322
339
  const filtered = filter(tuple, (x) => x > 1);
323
340
  expectType<typeof filtered, readonly (1 | 2 | 3)[]>('=');
324
- expect(filtered).toStrictEqual([2, 3]);
341
+
342
+ assert.deepStrictEqual(filtered, [2, 3]);
325
343
  });
326
344
 
327
345
  test('should work with empty array', () => {
328
346
  const empty: number[] = [];
329
347
  const result = filter(empty, (n) => n > 0);
330
- expect(result).toStrictEqual([]);
348
+
349
+ assert.deepStrictEqual(result, []);
331
350
  });
332
351
 
333
352
  test('should pass index to predicate', () => {
334
353
  const numbers = [10, 20, 30, 40];
335
354
  const evenIndexes = filter(numbers, (_, i) => i % 2 === 0);
336
- expect(evenIndexes).toStrictEqual([10, 30]);
355
+
356
+ assert.deepStrictEqual(evenIndexes, [10, 30]);
337
357
  });
338
358
  });
339
359
 
340
- describe('filterNot', () => {
360
+ describe(filterNot, () => {
341
361
  const xs = [1, 2, 3] as const;
342
362
  const filtered = filterNot(xs, (x) => x % 2 === 0);
343
363
 
344
364
  expectType<typeof filtered, readonly (1 | 2 | 3)[]>('=');
345
365
 
346
366
  test('case 1', () => {
347
- expect(filtered).toStrictEqual([1, 3]);
367
+ assert.deepStrictEqual(filtered, [1, 3]);
348
368
  });
349
369
  });
350
370
 
351
- describe('uniq', () => {
371
+ describe(uniq, () => {
352
372
  test('should remove duplicate primitives', () => {
353
373
  const array = [1, 2, 2, 3, 1, 4, 3];
354
374
  const result = uniq(array);
355
- expect(result).toStrictEqual([1, 2, 3, 4]);
375
+
376
+ assert.deepStrictEqual(result, [1, 2, 3, 4]);
356
377
  });
357
378
 
358
379
  test('should work with strings', () => {
359
380
  const array = ['a', 'b', 'a', 'c', 'b'];
360
381
  const result = uniq(array);
361
- expect(result).toStrictEqual(['a', 'b', 'c']);
382
+
383
+ assert.deepStrictEqual(result, ['a', 'b', 'c']);
362
384
  });
363
385
 
364
386
  test('should work with empty array', () => {
365
387
  const array: readonly number[] = [];
366
388
  const result = uniq(array);
367
- expect(result).toStrictEqual([]);
389
+
390
+ assert.deepStrictEqual(result, []);
368
391
  });
369
392
 
370
393
  test('should preserve order of first occurrence', () => {
371
394
  const array = [3, 1, 2, 1, 3, 2];
372
395
  const result = uniq(array);
373
- expect(result).toStrictEqual([3, 1, 2]);
396
+
397
+ assert.deepStrictEqual(result, [3, 1, 2]);
374
398
  });
375
399
  });
376
400
 
377
- describe('uniqBy', () => {
401
+ describe(uniqBy, () => {
378
402
  test('should remove duplicates based on key function', () => {
379
403
  const array = [
380
404
  { id: 1, name: 'Alice' },
@@ -385,9 +409,10 @@ describe('Arr transformations', () => {
385
409
  const result = uniqBy(array, (item) => item.id);
386
410
 
387
411
  expect(result).toHaveLength(3);
388
- expect(result[0]).toStrictEqual({ id: 1, name: 'Alice' });
389
- expect(result[1]).toStrictEqual({ id: 2, name: 'Bob' });
390
- expect(result[2]).toStrictEqual({ id: 3, name: 'Charlie' });
412
+
413
+ assert.deepStrictEqual(result[0], { id: 1, name: 'Alice' });
414
+ assert.deepStrictEqual(result[1], { id: 2, name: 'Bob' });
415
+ assert.deepStrictEqual(result[2], { id: 3, name: 'Charlie' });
391
416
  });
392
417
 
393
418
  test('should work with string key function', () => {
@@ -403,11 +428,12 @@ describe('Arr transformations', () => {
403
428
  test('should work with empty array', () => {
404
429
  const empty: readonly { id: number }[] = [];
405
430
  const result = uniqBy(empty, (item) => item.id);
406
- expect(result).toStrictEqual([]);
431
+
432
+ assert.deepStrictEqual(result, []);
407
433
  });
408
434
  });
409
435
 
410
- describe('flat', () => {
436
+ describe(flat, () => {
411
437
  test('should flatten nested arrays with default depth 1', () => {
412
438
  const nested = [
413
439
  [1, 2],
@@ -415,15 +441,17 @@ describe('Arr transformations', () => {
415
441
  [5, 6],
416
442
  ];
417
443
  const flattened = flat(nested);
418
- expect(flattened).toStrictEqual([1, 2, 3, 4, 5, 6]);
444
+
445
+ assert.deepStrictEqual(flattened, [1, 2, 3, 4, 5, 6]);
419
446
  });
420
447
 
421
448
  test('should flatten with specified depth', () => {
422
449
  const deepNested = [1, [2, [3, 4]], 5];
423
450
  const flat1 = flat(deepNested, 1);
424
451
  const flat2 = flat(deepNested, 2);
425
- expect(flat1).toStrictEqual([1, 2, [3, 4], 5]);
426
- expect(flat2).toStrictEqual([1, 2, 3, 4, 5]);
452
+
453
+ assert.deepStrictEqual(flat1, [1, 2, [3, 4], 5]);
454
+ assert.deepStrictEqual(flat2, [1, 2, 3, 4, 5]);
427
455
  });
428
456
 
429
457
  test('should work with curried version', () => {
@@ -432,13 +460,15 @@ describe('Arr transformations', () => {
432
460
  [1, 2],
433
461
  [3, 4],
434
462
  ]);
435
- expect(result).toStrictEqual([1, 2, 3, 4]);
463
+
464
+ assert.deepStrictEqual(result, [1, 2, 3, 4]);
436
465
  });
437
466
 
438
467
  test('should work with empty arrays', () => {
439
468
  const withEmpties = [[1], [], [2, 3]];
440
469
  const flattened = flat(withEmpties);
441
- expect(flattened).toStrictEqual([1, 2, 3]);
470
+
471
+ assert.deepStrictEqual(flattened, [1, 2, 3]);
442
472
  });
443
473
 
444
474
  test('should work with depth 0', () => {
@@ -447,7 +477,8 @@ describe('Arr transformations', () => {
447
477
  [3, 4],
448
478
  ];
449
479
  const unflattened = flat(nested, 0);
450
- expect(unflattened).toStrictEqual([
480
+
481
+ assert.deepStrictEqual(unflattened, [
451
482
  [1, 2],
452
483
  [3, 4],
453
484
  ]);
@@ -456,15 +487,17 @@ describe('Arr transformations', () => {
456
487
  test('should work with infinite depth', () => {
457
488
  const veryDeep = [1, [2, [3, [4, [5]]]]];
458
489
  const allFlat = flat(veryDeep, SafeUint.MAX_VALUE);
459
- expect(allFlat).toStrictEqual([1, 2, 3, 4, 5]);
490
+
491
+ assert.deepStrictEqual(allFlat, [1, 2, 3, 4, 5]);
460
492
  });
461
493
  });
462
494
 
463
- describe('flatMap', () => {
495
+ describe(flatMap, () => {
464
496
  test('should map and flatten results', () => {
465
497
  const words = ['hello', 'world'];
466
498
  const chars = flatMap(words, (word) => word.split(''));
467
- expect(chars).toStrictEqual([
499
+
500
+ assert.deepStrictEqual(chars, [
468
501
  'h',
469
502
  'e',
470
503
  'l',
@@ -481,41 +514,47 @@ describe('Arr transformations', () => {
481
514
  test('should work with curried version', () => {
482
515
  const splitWords = flatMap((word: string) => word.split(''));
483
516
  const result = splitWords(['foo', 'bar']);
484
- expect(result).toStrictEqual(['f', 'o', 'o', 'b', 'a', 'r']);
517
+
518
+ assert.deepStrictEqual(result, ['f', 'o', 'o', 'b', 'a', 'r']);
485
519
  });
486
520
 
487
521
  test('should work with numbers', () => {
488
522
  const numbers = [1, 2, 3];
489
523
  const doubled = flatMap(numbers, (n) => [n, n * 2]);
490
- expect(doubled).toStrictEqual([1, 2, 2, 4, 3, 6]);
524
+
525
+ assert.deepStrictEqual(doubled, [1, 2, 2, 4, 3, 6]);
491
526
  });
492
527
 
493
528
  test('should pass index to mapping function', () => {
494
529
  const numbers = [10, 20];
495
530
  const result = flatMap(numbers, (n, i) => [n, i]);
496
- expect(result).toStrictEqual([10, 0, 20, 1]);
531
+
532
+ assert.deepStrictEqual(result, [10, 0, 20, 1]);
497
533
  });
498
534
 
499
535
  test('should work with empty arrays', () => {
500
536
  const empty: string[] = [];
501
537
  const result = flatMap(empty, (s) => s.split(''));
502
- expect(result).toStrictEqual([]);
538
+
539
+ assert.deepStrictEqual(result, []);
503
540
  });
504
541
 
505
542
  test('should handle mapping to empty arrays', () => {
506
543
  const numbers = [1, 2, 3];
507
544
  const result = flatMap(numbers, (n) => (n % 2 === 0 ? [n] : []));
508
- expect(result).toStrictEqual([2]);
545
+
546
+ assert.deepStrictEqual(result, [2]);
509
547
  });
510
548
 
511
549
  test('should work with tuples', () => {
512
550
  const tuple = [1, 2] as const;
513
551
  const result = flatMap(tuple, (n) => [n, n]);
514
- expect(result).toStrictEqual([1, 1, 2, 2]);
552
+
553
+ assert.deepStrictEqual(result, [1, 1, 2, 2]);
515
554
  });
516
555
  });
517
556
 
518
- describe('partition', () => {
557
+ describe(partition, () => {
519
558
  const xs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] as const;
520
559
 
521
560
  {
@@ -540,7 +579,7 @@ describe('Arr transformations', () => {
540
579
  >('=');
541
580
 
542
581
  test('case 1', () => {
543
- expect(result).toStrictEqual([
582
+ assert.deepStrictEqual(result, [
544
583
  [1, 2, 3, 4],
545
584
  [5, 6, 7, 8],
546
585
  [9, 10, 11, 12],
@@ -570,7 +609,7 @@ describe('Arr transformations', () => {
570
609
  >('=');
571
610
 
572
611
  test('case 2', () => {
573
- expect(result).toStrictEqual([
612
+ assert.deepStrictEqual(result, [
574
613
  [1, 2, 3],
575
614
  [4, 5, 6],
576
615
  [7, 8, 9],
@@ -601,7 +640,7 @@ describe('Arr transformations', () => {
601
640
  >('=');
602
641
 
603
642
  test('case 3', () => {
604
- expect(result).toStrictEqual([
643
+ assert.deepStrictEqual(result, [
605
644
  [1, 2, 3, 4, 5],
606
645
  [6, 7, 8, 9, 10],
607
646
  [11, 12],
@@ -613,7 +652,7 @@ describe('Arr transformations', () => {
613
652
  const numbers = [1, 2, 3, 4, 5, 6];
614
653
  const result = partition(numbers, 2);
615
654
 
616
- expect(result).toStrictEqual([
655
+ assert.deepStrictEqual(result, [
617
656
  [1, 2],
618
657
  [3, 4],
619
658
  [5, 6],
@@ -624,7 +663,7 @@ describe('Arr transformations', () => {
624
663
  const numbers = [1, 2, 3, 4, 5];
625
664
  const result = partition(numbers, 2);
626
665
 
627
- expect(result).toStrictEqual([[1, 2], [3, 4], [5]]);
666
+ assert.deepStrictEqual(result, [[1, 2], [3, 4], [5]]);
628
667
  });
629
668
 
630
669
  test('should work with chunk size < 2 (returns empty)', () => {
@@ -632,25 +671,25 @@ describe('Arr transformations', () => {
632
671
  const result = partition(numbers, 1);
633
672
 
634
673
  // According to docs, returns empty array if chunkSize < 2
635
- expect(result).toStrictEqual([]);
674
+ assert.deepStrictEqual(result, []);
636
675
  });
637
676
 
638
677
  test('should work with chunk size larger than array', () => {
639
678
  const numbers = [1, 2];
640
679
  const result = partition(numbers, 5);
641
680
 
642
- expect(result).toStrictEqual([[1, 2]]);
681
+ assert.deepStrictEqual(result, [[1, 2]]);
643
682
  });
644
683
 
645
684
  test('partition should work with empty array', () => {
646
685
  const empty: readonly number[] = [];
647
686
  const result = partition(empty, 2);
648
687
 
649
- expect(result).toStrictEqual([]);
688
+ assert.deepStrictEqual(result, []);
650
689
  });
651
690
  });
652
691
 
653
- describe('concat', () => {
692
+ describe(concat, () => {
654
693
  const xs = [1, 2, 3] as const;
655
694
  const ys = [4, 5] as const;
656
695
  const result = concat(xs, ys);
@@ -658,7 +697,7 @@ describe('Arr transformations', () => {
658
697
  expectType<typeof result, readonly [1, 2, 3, 4, 5]>('=');
659
698
 
660
699
  test('case 1', () => {
661
- expect(result).toStrictEqual([1, 2, 3, 4, 5]);
700
+ assert.deepStrictEqual(result, [1, 2, 3, 4, 5]);
662
701
  });
663
702
 
664
703
  // testArrayEquality({
@@ -692,7 +731,7 @@ describe('Arr transformations', () => {
692
731
  // });
693
732
  });
694
733
 
695
- describe('groupBy', () => {
734
+ describe(groupBy, () => {
696
735
  const xs = [
697
736
  { x: 1, y: 1 },
698
737
  { x: 2, y: 1 },
@@ -720,7 +759,8 @@ describe('Arr transformations', () => {
720
759
  >('=');
721
760
 
722
761
  test('case 1', () => {
723
- expect(result).toStrictEqual(
762
+ assert.deepStrictEqual(
763
+ result,
724
764
  IMap.create<
725
765
  1 | 2 | 3,
726
766
  readonly (
@@ -761,6 +801,7 @@ describe('Arr transformations', () => {
761
801
  const grouped = groupBy(array, (item) => item.type);
762
802
 
763
803
  expect(grouped.size).toBe(2);
804
+
764
805
  const fruits = grouped.get('fruit');
765
806
  const vegetables = grouped.get('vegetable');
766
807
 
@@ -784,21 +825,23 @@ describe('Arr transformations', () => {
784
825
  const grouped = groupBy(numbers, (n) => n % 2);
785
826
 
786
827
  expect(grouped.size).toBe(2);
828
+
787
829
  const evens = grouped.get(0);
788
830
  const odds = grouped.get(1);
789
831
 
790
832
  if (Optional.isSome(evens)) {
791
- expect(evens.value).toStrictEqual([2, 4, 6]);
833
+ assert.deepStrictEqual(evens.value, [2, 4, 6]);
792
834
  }
793
835
 
794
836
  if (Optional.isSome(odds)) {
795
- expect(odds.value).toStrictEqual([1, 3, 5]);
837
+ assert.deepStrictEqual(odds.value, [1, 3, 5]);
796
838
  }
797
839
  });
798
840
 
799
841
  test('should work with empty array', () => {
800
842
  const empty: readonly number[] = [];
801
843
  const grouped = groupBy(empty, (n) => n % 2);
844
+
802
845
  expect(grouped.size).toBe(0);
803
846
  });
804
847
 
@@ -807,15 +850,16 @@ describe('Arr transformations', () => {
807
850
  const grouped = groupBy(array, () => 'all');
808
851
 
809
852
  expect(grouped.size).toBe(1);
853
+
810
854
  const all = grouped.get('all');
811
855
 
812
856
  if (Optional.isSome(all)) {
813
- expect(all.value).toStrictEqual([1, 2, 3, 4]);
857
+ assert.deepStrictEqual(all.value, [1, 2, 3, 4]);
814
858
  }
815
859
  });
816
860
  });
817
861
 
818
- describe('zip', () => {
862
+ describe(zip, () => {
819
863
  {
820
864
  const xs = [1, 2, 3] as const;
821
865
  const ys = [4, 5, 6] as const;
@@ -827,7 +871,7 @@ describe('Arr transformations', () => {
827
871
  >('=');
828
872
 
829
873
  test('case 1', () => {
830
- expect(zipped).toStrictEqual([
874
+ assert.deepStrictEqual(zipped, [
831
875
  [1, 4],
832
876
  [2, 5],
833
877
  [3, 6],
@@ -842,7 +886,7 @@ describe('Arr transformations', () => {
842
886
  expectType<typeof zipped, readonly (readonly [number, number])[]>('=');
843
887
 
844
888
  test('case 2', () => {
845
- expect(zipped).toStrictEqual([[1, 4]]);
889
+ assert.deepStrictEqual(zipped, [[1, 4]]);
846
890
  });
847
891
  }
848
892
  {
@@ -853,7 +897,7 @@ describe('Arr transformations', () => {
853
897
  expectType<typeof zipped, readonly [readonly [1, number]]>('=');
854
898
 
855
899
  test('case 3', () => {
856
- expect(zipped).toStrictEqual([[1, 4]]);
900
+ assert.deepStrictEqual(zipped, [[1, 4]]);
857
901
  });
858
902
  }
859
903
 
@@ -901,7 +945,8 @@ describe('Arr transformations', () => {
901
945
  const arr1 = [1, 2, 3];
902
946
  const arr2 = ['a', 'b', 'c'];
903
947
  const result = zip(arr1, arr2);
904
- expect(result).toStrictEqual([
948
+
949
+ assert.deepStrictEqual(result, [
905
950
  [1, 'a'],
906
951
  [2, 'b'],
907
952
  [3, 'c'],
@@ -912,7 +957,8 @@ describe('Arr transformations', () => {
912
957
  const arr1 = [1, 2, 3, 4];
913
958
  const arr2 = ['a', 'b'];
914
959
  const result = zip(arr1, arr2);
915
- expect(result).toStrictEqual([
960
+
961
+ assert.deepStrictEqual(result, [
916
962
  [1, 'a'],
917
963
  [2, 'b'],
918
964
  ]);
@@ -922,14 +968,16 @@ describe('Arr transformations', () => {
922
968
  const arr1: readonly number[] = [];
923
969
  const arr2: readonly string[] = [];
924
970
  const result = zip(arr1, arr2);
925
- expect(result).toStrictEqual([]);
971
+
972
+ assert.deepStrictEqual(result, []);
926
973
  });
927
974
 
928
975
  test('should handle one empty array', () => {
929
976
  const arr1 = [1, 2, 3];
930
977
  const arr2: readonly string[] = [];
931
978
  const result = zip(arr1, arr2);
932
- expect(result).toStrictEqual([]);
979
+
980
+ assert.deepStrictEqual(result, []);
933
981
  });
934
982
  });
935
983
  });