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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-data-forge",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript",
@@ -39,6 +39,8 @@
39
39
  "build:min": "tsx ./scripts/cmd/build.mts --skip-check",
40
40
  "check-all": "tsx ./scripts/cmd/check-all.mts",
41
41
  "check:ext": "tsx ./scripts/cmd/check-ext.mts",
42
+ "clean": "pnpm run /clean:.*/",
43
+ "clean:logs": "npx rimraf ./*.log",
42
44
  "cspell": "cspell \"**\" --gitignore --gitignore-root ./ --no-progress",
43
45
  "doc": "tsx ./scripts/cmd/gen-docs.mts",
44
46
  "doc:embed-doc": "tsx ./scripts/cmd/embed-samples.mts",
@@ -72,6 +74,7 @@
72
74
  "z:vitest": "vitest --config ./configs/vitest.config.ts"
73
75
  },
74
76
  "dependencies": {
77
+ "@sindresorhus/is": "^7.1.1",
75
78
  "ts-type-forge": "^2.3.0"
76
79
  },
77
80
  "devDependencies": {
@@ -88,34 +91,33 @@
88
91
  "@semantic-release/github": "^12.0.2",
89
92
  "@semantic-release/npm": "^13.1.2",
90
93
  "@semantic-release/release-notes-generator": "^14.1.0",
91
- "@sindresorhus/is": "^7.1.1",
92
94
  "@types/node": "^24.10.1",
93
- "@types/react": "^19.2.5",
94
- "@vitest/coverage-v8": "^4.0.9",
95
- "@vitest/ui": "^4.0.9",
95
+ "@types/react": "^19.2.7",
96
+ "@vitest/coverage-v8": "^4.0.14",
97
+ "@vitest/ui": "^4.0.14",
96
98
  "conventional-changelog-conventionalcommits": "^9.1.0",
97
99
  "cspell": "^9.3.2",
98
100
  "eslint": "9.39.1",
99
- "eslint-config-typed": "^3.13.3",
101
+ "eslint-config-typed": "^4.0.1",
100
102
  "github-settings-as-code": "^1.0.6",
101
- "immer": "^10.2.0",
103
+ "immer": "^11.0.0",
102
104
  "jiti": "^2.6.1",
103
105
  "markdownlint": "^0.39.0",
104
- "markdownlint-cli2": "^0.19.0",
106
+ "markdownlint-cli2": "^0.19.1",
105
107
  "npm-run-all2": "^8.0.4",
106
- "prettier": "^3.6.2",
108
+ "prettier": "^3.7.1",
107
109
  "prettier-plugin-organize-imports": "^4.3.0",
108
110
  "prettier-plugin-packagejson": "^2.5.19",
109
- "rollup": "^4.53.2",
111
+ "rollup": "^4.53.3",
110
112
  "semantic-release": "^25.0.2",
111
- "ts-repo-utils": "^7.8.2",
113
+ "ts-repo-utils": "^7.9.3",
112
114
  "tslib": "^2.8.1",
113
115
  "tsx": "^4.20.6",
114
116
  "typedoc": "^0.28.14",
115
117
  "typedoc-github-theme": "^0.3.1",
116
118
  "typescript": "^5.9.3",
117
- "vite": "^7.2.2",
118
- "vitest": "^4.0.9"
119
+ "vite": "^7.2.4",
120
+ "vitest": "^4.0.14"
119
121
  },
