ts-data-forge 7.0.1 → 7.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 (54) hide show
  1. package/dist/array/impl/array-utils-creation.d.mts +2 -2
  2. package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-validation.d.mts +41 -1
  4. package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
  5. package/dist/array/impl/array-utils-validation.mjs +41 -1
  6. package/dist/array/impl/array-utils-validation.mjs.map +1 -1
  7. package/dist/array/impl/index.mjs +1 -1
  8. package/dist/functional/optional/impl/optional-expect-to-be.d.mts +2 -2
  9. package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -1
  10. package/dist/functional/optional/impl/optional-or-else.d.mts +1 -1
  11. package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -1
  12. package/dist/functional/optional/impl/optional-unwrap-or.d.mts +1 -1
  13. package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -1
  14. package/dist/functional/result/impl/result-expect-to-be.d.mts +3 -3
  15. package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -1
  16. package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
  17. package/dist/functional/result/impl/result-or-else.d.mts +2 -2
  18. package/dist/functional/result/impl/result-or-else.d.mts.map +1 -1
  19. package/dist/functional/result/impl/result-unwrap-err-or.d.mts +2 -2
  20. package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -1
  21. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +2 -2
  22. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -1
  23. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +2 -2
  24. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -1
  25. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +2 -2
  26. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -1
  27. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
  28. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +2 -2
  29. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -1
  30. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
  31. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +2 -2
  32. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -1
  33. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
  34. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +2 -2
  35. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -1
  36. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
  37. package/package.json +1 -1
  38. package/src/array/impl/array-utils-creation.mts +1 -1
  39. package/src/array/impl/array-utils-transformation.mts +1 -1
  40. package/src/array/impl/array-utils-validation.mts +56 -0
  41. package/src/array/impl/array-utils-validation.test.mts +160 -1
  42. package/src/functional/optional/impl/optional-expect-to-be.mts +2 -2
  43. package/src/functional/optional/impl/optional-or-else.mts +3 -3
  44. package/src/functional/optional/impl/optional-unwrap-or.mts +2 -2
  45. package/src/functional/optional.test.mts +3 -3
  46. package/src/functional/result/impl/result-expect-to-be.mts +5 -3
  47. package/src/functional/result/impl/result-or-else.mts +4 -4
  48. package/src/functional/result/impl/result-unwrap-err-or.mts +2 -2
  49. package/src/functional/result/impl/result-unwrap-ok-or.mts +3 -3
  50. package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +3 -3
  51. package/src/functional/ternary-result/impl/ternary-result-or-else.mts +6 -9
  52. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +3 -6
  53. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +3 -6
  54. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +3 -6
@@ -47,13 +47,13 @@ export declare const seq: <N extends SizeType.ArgArr>(len: N) => N extends Small
47
47
  * assert.deepStrictEqual(emptyStrings, []);
48
48
  * ```
49
49
  */
50
- export declare const create: <const V, N extends SizeType.ArgArr>(len: N, init: V) => N extends SmallUint ? ArrayOfLength<N, V> : N extends SizeType.ArgArrPositive ? NonEmptyArray<V> : readonly V[];
50
+ export declare const create: <N extends SizeType.ArgArr, const V>(len: N, init: V) => N extends SmallUint ? ArrayOfLength<N, V> : N extends SizeType.ArgArrPositive ? NonEmptyArray<V> : readonly V[];
51
51
  /**
52
52
  * Alias for `create`.
53
53
  *
54
54
  * @see {@link create}
55
55
  */
56
- export declare const newArray: <const V, N extends SizeType.ArgArr>(len: N, init: V) => N extends SmallUint ? ArrayOfLength<N, V> : N extends SizeType.ArgArrPositive ? NonEmptyArray<V> : readonly V[];
56
+ export declare const newArray: <N extends SizeType.ArgArr, const V>(len: N, init: V) => N extends SmallUint ? ArrayOfLength<N, V> : N extends SizeType.ArgArrPositive ? NonEmptyArray<V> : readonly V[];
57
57
  /**
58
58
  * Generates an array from a generator function.
59
59
  *
@@ -1 +1 @@
1
- {"version":3,"file":"array-utils-creation.d.mts","sourceRoot":"","sources":["../../../src/array/impl/array-utils-creation.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,GAAG,EACR,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,GAAG,EACR,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;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OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GACvC,SAAS,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAC5C,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAkB3B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAC5D,KAAK,EAAE,CAAC,EACR,GAAG,EAAE,CAAC,EACN,IAAI,CAAC,EAAE,CAAC,GACP,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEnB,wBAAgB,KAAK,CACnB,KAAK,EAAE,oBAAoB,EAC3B,GAAG,EAAE,oBAAoB,EACzB,IAAI,CAAC,EAAE,2BAA2B,GACjC,SAAS,QAAQ,EAAE,CAAC;AAEvB,wBAAgB,KAAK,CACnB,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,mBAAmB,EACxB,IAAI,CAAC,EAAE,0BAA0B,GAChC,SAAS,OAAO,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type ArrayAtLeastLen, type ArrayOfLength, type BoolOr, type NonEmptyArray, type TypeEq } from 'ts-type-forge';
1
+ import { type ArrayAtLeastLen, type ArrayAtMostLen, type ArrayBoundedLen, type ArrayOfLength, type BoolOr, type NonEmptyArray, type TypeEq } from 'ts-type-forge';
2
2
  import { type ArrayIndex, type SizeType } from '../../types.mjs';
3
3
  /**
4
4
  * Type guard that checks if a value is an array.
@@ -102,6 +102,46 @@ export declare const isArrayOfLength: <E, N extends SizeType.ArgArr>(array: read
102
102
  * ```
103
103
  */
104
104
  export declare const isArrayAtLeastLength: <E, N extends SizeType.ArgArr>(array: readonly E[], len: N) => array is ArrayAtLeastLen<N, E>;