120
122
  "peerDependencies": {
121
123
  "typescript": ">=4.8"
@@ -59,7 +59,7 @@ describe('Arr creations', () => {
59
59
  expect(result).toHaveLength(1000);
60
60
 
61
61
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
62
- expect(result.every((x) => x === 0)).toBe(true);
62
+ assert.isTrue(result.every((x) => x === 0));
63
63
  });
64
64
 
65
65
  test('should work with curried version', () => {
@@ -10,7 +10,7 @@ describe('Arr element access', () => {
10
10
 
11
11
  const result = at(array, asUint32(1000));
12
12
 
13
- expect(Optional.isNone(result)).toBe(true);
13
+ assert.isTrue(Optional.isNone(result));
14
14
  });
15
15
 
16
16
  test('should handle very large negative indices', () => {
@@ -18,7 +18,7 @@ describe('Arr element access', () => {
18
18
 
19
19
  const result = at(array, asInt32(-1000));
20
20
 
21
- expect(Optional.isNone(result)).toBe(true);
21
+ assert.isTrue(Optional.isNone(result));
22
22
  });
23
23
 
24
24
  test('should work with valid indices', () => {
@@ -26,7 +26,7 @@ describe('Arr element access', () => {
26
26
 
27
27
  const result = at(array, 1);
28
28
 
29
- expect(Optional.isSome(result)).toBe(true);
29
+ assert.isTrue(Optional.isSome(result));
30
30
 
31
31
  if (Optional.isSome(result)) {
32
32
  expect(result.value).toBe(20);
@@ -38,7 +38,7 @@ describe('Arr element access', () => {
38
38
 
39
39
  const result = atIndex2([10, 20, 30, 40]);
40
40
 
41
- expect(Optional.isSome(result)).toBe(true);
41
+ assert.isTrue(Optional.isSome(result));
42
42
 
43
43
  if (Optional.isSome(result)) {
44
44
  expect(result.value).toBe(30);
@@ -54,7 +54,7 @@ describe('Arr element access', () => {
54
54
 
55
55
  expectType<typeof h, Some<1>>('=');
56
56
 
57
- expect(Optional.isSome(h)).toBe(true);
57
+ assert.isTrue(Optional.isSome(h));
58
58
 
59
59
  if (Optional.isSome(h)) {
60
60
  expect(h.value).toBe(1);
@@ -68,7 +68,7 @@ describe('Arr element access', () => {
68
68
 
69
69
  expectType<typeof h, Some<number>>('=');
70
70
 
71
- expect(Optional.isSome(h)).toBe(true);
71
+ assert.isTrue(Optional.isSome(h));
72
72
 
73
73
  if (Optional.isSome(h)) {
74
74
  expect(h.value).toBe(1);
@@ -82,7 +82,7 @@ describe('Arr element access', () => {
82
82
 
83
83
  expectType<typeof h, Optional<number>>('=');
84
84
 
85
- expect(Optional.isSome(h)).toBe(true);
85
+ assert.isTrue(Optional.isSome(h));
86
86
 
87
87
  if (Optional.isSome(h)) {
88
88
  expect(h.value).toBe(1);
@@ -96,19 +96,19 @@ describe('Arr element access', () => {
96
96
 
97
97
  expectType<typeof h, None>('=');
98
98
 
99
- expect(Optional.isNone(h)).toBe(true);
99
+ assert.isTrue(Optional.isNone(h));
100
100
  });
101
101
 
102
102
  test('should return none for empty array', () => {
103
103
  const result = head([]);
104
104
 
105
- expect(Optional.isNone(result)).toBe(true);
105
+ assert.isTrue(Optional.isNone(result));
106
106
  });
107
107
 
108
108
  test('should work with single element array', () => {
109
109
  const result = head([42]);
110
110
 
111
- expect(Optional.isSome(result)).toBe(true);
111
+ assert.isTrue(Optional.isSome(result));
112
112
 
113
113
  if (Optional.isSome(result)) {
114
114
  expect(result.value).toBe(42);
@@ -124,7 +124,7 @@ describe('Arr element access', () => {
124
124
 
125
125
  expectType<typeof l, Some<3>>('=');
126
126
 
127
- expect(Optional.isSome(l)).toBe(true);
127
+ assert.isTrue(Optional.isSome(l));
128
128
 
129
129
  if (Optional.isSome(l)) {
130
130
  expect(l.value).toBe(3);
@@ -138,7 +138,7 @@ describe('Arr element access', () => {
138
138
 
139
139
  expectType<typeof l, Some<number>>('=');
140
140
 
141
- expect(Optional.isSome(l)).toBe(true);
141
+ assert.isTrue(Optional.isSome(l));
142
142
 
143
143
  if (Optional.isSome(l)) {
144
144
  expect(l.value).toBe(3);
@@ -152,7 +152,7 @@ describe('Arr element access', () => {
152
152
 
153
153
  expectType<typeof l, Optional<number>>('=');
154
154
 
155
- expect(Optional.isSome(l)).toBe(true);
155
+ assert.isTrue(Optional.isSome(l));
156
156
 
157
157
  if (Optional.isSome(l)) {
158
158
  expect(l.value).toBe(3);
@@ -166,19 +166,19 @@ describe('Arr element access', () => {
166
166
 
167
167
  expectType<typeof l, None>('=');
168
168
 
169
- expect(Optional.isNone(l)).toBe(true);
169
+ assert.isTrue(Optional.isNone(l));
170
170
  });
171
171
 
172
172
  test('should return none for empty array', () => {
173
173
  const result = last([]);
174
174
 
175
- expect(Optional.isNone(result)).toBe(true);
175
+ assert.isTrue(Optional.isNone(result));
176
176
  });
177
177
 
178
178
  test('should work with single element array', () => {
179
179
  const result = last([42]);
180
180
 
181
- expect(Optional.isSome(result)).toBe(true);
181
+ assert.isTrue(Optional.isSome(result));
182
182
 
183
183
  if (Optional.isSome(result)) {
184
184
  expect(result.value).toBe(42);
@@ -20,10 +20,13 @@ export function set<const Ar extends readonly unknown[], const V = Ar[number]>(
20
20
  index: ArgArrayIndex<Ar>,
21
21
  newValue: V,
22
22
  ): IsFixedLengthList<Ar> extends true
23
- ? Readonly<{ [K in keyof Ar]: Ar[K] | V }>
23
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
24
+ Readonly<{ [K in keyof Ar]: Ar[K] | V }>
24
25
  : Ar extends NonEmptyArray<unknown>
25
- ? NonEmptyArray<Ar[number] | V>
26
- : readonly (Ar[number] | V)[];
26
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
27
+ NonEmptyArray<Ar[number] | V>
28
+ : // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
29
+ readonly (Ar[number] | V)[];
27
30
 
28
31
  // curried version
29
32
  export function set<const V>(
@@ -32,10 +35,13 @@ export function set<const V>(
32
35
  ): <const Ar extends readonly unknown[]>(
33
36
  array: Ar,
34
37
  ) => IsFixedLengthList<Ar> extends true
35
- ? Readonly<{ [K in keyof Ar]: Ar[K] | V }>
38
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
39
+ Readonly<{ [K in keyof Ar]: Ar[K] | V }>
36
40
  : Ar extends NonEmptyArray<unknown>
37
- ? NonEmptyArray<Ar[number] | V>
38
- : readonly (Ar[number] | V)[];
41
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
42
+ NonEmptyArray<Ar[number] | V>
43
+ : // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
44
+ readonly (Ar[number] | V)[];
39
45
 
40
46
  export function set<E, const V = E>(
41
47
  ...args:
@@ -86,10 +92,13 @@ export function toUpdated<
86
92
  index: ArgArrayIndex<Ar>,
87
93
  updater: (prev: Ar[number]) => V,
88
94
  ): IsFixedLengthList<Ar> extends true
89
- ? Readonly<{ [K in keyof Ar]: Ar[K] | V }>
95
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
96
+ Readonly<{ [K in keyof Ar]: Ar[K] | V }>
90
97
  : Ar extends NonEmptyArray<unknown>
91
- ? NonEmptyArray<Ar[number] | V>
92
- : readonly (Ar[number] | V)[];
98
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
99
+ NonEmptyArray<Ar[number] | V>
100
+ : // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
101
+ readonly (Ar[number] | V)[];
93
102
 
94
103
  // curried version
95
104
  export function toUpdated<E, const V = E>(
@@ -153,8 +162,10 @@ export function toInserted<
153
162
  index: ArgArrayIndexWithNegative<Ar>,
154
163
  newValue: V,
155
164
  ): IsFixedLengthList<Ar> extends true
156
- ? ArrayOfLength<CastToNumber<Increment<Ar['length']>>, Ar[number] | V>
157
- : NonEmptyArray<Ar[number] | V>;
165
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
166
+ ArrayOfLength<CastToNumber<Increment<Ar['length']>>, Ar[number] | V>
167
+ : // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
168
+ NonEmptyArray<Ar[number] | V>;
158
169
 
159
170
  // curried version
160
171
  export function toInserted<const V>(
@@ -163,8 +174,10 @@ export function toInserted<const V>(
163
174
  ): <const Ar extends readonly unknown[]>(
164
175
  array: Ar,
165
176
  ) => IsFixedLengthList<Ar> extends true
166
- ? ArrayOfLength<CastToNumber<Increment<Ar['length']>>, Ar[number] | V>
167
- : NonEmptyArray<Ar[number] | V>;
177
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
178
+ ArrayOfLength<CastToNumber<Increment<Ar['length']>>, Ar[number] | V>
179
+ : // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
180
+ NonEmptyArray<Ar[number] | V>;
168
181
 
169
182
  export function toInserted<E, const V = E>(
170
183
  ...args:
@@ -416,10 +429,13 @@ export function toRangeFilled<const Ar extends readonly unknown[], const V>(
416
429
  end: ArgArrayIndexWithNegative<Ar>,
417
430
  ],
418
431
  ): IsFixedLengthList<Ar> extends true
419
- ? ArrayOfLength<Ar['length'], V | Ar[number]>
432
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
433
+ ArrayOfLength<Ar['length'], V | Ar[number]>
420
434
  : Ar extends NonEmptyArray<unknown>
421
- ? NonEmptyArray<V | Ar[number]>
422
- : readonly (V | Ar[number])[];
435
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
436
+ NonEmptyArray<V | Ar[number]>
437
+ : // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
438
+ readonly (V | Ar[number])[];
423
439
 
424
440
  // curried version
425
441
  export function toRangeFilled<const V>(
@@ -431,10 +447,13 @@ export function toRangeFilled<const V>(
431
447
  ): <const Ar extends readonly unknown[]>(
432
448
  array: Ar,
433
449
  ) => IsFixedLengthList<Ar> extends true
434
- ? ArrayOfLength<Ar['length'], V | Ar[number]>
450
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
451
+ ArrayOfLength<Ar['length'], V | Ar[number]>
435
452
  : Ar extends NonEmptyArray<unknown>
436
- ? NonEmptyArray<V | Ar[number]>
437
- : readonly (V | Ar[number])[];
453
+ ? // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
454
+ NonEmptyArray<V | Ar[number]>
455
+ : // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
456
+ readonly (V | Ar[number])[];
438
457
 
439
458
  export function toRangeFilled<E, const V>(
440
459
  ...args:
@@ -206,9 +206,9 @@ export function maxBy<E, V>(
206
206
  *
207
207
  * const withCurried = Arr.count<string>((word) => word.includes('a'))(words);
208
208
  *
209
- * assert(longWords === 2);
209
+ * assert.isTrue(longWords === 2);
210
210
  *
211
- * assert(withCurried === 2);
211
+ * assert.isTrue(withCurried === 2);
212
212
  * ```
213
213
  */
214
214
  export function count<const Ar extends readonly unknown[]>(
@@ -324,9 +324,9 @@ export function countBy<E, G extends MapSetKeyType>(
324
324
  * 'items',
325
325
  * )(words);
326
326
  *
327
- * assert(totalLength === 11);
327
+ * assert.isTrue(totalLength === 11);
328
328
  *
329
- * assert(concat === 'items-Ada-Lovelace');
329
+ * assert.isTrue(concat === 'items-Ada-Lovelace');
330
330
  * ```
331
331
  */
332
332
  export function foldl<const Ar extends readonly unknown[], P>(
@@ -401,9 +401,9 @@ export function foldl<E, P>(
401
401
  * '',
402
402
  * )(numbers);
403
403
  *
404
- * assert(subtractRight === -6);
404
+ * assert.isTrue(subtractRight === -6);
405
405
  *
406
- * assert(joinFromRight === '321');
406
+ * assert.isTrue(joinFromRight === '321');
407
407
  * ```
408
408
  */
409
409
  export function foldr<const Ar extends readonly unknown[], P>(
@@ -477,9 +477,9 @@ export function foldr<E, P>(
477
477
  *
478
478
  * const totalNegatives = Arr.sum(negatives);
479
479
  *
480
- * assert(total === 10);
480
+ * assert.isTrue(total === 10);
481
481
  *
482
- * assert(totalNegatives === 6);
482
+ * assert.isTrue(totalNegatives === 6);
483
483
  * ```
484
484
  */
485
485
  export function sum(array: readonly []): 0;
@@ -24,7 +24,7 @@ describe('Arr reducing value', () => {
24
24
  expectType<typeof result, Some<3 | 4 | 5>>('=');
25
25
 
26
26
  test('case 1', () => {
27
- expect(Optional.isSome(result)).toBe(true);
27
+ assert.isTrue(Optional.isSome(result));
28
28
 
29
29
  if (Optional.isSome(result)) {
30
30
  expect(result.value).toBe(3);
@@ -40,7 +40,7 @@ describe('Arr reducing value', () => {
40
40
  expectType<typeof result, Some<3 | 4 | 5>>('=');
41
41
 
42
42
  test('case 2', () => {
43
- expect(Optional.isSome(result)).toBe(true);
43
+ assert.isTrue(Optional.isSome(result));
44
44
 
45
45
  if (Optional.isSome(result)) {
46
46
  expect(result.value).toBe(3);
@@ -56,7 +56,7 @@ describe('Arr reducing value', () => {
56
56
  expectType<typeof result, Optional<3 | 4 | 5>>('=');
57
57
 
58
58
  test('case 3', () => {
59
- expect(Optional.isSome(result)).toBe(true);
59
+ assert.isTrue(Optional.isSome(result));
60
60
 
61
61
  if (Optional.isSome(result)) {
62
62
  expect(result.value).toBe(3);
@@ -73,7 +73,7 @@ describe('Arr reducing value', () => {
73
73
  expectType<typeof result, Some<3 | 4 | 5>>('=');
74
74
 
75
75
  test('case 1', () => {
76
- expect(Optional.isSome(result)).toBe(true);
76
+ assert.isTrue(Optional.isSome(result));
77
77
 
78
78
  if (Optional.isSome(result)) {
79
79
  expect(result.value).toBe(5);
@@ -85,7 +85,7 @@ describe('Arr reducing value', () => {
85
85
 
86
86
  expectType<typeof res, Some<3 | 4 | 5>>('=');
87
87
 
88
- expect(Optional.isSome(res)).toBe(true);
88
+ assert.isTrue(Optional.isSome(res));
89
89
 
90
90
  if (Optional.isSome(res)) {
91
91
  expect(res.value).toBe(5);
@@ -99,7 +99,7 @@ describe('Arr reducing value', () => {
99
99
 
100
100
  expectType<typeof res, Optional<number>>('=');
101
101
 
102
- expect(Optional.isSome(res)).toBe(true);
102
+ assert.isTrue(Optional.isSome(res));
103
103
 
104
104
  if (Optional.isSome(res)) {
105
105
  expect(res.value).toBe(5);
@@ -113,7 +113,7 @@ describe('Arr reducing value', () => {
113
113
 
114
114
  expectType<typeof res, Optional<number>>('=');
115
115
 
116
- expect(Optional.isNone(res)).toBe(true);
116
+ assert.isTrue(Optional.isNone(res));
117
117
  });
118
118
  });
119
119
 
@@ -144,7 +144,7 @@ describe('Arr reducing value', () => {
144
144
  >('=');
145
145
 
146
146
  test('case 1', () => {
147
- expect(Optional.isSome(result)).toBe(true);
147
+ assert.isTrue(Optional.isSome(result));
148
148
 
149
149
  if (Optional.isSome(result)) {
150
150
  assert.deepStrictEqual(result.value, { x: 1, y: 2 });
@@ -158,7 +158,7 @@ describe('Arr reducing value', () => {
158
158
 
159
159
  expectType<typeof res, Optional<{ x: number }>>('=');
160
160
 
161
- expect(Optional.isNone(res)).toBe(true);
161
+ assert.isTrue(Optional.isNone(res));
162
162
  });
163
163
 
164
164
  test('case 3: custom comparator', () => {
@@ -185,7 +185,7 @@ describe('Arr reducing value', () => {
185
185
  >
186
186
  >('=');
187
187
 
188
- expect(Optional.isSome(res)).toBe(true);
188
+ assert.isTrue(Optional.isSome(res));
189
189
 
190
190
  if (Optional.isSome(res)) {
191
191
  assert.deepStrictEqual(res.value, { name: 'apple', score: 10 });
@@ -220,7 +220,7 @@ describe('Arr reducing value', () => {
220
220
  >('=');
221
221
 
222
222
  test('case 1', () => {
223
- expect(Optional.isSome(result)).toBe(true);
223
+ assert.isTrue(Optional.isSome(result));
224
224
 
225
225
  if (Optional.isSome(result)) {
226
226
  assert.deepStrictEqual(result.value, { x: 6, y: 1 });
@@ -234,7 +234,7 @@ describe('Arr reducing value', () => {
234
234
 
235
235
  expectType<typeof res, Optional<{ x: number }>>('=');
236
236
 
237
- expect(Optional.isNone(res)).toBe(true);
237
+ assert.isTrue(Optional.isNone(res));
238
238
  });
239
239
 
240
240
  test('case 3: custom comparator', () => {
@@ -261,7 +261,7 @@ describe('Arr reducing value', () => {
261
261
  >
262
262
  >('=');
263
263
 
264
- expect(Optional.isSome(res)).toBe(true);
264
+ assert.isTrue(Optional.isSome(res));
265
265
 
266
266
  if (Optional.isSome(res)) {
267
267
  assert.deepStrictEqual(res.value, { name: 'cherry', score: 12 });
@@ -348,7 +348,7 @@ describe('Arr reducing value', () => {
348
348
 
349
349
  const even = res.get(0);
350
350
 
351
- expect(Optional.isSome(even)).toBe(true);
351
+ assert.isTrue(Optional.isSome(even));
352
352
 
353
353
  if (Optional.isSome(even)) {
354
354
  expect(even.value).toBe(3);
@@ -356,7 +356,7 @@ describe('Arr reducing value', () => {
356
356
 
357
357
  const odd = res.get(1);
358
358
 
359
- expect(Optional.isSome(odd)).toBe(true);
359
+ assert.isTrue(Optional.isSome(odd));
360
360
 
361
361
  if (Optional.isSome(odd)) {
362
362
  expect(odd.value).toBe(3);
@@ -489,11 +489,9 @@ describe('Arr reducing value', () => {
489
489
 
490
490
  const result = join(arr, ' ');
491
491
 
492
- expect(Result.isOk(result)).toBe(true);
492
+ assert.isTrue(Result.isOk(result));
493
493
 
494
- if (Result.isOk(result)) {
495
- expect(result.value).toBe('Hello World');
496
- }
494
+ expect(result.value).toBe('Hello World');
497
495
  });
498
496
 
499
497
  test('should handle empty separator', () => {
@@ -501,11 +499,9 @@ describe('Arr reducing value', () => {
501
499
 
502
500
  const result = join(arr, '');
503
501
 
504
- expect(Result.isOk(result)).toBe(true);
502
+ assert.isTrue(Result.isOk(result));
505
503
 
506
- if (Result.isOk(result)) {
507
- expect(result.value).toBe('abc');
508
- }
504
+ expect(result.value).toBe('abc');
509
505
  });
510
506
 
511
507
  test('should handle undefined separator', () => {
@@ -513,11 +509,9 @@ describe('Arr reducing value', () => {
513
509
 
514
510
  const result = join(arr);
515
511
 
516
- expect(Result.isOk(result)).toBe(true);
512
+ assert.isTrue(Result.isOk(result));
517
513
 
518
- if (Result.isOk(result)) {
519
- expect(result.value).toBe('a,b,c');
520
- }
514
+ expect(result.value).toBe('a,b,c');
521
515
  });
522
516
 
523
517
  test('should work with curried version', () => {
@@ -525,11 +519,9 @@ describe('Arr reducing value', () => {
525
519
 
526
520
  const result = joinWithDash(['x', 'y', 'z']);
527
521
 
528
- expect(Result.isOk(result)).toBe(true);
522
+ assert.isTrue(Result.isOk(result));
529
523
 
530
- if (Result.isOk(result)) {
531
- expect(result.value).toBe('x-y-z');
532
- }
524
+ expect(result.value).toBe('x-y-z');
533
525
  });
534
526
  });
535
527
  });
@@ -194,9 +194,9 @@ export function findLast<E>(
194
194
  * letters,
195
195
  * );
196
196
  *
197
- * assert(indexOfB === 1);
197
+ * assert.isTrue(indexOfB === 1);
198
198
  *
199
- * assert(indexOfMissing === -1);
199
+ * assert.isTrue(indexOfMissing === -1);
200
200
  * ```
201
201
  */
202
202
  export function findIndex<const Ar extends readonly unknown[]>(
@@ -259,9 +259,9 @@ export function findIndex<E>(
259
259
  * // eslint-disable-next-line unicorn/prefer-array-index-of
260
260
  * const notFound = Arr.findLastIndex<string>((letter) => letter === 'z')(letters);
261
261
  *
262
- * assert(lastIndexOfB === 3);
262
+ * assert.isTrue(lastIndexOfB === 3);
263
263
  *
264
- * assert(notFound === -1);
264
+ * assert.isTrue(notFound === -1);
265
265
  * ```
266
266
  */
267
267
  export function findLastIndex<const Ar extends readonly unknown[]>(
@@ -18,7 +18,7 @@ describe('Arr search operations', () => {
18
18
 
19
19
  const firstEven = find(numbers, (n) => n % 2 === 0);
20
20
 
21
- expect(Optional.isSome(firstEven)).toBe(true);
21
+ assert.isTrue(Optional.isSome(firstEven));
22
22
 
23
23
  expect(Optional.unwrap(firstEven)).toBe(2);
24
24
  });
@@ -28,7 +28,7 @@ describe('Arr search operations', () => {
28
28
 
29
29
  const firstEven = find(odds, (n) => n % 2 === 0);
30
30
 
31
- expect(Optional.isNone(firstEven)).toBe(true);
31
+ assert.isTrue(Optional.isNone(firstEven));
32
32
  });
33
33
 
34
34
  test('should work with curried version', () => {
@@ -40,11 +40,11 @@ describe('Arr search operations', () => {
40
40
 
41
41
  const result2 = findEven([1, 3, 5]);
42
42
 
43
- expect(Optional.isSome(result1)).toBe(true);
43
+ assert.isTrue(Optional.isSome(result1));
44
44
 
45
45
  expect(Optional.unwrap(result1)).toBe(2);
46
46
 
47
- expect(Optional.isNone(result2)).toBe(true);
47
+ assert.isTrue(Optional.isNone(result2));
48
48
  });
49
49
 
50
50
  test('should work with type guard predicate', () => {
@@ -57,7 +57,7 @@ describe('Arr search operations', () => {
57
57
 
58
58
  expectType<typeof firstString, Optional<string>>('=');
59
59
 
60
- expect(Optional.isSome(firstString)).toBe(true);
60
+ assert.isTrue(Optional.isSome(firstString));
61
61
 
62
62
  expect(Optional.unwrap(firstString)).toBe('a');
63
63
  });
@@ -87,7 +87,7 @@ describe('Arr search operations', () => {
87
87
 
88
88
  const result = find(empty, () => true);
89
89
 
90
- expect(Optional.isNone(result)).toBe(true);
90
+ assert.isTrue(Optional.isNone(result));
91
91
  });
92
92
  });
93
93
 
@@ -97,7 +97,7 @@ describe('Arr search operations', () => {
97
97
 
98
98
  const lastEven = findLast(numbers, (n) => n % 2 === 0);
99
99
 
100
- expect(Optional.isSome(lastEven)).toBe(true);
100
+ assert.isTrue(Optional.isSome(lastEven));
101
101
 
102
102
  expect(Optional.unwrap(lastEven)).toBe(4);
103
103
  });
@@ -107,7 +107,7 @@ describe('Arr search operations', () => {
107
107
 
108
108
  const lastEven = findLast(odds, (n) => n % 2 === 0);
109
109
 
110
- expect(Optional.isNone(lastEven)).toBe(true);
110
+ assert.isTrue(Optional.isNone(lastEven));
111
111
  });
112
112
 
113
113
  test('should work with curried version', () => {
@@ -117,7 +117,7 @@ describe('Arr search operations', () => {
117
117
 
118
118
  const result = findLastPositive([-1, 2, -3, 4]);
119
119
 
120
- expect(Optional.isSome(result)).toBe(true);
120
+ assert.isTrue(Optional.isSome(result));
121
121
 
122
122
  expect(Optional.unwrap(result)).toBe(4);
123
123
  });
@@ -127,7 +127,7 @@ describe('Arr search operations', () => {
127
127
 
128
128
  const result = findLast(empty, (n) => n > 0);
129
129
 
130
- expect(Optional.isNone(result)).toBe(true);
130
+ assert.isTrue(Optional.isNone(result));
131
131
  });
132
132
 
133
133
  test('should pass index and array to predicate', () => {