105
+ /**
106
+ * Checks if an array has at most a specific length.
107
+ *
108
+ * @example
109
+ *
110
+ * ```ts
111
+ * const pair: readonly number[] = [1, 2] as const;
112
+ *
113
+ * const triple: readonly number[] = [1, 2, 3] as const;
114
+ *
115
+ * assert.isTrue(Arr.isArrayAtMostLength(pair, 2));
116
+ *
117
+ * assert.isFalse(Arr.isArrayAtMostLength(triple, 2));
118
+ *
119
+ * if (Arr.isArrayAtMostLength(pair, 2)) {
120
+ * assert.isTrue(pair.length <= 2);
121
+ * }
122
+ * ```
123
+ */
124
+ export declare const isArrayAtMostLength: <E, N extends SizeType.ArgArr>(array: readonly E[], len: N) => array is ArrayAtMostLen<N, E>;
125
+ /**
126
+ * Checks if an array's length is within a specific inclusive range.
127
+ *
128
+ * @example
129
+ *
130
+ * ```ts
131
+ * const pair: readonly number[] = [1, 2] as const;
132
+ *
133
+ * const quad: readonly number[] = [1, 2, 3, 4] as const;
134
+ *
135
+ * assert.isTrue(Arr.isArrayBoundedLength(pair, 1, 3));
136
+ *
137
+ * assert.isFalse(Arr.isArrayBoundedLength(quad, 1, 3));
138
+ *
139
+ * if (Arr.isArrayBoundedLength(pair, 1, 3)) {
140
+ * assert.isTrue(pair.length >= 1 && pair.length <= 3);
141
+ * }
142
+ * ```
143
+ */
144
+ export declare const isArrayBoundedLength: <E, Min extends SizeType.ArgArr, Max extends SizeType.ArgArr>(array: readonly E[], min: Min, max: Max) => array is ArrayBoundedLen<Min, Max, E>;
105
145
  /**
106
146
  * Tests whether all elements in an array pass a test implemented by a predicate.
107
147
  *
@@ -1 +1 @@
1
- {"version":3,"file":"array-utils-validation.d.mts","sourceRoot":"","sources":["../../../src/array/impl/array-utils-validation.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;;;;;;;;;;;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,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC;AAyBpC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAC9B,OAAO,SAAS,CAAC,EAAE,EACnB,OAAO,QAAQ,CAAC,MAAM,KACrB,OAAgD,CAAC"}
@@ -136,6 +136,46 @@ const isArrayOfLength = (array, len) => array.length === len;
136
136
  * ```
137
137
  */
138
138
  const isArrayAtLeastLength = (array, len) => array.length >= len;
139
+ /**
140
+ * Checks if an array has at most a specific length.
141
+ *
142
+ * @example
143
+ *
144
+ * ```ts
145
+ * const pair: readonly number[] = [1, 2] as const;
146
+ *
147
+ * const triple: readonly number[] = [1, 2, 3] as const;
148
+ *
149
+ * assert.isTrue(Arr.isArrayAtMostLength(pair, 2));
150
+ *
151
+ * assert.isFalse(Arr.isArrayAtMostLength(triple, 2));
152
+ *
153
+ * if (Arr.isArrayAtMostLength(pair, 2)) {
154
+ * assert.isTrue(pair.length <= 2);
155
+ * }
156
+ * ```
157
+ */
158
+ const isArrayAtMostLength = (array, len) => array.length <= len;
159
+ /**
160
+ * Checks if an array's length is within a specific inclusive range.
161
+ *
162
+ * @example
163
+ *
164
+ * ```ts
165
+ * const pair: readonly number[] = [1, 2] as const;
166
+ *
167
+ * const quad: readonly number[] = [1, 2, 3, 4] as const;
168
+ *
169
+ * assert.isTrue(Arr.isArrayBoundedLength(pair, 1, 3));
170
+ *
171
+ * assert.isFalse(Arr.isArrayBoundedLength(quad, 1, 3));
172
+ *
173
+ * if (Arr.isArrayBoundedLength(pair, 1, 3)) {
174
+ * assert.isTrue(pair.length >= 1 && pair.length <= 3);
175
+ * }
176
+ * ```
177
+ */
178
+ const isArrayBoundedLength = (array, min, max) => array.length >= min && array.length <= max;
139
179
  function every(...args) {
140
180
  switch (args.length) {
141
181
  case 2: {
@@ -179,5 +219,5 @@ function some(...args) {
179
219
  */
180
220
  const indexIsInRange = (array, index) => Num.isInRange(0, array.length)(index);
181
221
 
182
- export { every, indexIsInRange, isArray, isArrayAtLeastLength, isArrayOfLength, isEmpty, isNonEmpty, some };
222
+ export { every, indexIsInRange, isArray, isArrayAtLeastLength, isArrayAtMostLength, isArrayBoundedLength, isArrayOfLength, isEmpty, isNonEmpty, some };
183
223
  //# sourceMappingURL=array-utils-validation.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"array-utils-validation.mjs","sources":["../../../src/array/impl/array-utils-validation.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,OAAO,GAAG,CAAK,KAAQ,KAClC,KAAK,CAAC,OAAO,CAAC,KAAK;AAarB;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,OAAO,GAAG,CAAK,KAAmB,KAC7C,KAAK,CAAC,MAAM,KAAK;AAEnB;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,UAAU,GAAG,CACxB,KAAmB,KACW,KAAK,CAAC,MAAM,GAAG;AAE/C;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,eAAe,GAAG,CAC7B,KAAmB,EACnB,GAAM,KAC2B,KAAK,CAAC,MAAM,KAAK;AAEpD;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,oBAAoB,GAAG,CAClC,KAAmB,EACnB,GAAM,KAC6B,KAAK,CAAC,MAAM,IAAI;AAyC/C,SAAU,KAAK,CACnB,GAAG,IAK6D,EAAA;AAEhE,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,IAAI;YAE/B,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI;YAExB,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC;QAC3C;;AAEJ;AA8BM,SAAU,IAAI,CAClB,GAAG,IAK6D,EAAA;AAEhE,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,IAAI;YAE/B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI;YAExB,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC;QAC1C;;AAEJ;AAEA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,cAAc,GAAG,CAC5B,KAAmB,EACnB,KAAsB,KACV,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK;;;;"}
1
+ {"version":3,"file":"array-utils-validation.mjs","sources":["../../../src/array/impl/array-utils-validation.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,OAAO,GAAG,CAAK,KAAQ,KAClC,KAAK,CAAC,OAAO,CAAC,KAAK;AAarB;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,OAAO,GAAG,CAAK,KAAmB,KAC7C,KAAK,CAAC,MAAM,KAAK;AAEnB;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,UAAU,GAAG,CACxB,KAAmB,KACW,KAAK,CAAC,MAAM,GAAG;AAE/C;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM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AK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI;YAExB,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC;QAC1C;;AAEJ;AAEA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,cAAc,GAAG,CAC5B,KAAmB,EACnB,KAAsB,KACV,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK;;;;"}
@@ -9,5 +9,5 @@ export { length, size } from './array-utils-size.mjs';
9
9
  export { sliceClamped } from './array-utils-slice-clamped.mjs';
10
10
  export { butLast, drop, rest, skip, skipLast, tail, take, takeLast } from './array-utils-slicing.mjs';
11
11
  export { cartesianProduct, chunk, concat, filter, filterNot, flat, flatMap, groupBy, map, partition, scan, toReversed, toSorted, toSortedBy, uniq, uniqBy, zip } from './array-utils-transformation.mjs';
12
- export { every, indexIsInRange, isArray, isArrayAtLeastLength, isArrayOfLength, isEmpty, isNonEmpty, some } from './array-utils-validation.mjs';
12
+ export { every, indexIsInRange, isArray, isArrayAtLeastLength, isArrayAtMostLength, isArrayBoundedLength, isArrayOfLength, isEmpty, isNonEmpty, some } from './array-utils-validation.mjs';
13
13
  //# sourceMappingURL=index.mjs.map
@@ -13,7 +13,7 @@ import { type Unwrap } from './types.mjs';
13
13
  * Optional.expectToBe(optionalValue, 'value expected') === 'data',
14
14
  * );
15
15
  *
16
- * const expectValue = Optional.expectToBe<string>('missing optional');
16
+ * const expectValue = Optional.expectToBe('missing optional');
17
17
  *
18
18
  * const throwTest = (): void => {
19
19
  * expectValue(Optional.none);
@@ -33,5 +33,5 @@ import { type Unwrap } from './types.mjs';
33
33
  * `None`.
34
34
  */
35
35
  export declare function expectToBe<O extends UnknownOptional>(optional: O, message: string): Unwrap<O>;
36
- export declare function expectToBe<S>(message: string): (optional: Optional<S>) => S;
36
+ export declare function expectToBe(message: string): <O>(optional: Optional<O>) => O;
37
37
  //# sourceMappingURL=optional-expect-to-be.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"optional-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/optional/impl/optional-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,EAClD,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,CAAC,CAAC,CAAC;AAGb,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"optional-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/optional/impl/optional-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,EAClD,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,CAAC,CAAC,CAAC;AAGb,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC"}
@@ -39,5 +39,5 @@ import { type Optional, type UnknownOptional } from '../optional.mjs';
39
39
  * @returns The first `Optional` if `Some`, otherwise the alternative.
40
40
  */
41
41
  export declare function orElse<O extends UnknownOptional, const O2 extends UnknownOptional>(optional: O, alternative: O2): O | O2;
42
- export declare function orElse<S, S2>(alternative: Optional<S2>): (optional: Optional<S>) => Optional<S> | Optional<S2>;
42
+ export declare function orElse<O2>(alternative: Optional<O2>): <O>(optional: Optional<O>) => Optional<O> | Optional<O2>;
43
43
  //# sourceMappingURL=optional-or-else.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"optional-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/optional/impl/optional-or-else.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,MAAM,CACpB,CAAC,SAAS,eAAe,EACzB,KAAK,CAAC,EAAE,SAAS,eAAe,EAChC,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;AAGxC,wBAAgB,MAAM,CAAC,CAAC,EAAE,EAAE,EAC1B,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC,GACxB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"optional-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/optional/impl/optional-or-else.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,MAAM,CACpB,CAAC,SAAS,eAAe,EACzB,KAAK,CAAC,EAAE,SAAS,eAAe,EAChC,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;AAGxC,wBAAgB,MAAM,CAAC,EAAE,EACvB,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC,GACxB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC"}
@@ -33,5 +33,5 @@ import { type Unwrap } from './types.mjs';
33
33
  * @returns The contained value if `Some`, otherwise `defaultValue`.
34
34
  */
35
35
  export declare function unwrapOr<O extends UnknownOptional, D>(optional: O, defaultValue: D): D | Unwrap<O>;
36
- export declare function unwrapOr<S, D>(defaultValue: D): (optional: Optional<S>) => D | S;
36
+ export declare function unwrapOr<D>(defaultValue: D): <O>(optional: Optional<O>) => D | O;
37
37
  //# sourceMappingURL=optional-unwrap-or.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"optional-unwrap-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/optional/impl/optional-unwrap-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,eAAe,EAAE,CAAC,EACnD,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAGjB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,YAAY,EAAE,CAAC,GACd,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"optional-unwrap-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/optional/impl/optional-unwrap-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,eAAe,EAAE,CAAC,EACnD,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAGjB,wBAAgB,QAAQ,CAAC,CAAC,EACxB,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { type UnwrapOk } from './types.mjs';
3
3
  /**
4
4
  * Unwraps a `Result`, returning the success value or throwing an error with
@@ -11,7 +11,7 @@ import { type UnwrapOk } from './types.mjs';
11
11
  *
12
12
  * assert.isTrue(Result.expectToBe(okValue, 'should have value') === 'data');
13
13
  *
14
- * const expectResult = Result.expectToBe<string>('missing result');
14
+ * const expectResult = Result.expectToBe('missing result');
15
15
  *
16
16
  * const throwTest = (): void => {
17
17
  * expectResult(Result.err('boom'));
@@ -29,5 +29,5 @@ import { type UnwrapOk } from './types.mjs';
29
29
  * @throws Error with the provided message if the `Result` is `Result.Err`.
30
30
  */
31
31
  export declare function expectToBe<R extends UnknownResult>(result: R, message: string): UnwrapOk<R>;
32
- export declare function expectToBe<S>(message: string): <E>(result: Result<S, E>) => S;
32
+ export declare function expectToBe(message: string): <R extends UnknownResult>(result: R) => UnwrapOk<R>;
33
33
  //# sourceMappingURL=result-expect-to-be.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGhE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAChD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,MAAM,GACd,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGf,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"result-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAChD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,MAAM,GACd,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGf,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,GACd,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"result-expect-to-be.mjs","sources":["../../../../src/functional/result/impl/result-expect-to-be.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAyCM,SAAU,UAAU,CACxB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;AAE9B,YAAA,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC;QACxC;QAEA,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI;YAEtB,OAAO,CAAC,MAAS,KAAkB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC;QACpE;;AAEJ;AAEA,MAAM,cAAc,GAAG,CACrB,MAAS,EACT,OAAe,KACA;AACf,IAAA,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;AAChB,QAAA,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB;AAEA,IAAA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC;AAC1B,CAAC;;;;"}
1
+ {"version":3,"file":"result-expect-to-be.mjs","sources":["../../../../src/functional/result/impl/result-expect-to-be.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AA2CM,SAAU,UAAU,CACxB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;AAE9B,YAAA,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC;QACxC;QAEA,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI;YAEtB,OAAO,CAAC,MAAS,KAAkB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC;QACpE;;AAEJ;AAEA,MAAM,cAAc,GAAG,CACrB,MAAS,EACT,OAAe,KACA;AACf,IAAA,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;AAChB,QAAA,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB;AAEA,IAAA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC;AAC1B,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { type NarrowToOk } from './types.mjs';
3
3
  /**
4
4
  * Returns the `Result` if it is `Ok`, otherwise returns the alternative.
@@ -36,5 +36,5 @@ import { type NarrowToOk } from './types.mjs';
36
36
  * @returns The first `Result` if `Ok`, otherwise the alternative.
37
37
  */
38
38
  export declare function orElse<R extends UnknownResult, R2 extends UnknownResult>(result: R, alternative: R2): NarrowToOk<R> | R2;
39
- export declare function orElse<S, E, S2, E2>(alternative: Result<S2, E2>): (result: Result<S, E>) => Result<S, E> | Result<S2, E2>;
39
+ export declare function orElse<R2 extends UnknownResult>(alternative: R2): <R extends UnknownResult>(result: R) => NarrowToOk<R> | R2;
40
40
  //# sourceMappingURL=result-or-else.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,SAAS,aAAa,EACtE,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,EAAE,GACd,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAGtB,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EACjC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAC1B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"result-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,SAAS,aAAa,EACtE,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,EAAE,GACd,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAGtB,wBAAgB,MAAM,CAAC,EAAE,SAAS,aAAa,EAC7C,WAAW,EAAE,EAAE,GACd,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { type UnwrapErr } from './types.mjs';
3
3
  /**
4
4
  * Unwraps a `Result`, returning the error value or a default value if it is
@@ -29,5 +29,5 @@ import { type UnwrapErr } from './types.mjs';
29
29
  * @returns The error value if `Result.Err`, otherwise `defaultValue`.
30
30
  */
31
31
  export declare function unwrapErrOr<R extends UnknownResult, D>(result: R, defaultValue: D): D | UnwrapErr<R>;
32
- export declare function unwrapErrOr<D>(defaultValue: D): <S, E>(result: Result<S, E>) => D | E;
32
+ export declare function unwrapErrOr<D>(defaultValue: D): <R extends UnknownResult>(result: R) => D | UnwrapErr<R>;
33
33
  //# sourceMappingURL=result-unwrap-err-or.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result-unwrap-err-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,EACpD,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAGpB,wBAAgB,WAAW,CAAC,CAAC,EAC3B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"result-unwrap-err-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,EACpD,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAGpB,wBAAgB,WAAW,CAAC,CAAC,EAC3B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { type UnwrapOk } from './types.mjs';
3
3
  /**
4
4
  * Unwraps a `Result`, returning the success value or a default value if it is
@@ -29,5 +29,5 @@ import { type UnwrapOk } from './types.mjs';
29
29
  * @returns The success value if `Result.Ok`, otherwise `defaultValue`.
30
30
  */
31
31
  export declare function unwrapOkOr<R extends UnknownResult, D>(result: R, defaultValue: D): D | UnwrapOk<R>;
32
- export declare function unwrapOkOr<S, D>(defaultValue: D): <E>(result: Result<S, E>) => D | S;
32
+ export declare function unwrapOkOr<D>(defaultValue: D): <R extends UnknownResult>(result: R) => D | UnwrapOk<R>;
33
33
  //# sourceMappingURL=result-unwrap-ok-or.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result-unwrap-ok-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-ok-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,EACnD,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGnB,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAC7B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"result-unwrap-ok-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-ok-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,EACnD,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGnB,wBAAgB,UAAU,CAAC,CAAC,EAC1B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -10,7 +10,7 @@ import { type UnwrapOk } from './types.mjs';
10
10
  *
11
11
  * assert.strictEqual(TernaryResult.expectToBe(okValue, 'missing'), 'ready');
12
12
  *
13
- * const expectResult = TernaryResult.expectToBe<string>('needs value');
13
+ * const expectResult = TernaryResult.expectToBe('needs value');
14
14
  *
15
15
  * const throwTest = (): void => {
16
16
  * expectResult(TernaryResult.err('oops'));
@@ -20,5 +20,5 @@ import { type UnwrapOk } from './types.mjs';
20
20
  * ```
21
21
  */
22
22
  export declare function expectToBe<R extends UnknownTernaryResult>(result: R, message: string): UnwrapOk<R>;
23
- export declare function expectToBe<S>(message: string): <W, E>(result: TernaryResult<S, E, W>) => S;
23
+ export declare function expectToBe(message: string): <S, W, E>(result: TernaryResult<S, E, W>) => S;
24
24
  //# sourceMappingURL=ternary-result-expect-to-be.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,oBAAoB,EACvD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,MAAM,GACd,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGf,wBAAgB,UAAU,CAAC,CAAC,EAC1B,OAAO,EAAE,MAAM,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"ternary-result-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,oBAAoB,EACvD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,MAAM,GACd,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGf,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type TernaryResult, type UnknownTernaryResult } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
2
2
  import { type NarrowToOk, type NarrowToWarn } from './types.mjs';
3
3
  /**
4
4
  * Returns the original result if it is Ok, otherwise the provided fallback.
@@ -25,5 +25,5 @@ import { type NarrowToOk, type NarrowToWarn } from './types.mjs';
25
25
  * ```
26
26
  */
27
27
  export declare function orElse<R extends UnknownTernaryResult, R2 extends UnknownTernaryResult>(result: R, alternative: R2): NarrowToOk<R> | NarrowToWarn<R> | R2;
28
- export declare function orElse<S, W, E, S2, W2, E2>(alternative: TernaryResult<S2, E2, W2>): (result: TernaryResult<S, E, W>) => TernaryResult<S, E, W> | TernaryResult<S2, E2, W2>;
28
+ export declare function orElse<R2 extends UnknownTernaryResult>(alternative: R2): <R extends UnknownTernaryResult>(result: R) => NarrowToOk<R> | NarrowToWarn<R> | R2;
29
29
  //# sourceMappingURL=ternary-result-or-else.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-or-else.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CACpB,CAAC,SAAS,oBAAoB,EAC9B,EAAE,SAAS,oBAAoB,EAC/B,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAGpE,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EACxC,WAAW,EAAE,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GACrC,CACD,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"ternary-result-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-or-else.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CACpB,CAAC,SAAS,oBAAoB,EAC9B,EAAE,SAAS,oBAAoB,EAC/B,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAGpE,wBAAgB,MAAM,CAAC,EAAE,SAAS,oBAAoB,EACpD,WAAW,EAAE,EAAE,GACd,CAAC,CAAC,SAAS,oBAAoB,EAChC,MAAM,EAAE,CAAC,KACN,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-or-else.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-or-else.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AA4CM,SAAU,MAAM,CAIpB,GAAG,IAAwE,EAAA;AAI3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;AAElC,YAAA,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC;QACxC;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;YAE1B,OAAO,CAAC,MAAS,KAAK,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC;QACvD;;AAEJ;AAEA,MAAM,UAAU,GAAG,CAIjB,MAAS,EACT,WAAe,KAEf,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,WAAW;;;;"}
1
+ {"version":3,"file":"ternary-result-or-else.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-or-else.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAyCM,SAAU,MAAM,CAIpB,GAAG,IAAwE,EAAA;AAI3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;AAElC,YAAA,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC;QACxC;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;YAE1B,OAAO,CAAC,MAAS,KAAK,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC;QACvD;;AAEJ;AAEA,MAAM,UAAU,GAAG,CAIjB,MAAS,EACT,WAAe,KAEf,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,WAAW;;;;"}
@@ -1,4 +1,4 @@
1
- import { type TernaryResult, type UnknownTernaryResult } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
2
2
  import { type UnwrapErr } from './types.mjs';
3
3
  /**
4
4
  * Returns the Err value or the provided default.
@@ -24,5 +24,5 @@ import { type UnwrapErr } from './types.mjs';
24
24
  * ```
25
25
  */
26
26
  export declare function unwrapErrOr<R extends UnknownTernaryResult, D>(result: R, defaultValue: D): D | UnwrapErr<R>;
27
- export declare function unwrapErrOr<E, D>(defaultValue: D): <S, W>(result: TernaryResult<S, E, W>) => D | E;
27
+ export declare function unwrapErrOr<D>(defaultValue: D): <R extends UnknownTernaryResult>(result: R) => D | UnwrapErr<R>;
28
28
  //# sourceMappingURL=ternary-result-unwrap-err-or.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-err-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,oBAAoB,EAAE,CAAC,EAC3D,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAGpB,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC9B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"ternary-result-unwrap-err-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,oBAAoB,EAAE,CAAC,EAC3D,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAGpB,wBAAgB,WAAW,CAAC,CAAC,EAC3B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,SAAS,oBAAoB,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-err-or.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAwCM,SAAU,WAAW,CACzB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;AAEnC,YAAA,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,YAAY;QAC1C;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI;YAE3B,OAAO,CAAC,MAAS,KAAK,SAAS,CAAC,MAAM,CAAC,IAAI,YAAY;QACzD;;AAEJ;;;;"}
1
+ {"version":3,"file":"ternary-result-unwrap-err-or.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAqCM,SAAU,WAAW,CACzB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;AAEnC,YAAA,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,YAAY;QAC1C;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI;YAE3B,OAAO,CAAC,MAAS,KAAK,SAAS,CAAC,MAAM,CAAC,IAAI,YAAY;QACzD;;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import { type TernaryResult, type UnknownTernaryResult } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
2
2
  import { type UnwrapOk } from './types.mjs';
3
3
  /**
4
4
  * Returns the Ok value or the provided default.
@@ -21,5 +21,5 @@ import { type UnwrapOk } from './types.mjs';
21
21
  * ```
22
22
  */
23
23
  export declare function unwrapOkOr<R extends UnknownTernaryResult, D>(result: R, defaultValue: D): D | UnwrapOk<R>;
24
- export declare function unwrapOkOr<S, D>(defaultValue: D): <W, E>(result: TernaryResult<S, E, W>) => D | S;
24
+ export declare function unwrapOkOr<D>(defaultValue: D): <R extends UnknownTernaryResult>(result: R) => D | UnwrapOk<R>;
25
25
  //# sourceMappingURL=ternary-result-unwrap-ok-or.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-ok-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,oBAAoB,EAAE,CAAC,EAC1D,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGnB,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAC7B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"ternary-result-unwrap-ok-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,oBAAoB,EAAE,CAAC,EAC1D,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGnB,wBAAgB,UAAU,CAAC,CAAC,EAC1B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,SAAS,oBAAoB,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-ok-or.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAqCM,SAAU,UAAU,CACxB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;AAEnC,YAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,YAAY;QACzC;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI;YAE3B,OAAO,CAAC,MAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,IAAI,YAAY;QACxD;;AAEJ;;;;"}
1
+ {"version":3,"file":"ternary-result-unwrap-ok-or.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAkCM,SAAU,UAAU,CACxB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;AAEnC,YAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,YAAY;QACzC;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI;YAE3B,OAAO,CAAC,MAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,IAAI,YAAY;QACxD;;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import { type TernaryResult, type UnknownTernaryResult } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
2
2
  import { type UnwrapWarn } from './types.mjs';
3
3
  /**
4
4
  * Returns the Warn value or the provided default.
@@ -18,5 +18,5 @@ import { type UnwrapWarn } from './types.mjs';
18
18
  * ```
19
19
  */
20
20
  export declare function unwrapWarnOr<R extends UnknownTernaryResult, D>(result: R, defaultValue: D): D | UnwrapWarn<R>;
21
- export declare function unwrapWarnOr<W, D>(defaultValue: D): <S, E>(result: TernaryResult<S, E, W>) => D | W;
21
+ export declare function unwrapWarnOr<D>(defaultValue: D): <R extends UnknownTernaryResult>(result: R) => D | UnwrapWarn<R>;
22
22
  //# sourceMappingURL=ternary-result-unwrap-warn-or.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-warn-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,oBAAoB,EAAE,CAAC,EAC5D,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAGrB,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"ternary-result-unwrap-warn-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,oBAAoB,EAAE,CAAC,EAC5D,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAGrB,wBAAgB,YAAY,CAAC,CAAC,EAC5B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,SAAS,oBAAoB,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-warn-or.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAkCM,SAAU,YAAY,CAC1B,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;AAEnC,YAAA,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,YAAY;QAC3C;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI;YAE3B,OAAO,CAAC,MAAS,KAAK,UAAU,CAAC,MAAM,CAAC,IAAI,YAAY;QAC1D;;AAEJ;;;;"}
1
+ {"version":3,"file":"ternary-result-unwrap-warn-or.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;AA+BM,SAAU,YAAY,CAC1B,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;AAEnC,YAAA,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,YAAY;QAC3C;QAEA,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI;YAE3B,OAAO,CAAC,MAAS,KAAK,UAAU,CAAC,MAAM,CAAC,IAAI,YAAY;QAC1D;;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-data-forge",
3
- "version": "7.0.1",
3
+ "version": "7.1.1",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript",
@@ -85,7 +85,7 @@ export const seq = <N extends SizeType.ArgArr>(
85
85
  * assert.deepStrictEqual(emptyStrings, []);
86
86
  * ```
87
87
  */
88
- export const create = <const V, N extends SizeType.ArgArr>(
88
+ export const create = <N extends SizeType.ArgArr, const V>(
89
89
  len: N,
90
90
  init: V,
91
91
  ): N extends SmallUint
@@ -143,7 +143,7 @@ export function scan<E, S>(
143
143
  const [array, reducer, init] = args;
144
144
 
145
145
  const mut_result: MutableNonEmptyArray<S> = castMutable(
146
- newArray<S, PositiveUint32>(asPositiveUint32(array.length + 1), init),
146
+ newArray<PositiveUint32, S>(asPositiveUint32(array.length + 1), init),
147
147
  );
148
148
 
149
149
  let mut_acc = init;
@@ -1,5 +1,7 @@
1
1
  import {
2
2
  type ArrayAtLeastLen,
3
+ type ArrayAtMostLen,
4
+ type ArrayBoundedLen,
3
5
  type ArrayOfLength,
4
6
  type BoolOr,
5
7
  type NonEmptyArray,
@@ -136,6 +138,60 @@ export const isArrayAtLeastLength = <E, N extends SizeType.ArgArr>(
136
138
  len: N,
137
139
  ): array is ArrayAtLeastLen<N, E> => array.length >= len;
138
140
 
141
+ /**
142
+ * Checks if an array has at most a specific length.
143
+ *
144
+ * @example
145
+ *
146
+ * ```ts
147
+ * const pair: readonly number[] = [1, 2] as const;
148
+ *
149
+ * const triple: readonly number[] = [1, 2, 3] as const;
150
+ *
151
+ * assert.isTrue(Arr.isArrayAtMostLength(pair, 2));
152
+ *
153
+ * assert.isFalse(Arr.isArrayAtMostLength(triple, 2));
154
+ *
155
+ * if (Arr.isArrayAtMostLength(pair, 2)) {
156
+ * assert.isTrue(pair.length <= 2);
157
+ * }
158
+ * ```
159
+ */
160
+ export const isArrayAtMostLength = <E, N extends SizeType.ArgArr>(
161
+ array: readonly E[],
162
+ len: N,
163
+ ): array is ArrayAtMostLen<N, E> => array.length <= len;
164
+
165
+ /**
166
+ * Checks if an array's length is within a specific inclusive range.
167
+ *
168
+ * @example
169
+ *
170
+ * ```ts
171
+ * const pair: readonly number[] = [1, 2] as const;
172
+ *
173
+ * const quad: readonly number[] = [1, 2, 3, 4] as const;
174
+ *
175
+ * assert.isTrue(Arr.isArrayBoundedLength(pair, 1, 3));
176
+ *
177
+ * assert.isFalse(Arr.isArrayBoundedLength(quad, 1, 3));
178
+ *
179
+ * if (Arr.isArrayBoundedLength(pair, 1, 3)) {
180
+ * assert.isTrue(pair.length >= 1 && pair.length <= 3);
181
+ * }
182
+ * ```
183
+ */
184
+ export const isArrayBoundedLength = <
185
+ E,
186
+ Min extends SizeType.ArgArr,
187
+ Max extends SizeType.ArgArr,
188
+ >(
189
+ array: readonly E[],
190
+ min: Min,
191
+ max: Max,
192
+ ): array is ArrayBoundedLen<Min, Max, E> =>
193
+ array.length >= min && array.length <= max;
194
+
139
195
  /**
140
196
  * Tests whether all elements in an array pass a test implemented by a predicate.
141
197
  *
@@ -1,10 +1,17 @@
1
- import { type ArrayAtLeastLen, type ArrayOfLength } from 'ts-type-forge';
1
+ import {
2
+ type ArrayAtLeastLen,
3
+ type ArrayAtMostLen,
4
+ type ArrayBoundedLen,
5
+ type ArrayOfLength,
6
+ } from 'ts-type-forge';
2
7
  import { expectType } from '../../expect-type.mjs';
3
8
  import {
4
9
  every,
5
10
  indexIsInRange,
6
11
  isArray,
7
12
  isArrayAtLeastLength,
13
+ isArrayAtMostLength,
14
+ isArrayBoundedLength,
8
15
  isArrayOfLength,
9
16
  isEmpty,
10
17
  isNonEmpty,
@@ -584,6 +591,158 @@ describe('Arr validations', () => {
584
591
  });
585
592
  });
586
593
 
594
+ describe(isArrayAtMostLength, () => {
595
+ test('should return true if array length is less than or equal to specified length', () => {
596
+ const arr = [1, 2, 3] as const;
597
+
598
+ assert.isTrue(isArrayAtMostLength(arr, 3));
599
+
600
+ if (isArrayAtMostLength(arr, 3)) {
601
+ expectType<typeof arr, readonly [1, 2, 3]>('=');
602
+ }
603
+
604
+ assert.isTrue(isArrayAtMostLength(arr, 4));
605
+
606
+ if (isArrayAtMostLength(arr, 4)) {
607
+ expectType<typeof arr, readonly [1, 2, 3]>('=');
608
+ }
609
+ });
610
+
611
+ test('should return false if array length is greater than specified length', () => {
612
+ const arr = [1, 2, 3] as const;
613
+
614
+ assert.isFalse(isArrayAtMostLength(arr, 2));
615
+ });
616
+
617
+ test('should return true for empty array and length 0', () => {
618
+ const arr = [] as const;
619
+
620
+ assert.isTrue(isArrayAtMostLength(arr, 0));
621
+
622
+ if (isArrayAtMostLength(arr, 0)) {
623
+ expectType<typeof arr, readonly []>('=');
624
+ }
625
+ });
626
+
627
+ test('should return false for non-empty array and length 0', () => {
628
+ const arr = [1] as const;
629
+
630
+ assert.isFalse(isArrayAtMostLength(arr, 0));
631
+ });
632
+
633
+ test('should work with unknown array type', () => {
634
+ const mut_arr: number[] = [1, 2];
635
+
636
+ assert.isTrue(isArrayAtMostLength(mut_arr, 2));
637
+
638
+ // transformer-ignore-next-line
639
+ expectType<typeof mut_arr, number[] & ArrayAtMostLen<2, number>>('=');
640
+
641
+ assert.isFalse(isArrayAtMostLength(mut_arr, 1));
642
+ });
643
+
644
+ test('should return true for arrays of at most specified length (additional)', () => {
645
+ assert.isTrue(isArrayAtMostLength([1, 2, 3], 3));
646
+
647
+ assert.isTrue(isArrayAtMostLength([1, 2, 3], 4));
648
+
649
+ assert.isTrue(isArrayAtMostLength([], 0));
650
+ });
651
+
652
+ test('should return false for arrays longer than specified length (additional)', () => {
653
+ assert.isFalse(isArrayAtMostLength([1, 2, 3], 2));
654
+
655
+ assert.isFalse(isArrayAtMostLength([1, 2, 3], 0));
656
+ });
657
+
658
+ test('should work as type guard for at most length (additional)', () => {
659
+ const array: readonly number[] = [1, 2] as const;
660
+
661
+ if (isArrayAtMostLength(array, 3)) {
662
+ expectType<typeof array, ArrayAtMostLen<3, number>>('=');
663
+
664
+ expect(array.length).toBeLessThanOrEqual(3);
665
+ }
666
+ });
667
+ });
668
+
669
+ describe(isArrayBoundedLength, () => {
670
+ test('should return true if array length is within the specified range', () => {
671
+ const arr = [1, 2, 3] as const;
672
+
673
+ assert.isTrue(isArrayBoundedLength(arr, 1, 3));
674
+
675
+ if (isArrayBoundedLength(arr, 1, 3)) {
676
+ expectType<typeof arr, readonly [1, 2, 3]>('=');
677
+ }
678
+
679
+ assert.isTrue(isArrayBoundedLength(arr, 3, 5));
680
+
681
+ if (isArrayBoundedLength(arr, 3, 5)) {
682
+ expectType<typeof arr, readonly [1, 2, 3]>('=');
683
+ }
684
+ });
685
+
686
+ test('should return false if array length is below the specified range', () => {
687
+ const arr = [1, 2, 3] as const;
688
+
689
+ assert.isFalse(isArrayBoundedLength(arr, 4, 5));
690
+ });
691
+
692
+ test('should return false if array length is above the specified range', () => {
693
+ const arr = [1, 2, 3] as const;
694
+
695
+ assert.isFalse(isArrayBoundedLength(arr, 0, 2));
696
+ });
697
+
698
+ test('should return true for empty array and range including 0', () => {
699
+ const arr = [] as const;
700
+
701
+ assert.isTrue(isArrayBoundedLength(arr, 0, 2));
702
+
703
+ if (isArrayBoundedLength(arr, 0, 2)) {
704
+ expectType<typeof arr, readonly []>('=');
705
+ }
706
+ });
707
+
708
+ test('should work with unknown array type', () => {
709
+ const mut_arr: number[] = [1, 2];
710
+
711
+ assert.isTrue(isArrayBoundedLength(mut_arr, 1, 3));
712
+
713
+ // transformer-ignore-next-line
714
+ expectType<typeof mut_arr, number[] & ArrayBoundedLen<1, 3, number>>('=');
715
+
716
+ assert.isFalse(isArrayBoundedLength(mut_arr, 3, 5));
717
+ });
718
+
719
+ test('should return true for arrays within specified range (additional)', () => {
720
+ assert.isTrue(isArrayBoundedLength([1, 2, 3], 1, 3));
721
+
722
+ assert.isTrue(isArrayBoundedLength([1, 2, 3], 3, 3));
723
+
724
+ assert.isTrue(isArrayBoundedLength([], 0, 0));
725
+ });
726
+
727
+ test('should return false for arrays outside specified range (additional)', () => {
728
+ assert.isFalse(isArrayBoundedLength([1, 2, 3], 4, 5));
729
+
730
+ assert.isFalse(isArrayBoundedLength([1, 2, 3], 0, 2));
731
+ });
732
+
733
+ test('should work as type guard for bounded length (additional)', () => {
734
+ const array: readonly number[] = [1, 2] as const;
735
+
736
+ if (isArrayBoundedLength(array, 1, 3)) {
737
+ expectType<typeof array, ArrayBoundedLen<1, 3, number>>('=');
738
+
739
+ expect(array.length).toBeGreaterThanOrEqual(1);
740
+
741
+ expect(array.length).toBeLessThanOrEqual(3);
742
+ }
743
+ });
744
+ });
745
+
587
746
  describe(every, () => {
588
747
  test('should return true when all elements satisfy predicate', () => {
589
748
  const evens = [2, 4, 6, 8] as const;
@@ -16,7 +16,7 @@ import { type Unwrap } from './types.mjs';
16
16
  * Optional.expectToBe(optionalValue, 'value expected') === 'data',
17
17
  * );
18
18
  *
19
- * const expectValue = Optional.expectToBe<string>('missing optional');
19
+ * const expectValue = Optional.expectToBe('missing optional');
20
20
  *
21
21
  * const throwTest = (): void => {
22
22
  * expectValue(Optional.none);
@@ -41,7 +41,7 @@ export function expectToBe<O extends UnknownOptional>(
41
41
  ): Unwrap<O>;
42
42
 
43
43
  // Curried version
44
- export function expectToBe<S>(message: string): (optional: Optional<S>) => S;
44
+ export function expectToBe(message: string): <O>(optional: Optional<O>) => O;
45
45
 
46
46
  export function expectToBe<O extends UnknownOptional>(
47
47
  ...args: readonly [optional: O, message: string] | readonly [message: string]
@@ -47,9 +47,9 @@ export function orElse<
47
47
  >(optional: O, alternative: O2): O | O2;
48
48
 
49
49
  // Curried version
50
- export function orElse<S, S2>(
51
- alternative: Optional<S2>,
52
- ): (optional: Optional<S>) => Optional<S> | Optional<S2>;
50
+ export function orElse<O2>(
51
+ alternative: Optional<O2>,
52
+ ): <O>(optional: Optional<O>) => Optional<O> | Optional<O2>;
53
53
 
54
54
  export function orElse<
55
55
  O extends UnknownOptional,
@@ -40,9 +40,9 @@ export function unwrapOr<O extends UnknownOptional, D>(
40
40
  ): D | Unwrap<O>;
41
41
 
42
42
  // Curried version
43
- export function unwrapOr<S, D>(
43
+ export function unwrapOr<D>(
44
44
  defaultValue: D,
45
- ): (optional: Optional<S>) => D | S;
45
+ ): <O>(optional: Optional<O>) => D | O;
46
46
 
47
47
  export function unwrapOr<O extends UnknownOptional, D>(
48
48
  ...args: readonly [optional: O, defaultValue: D] | readonly [defaultValue: D]
@@ -295,19 +295,19 @@ describe('Optional test', () => {
295
295
 
296
296
  describe('expectToBe', () => {
297
297
  test('should return the value for Some', () => {
298
- const expectNumber = Optional.expectToBe<number>('Expected a number');
298
+ const expectNumber = Optional.expectToBe('Expected a number');
299
299
 
300
300
  expect(expectNumber(Optional.some(42))).toBe(42);
301
301
  });
302
302
 
303
303
  test('should throw with custom message for None', () => {
304
- const expectNumber = Optional.expectToBe<number>('Expected a number');
304
+ const expectNumber = Optional.expectToBe('Expected a number');
305
305
 
306
306
  expect(() => expectNumber(Optional.none)).toThrow('Expected a number');
307
307
  });
308
308
 
309
309
  test('should be curried', () => {
310
- const expectValidId = Optional.expectToBe<string>('ID is required');
310
+ const expectValidId = Optional.expectToBe('ID is required');
311
311
 
312
312
  const id1 = Optional.some('user-123');
313
313
 
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { isOk } from './result-is-ok.mjs';
3
3
  import { unwrapOk } from './result-unwrap-ok.mjs';
4
4
  import { type UnwrapOk } from './types.mjs';
@@ -14,7 +14,7 @@ import { type UnwrapOk } from './types.mjs';
14
14
  *
15
15
  * assert.isTrue(Result.expectToBe(okValue, 'should have value') === 'data');
16
16
  *
17
- * const expectResult = Result.expectToBe<string>('missing result');
17
+ * const expectResult = Result.expectToBe('missing result');
18
18
  *
19
19
  * const throwTest = (): void => {
20
20
  * expectResult(Result.err('boom'));
@@ -37,7 +37,9 @@ export function expectToBe<R extends UnknownResult>(
37
37
  ): UnwrapOk<R>;
38
38
 
39
39
  // Curried version
40
- export function expectToBe<S>(message: string): <E>(result: Result<S, E>) => S;
40
+ export function expectToBe(
41
+ message: string,
42
+ ): <R extends UnknownResult>(result: R) => UnwrapOk<R>;
41
43
 
42
44
  export function expectToBe<R extends UnknownResult>(
43
45
  ...args: readonly [result: R, message: string] | readonly [message: string]
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { isOk } from './result-is-ok.mjs';
3
3
  import { type NarrowToOk } from './types.mjs';
4
4
 
@@ -43,9 +43,9 @@ export function orElse<R extends UnknownResult, R2 extends UnknownResult>(
43
43
  ): NarrowToOk<R> | R2;
44
44
 
45
45
  // Curried version
46
- export function orElse<S, E, S2, E2>(
47
- alternative: Result<S2, E2>,
48
- ): (result: Result<S, E>) => Result<S, E> | Result<S2, E2>;
46
+ export function orElse<R2 extends UnknownResult>(
47
+ alternative: R2,
48
+ ): <R extends UnknownResult>(result: R) => NarrowToOk<R> | R2;
49
49
 
50
50
  export function orElse<R extends UnknownResult, R2 extends UnknownResult>(
51
51
  ...args: readonly [result: R, alternative: R2] | readonly [alternative: R2]
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { unwrapErr } from './result-unwrap-err.mjs';
3
3
  import { type UnwrapErr } from './types.mjs';
4
4
 
@@ -38,7 +38,7 @@ export function unwrapErrOr<R extends UnknownResult, D>(
38
38
  // Curried version
39
39
  export function unwrapErrOr<D>(
40
40
  defaultValue: D,
41
- ): <S, E>(result: Result<S, E>) => D | E;
41
+ ): <R extends UnknownResult>(result: R) => D | UnwrapErr<R>;
42
42
 
43
43
  export function unwrapErrOr<R extends UnknownResult, D>(
44
44
  ...args: readonly [result: R, defaultValue: D] | readonly [defaultValue: D]
@@ -1,4 +1,4 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
1
+ import { type UnknownResult } from '../result.mjs';
2
2
  import { unwrapOk } from './result-unwrap-ok.mjs';
3
3
  import { type UnwrapOk } from './types.mjs';
4
4
 
@@ -36,9 +36,9 @@ export function unwrapOkOr<R extends UnknownResult, D>(
36
36
  ): D | UnwrapOk<R>;
37
37
 
38
38
  // Curried version
39
- export function unwrapOkOr<S, D>(
39
+ export function unwrapOkOr<D>(
40
40
  defaultValue: D,
41
- ): <E>(result: Result<S, E>) => D | S;
41
+ ): <R extends UnknownResult>(result: R) => D | UnwrapOk<R>;
42
42
 
43
43
  export function unwrapOkOr<R extends UnknownResult, D>(
44
44
  ...args: readonly [result: R, defaultValue: D] | readonly [defaultValue: D]
@@ -16,7 +16,7 @@ import { type UnwrapOk } from './types.mjs';
16
16
  *
17
17
  * assert.strictEqual(TernaryResult.expectToBe(okValue, 'missing'), 'ready');
18
18
  *
19
- * const expectResult = TernaryResult.expectToBe<string>('needs value');
19
+ * const expectResult = TernaryResult.expectToBe('needs value');
20
20
  *
21
21
  * const throwTest = (): void => {
22
22
  * expectResult(TernaryResult.err('oops'));
@@ -31,9 +31,9 @@ export function expectToBe<R extends UnknownTernaryResult>(
31
31
  ): UnwrapOk<R>;
32
32
 
33
33
  // Curried version
34
- export function expectToBe<S>(
34
+ export function expectToBe(
35
35
  message: string,
36
- ): <W, E>(result: TernaryResult<S, E, W>) => S;
36
+ ): <S, W, E>(result: TernaryResult<S, E, W>) => S;
37
37
 
38
38
  export function expectToBe<R extends UnknownTernaryResult>(
39
39
  ...args: readonly [result: R, message: string] | readonly [message: string]
@@ -1,7 +1,4 @@
1
- import {
2
- type TernaryResult,
3
- type UnknownTernaryResult,
4
- } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
5
2
  import { isOk } from './ternary-result-is-ok.mjs';
6
3
  import { isWarn } from './ternary-result-is-warn.mjs';
7
4
  import { type NarrowToOk, type NarrowToWarn } from './types.mjs';
@@ -36,11 +33,11 @@ export function orElse<
36
33
  >(result: R, alternative: R2): NarrowToOk<R> | NarrowToWarn<R> | R2;
37
34
 
38
35
  // Curried version
39
- export function orElse<S, W, E, S2, W2, E2>(
40
- alternative: TernaryResult<S2, E2, W2>,
41
- ): (
42
- result: TernaryResult<S, E, W>,
43
- ) => TernaryResult<S, E, W> | TernaryResult<S2, E2, W2>;
36
+ export function orElse<R2 extends UnknownTernaryResult>(
37
+ alternative: R2,
38
+ ): <R extends UnknownTernaryResult>(
39
+ result: R,
40
+ ) => NarrowToOk<R> | NarrowToWarn<R> | R2;
44
41
 
45
42
  export function orElse<
46
43
  R extends UnknownTernaryResult,
@@ -1,7 +1,4 @@
1
- import {
2
- type TernaryResult,
3
- type UnknownTernaryResult,
4
- } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
5
2
  import { unwrapErr } from './ternary-result-unwrap-err.mjs';
6
3
  import { type UnwrapErr } from './types.mjs';
7
4
 
@@ -34,9 +31,9 @@ export function unwrapErrOr<R extends UnknownTernaryResult, D>(
34
31
  ): D | UnwrapErr<R>;
35
32
 
36
33
  // Curried version
37
- export function unwrapErrOr<E, D>(
34
+ export function unwrapErrOr<D>(
38
35
  defaultValue: D,
39
- ): <S, W>(result: TernaryResult<S, E, W>) => D | E;
36
+ ): <R extends UnknownTernaryResult>(result: R) => D | UnwrapErr<R>;
40
37
 
41
38
  export function unwrapErrOr<R extends UnknownTernaryResult, D>(
42
39
  ...args: readonly [result: R, defaultValue: D] | readonly [defaultValue: D]
@@ -1,7 +1,4 @@
1
- import {
2
- type TernaryResult,
3
- type UnknownTernaryResult,
4
- } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
5
2
  import { unwrapOk } from './ternary-result-unwrap-ok.mjs';
6
3
  import { type UnwrapOk } from './types.mjs';
7
4
 
@@ -31,9 +28,9 @@ export function unwrapOkOr<R extends UnknownTernaryResult, D>(
31
28
  ): D | UnwrapOk<R>;
32
29
 
33
30
  // Curried version
34
- export function unwrapOkOr<S, D>(
31
+ export function unwrapOkOr<D>(
35
32
  defaultValue: D,
36
- ): <W, E>(result: TernaryResult<S, E, W>) => D | S;
33
+ ): <R extends UnknownTernaryResult>(result: R) => D | UnwrapOk<R>;
37
34
 
38
35
  export function unwrapOkOr<R extends UnknownTernaryResult, D>(
39
36
  ...args: readonly [result: R, defaultValue: D] | readonly [defaultValue: D]
@@ -1,7 +1,4 @@
1
- import {
2
- type TernaryResult,
3
- type UnknownTernaryResult,
4
- } from '../ternary-result.mjs';
1
+ import { type UnknownTernaryResult } from '../ternary-result.mjs';
5
2
  import { unwrapWarn } from './ternary-result-unwrap-warn.mjs';
6
3
  import { type UnwrapWarn } from './types.mjs';
7
4
 
@@ -28,9 +25,9 @@ export function unwrapWarnOr<R extends UnknownTernaryResult, D>(
28
25
  ): D | UnwrapWarn<R>;
29
26
 
30
27
  // Curried version
31
- export function unwrapWarnOr<W, D>(
28
+ export function unwrapWarnOr<D>(
32
29
  defaultValue: D,
33
- ): <S, E>(result: TernaryResult<S, E, W>) => D | W;
30
+ ): <R extends UnknownTernaryResult>(result: R) => D | UnwrapWarn<R>;
34
31
 
35
32
  export function unwrapWarnOr<R extends UnknownTernaryResult, D>(
36
33
  ...args: readonly [result: R, defaultValue: D] | readonly [defaultValue: D]