ts-data-forge 7.1.0 → 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.
- package/dist/array/impl/array-utils-creation.d.mts +2 -2
- package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts +2 -2
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-or-else.d.mts +1 -1
- package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.d.mts +3 -3
- package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
- package/dist/functional/result/impl/result-or-else.d.mts +2 -2
- package/dist/functional/result/impl/result-or-else.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts +2 -2
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +2 -2
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +2 -2
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +2 -2
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +2 -2
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +2 -2
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +2 -2
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
- package/package.json +1 -1
- package/src/array/impl/array-utils-creation.mts +1 -1
- package/src/array/impl/array-utils-transformation.mts +1 -1
- package/src/functional/optional/impl/optional-expect-to-be.mts +2 -2
- package/src/functional/optional/impl/optional-or-else.mts +3 -3
- package/src/functional/optional/impl/optional-unwrap-or.mts +2 -2
- package/src/functional/optional.test.mts +3 -3
- package/src/functional/result/impl/result-expect-to-be.mts +5 -3
- package/src/functional/result/impl/result-or-else.mts +4 -4
- package/src/functional/result/impl/result-unwrap-err-or.mts +2 -2
- package/src/functional/result/impl/result-unwrap-ok-or.mts +3 -3
- package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +3 -3
- package/src/functional/ternary-result/impl/ternary-result-or-else.mts +6 -9
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +3 -6
- package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +3 -6
- 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: <
|
|
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: <
|
|
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;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,EAC7C,KAAK,CAAC,KACL,CAAC,SAAS,SAAS,GAClB,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,CAAC,SAAS,QAAQ,CAAC,cAAc,GAC/B,aAAa,CAAC,CAAC,CAAC,GAChB,SAAS,CAAC,EAE+B,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,EAC3C,KAAK,CAAC,KACL,CAAC,SAAS,SAAS,GAClB,GAAG,CAAC,CAAC,CAAC,GACN,CAAC,SAAS,QAAQ,CAAC,cAAc,GAC/B,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,GAC3B,SAAS,QAAQ,CAAC,GAAG,EAEwB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,GAAI,
|
|
1
|
+
{"version":3,"file":"array-utils-creation.d.mts","sourceRoot":"","sources":["../../../src/array/impl/array-utils-creation.mts"],"names":[],"mappings":"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"}
|
|
@@ -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
|
|
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
|
|
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,
|
|
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<
|
|
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,
|
|
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<
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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":";;;
|
|
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
|
|
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<
|
|
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,
|
|
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
|
|
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): <
|
|
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,
|
|
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
|
|
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<
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
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<
|
|
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,
|
|
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":";;;
|
|
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
|
|
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<
|
|
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,
|
|
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":";;
|
|
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
|
|
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<
|
|
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,
|
|
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":";;
|
|
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
|
|
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<
|
|
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,
|
|
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":";;
|
|
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
|
@@ -85,7 +85,7 @@ export const seq = <N extends SizeType.ArgArr>(
|
|
|
85
85
|
* assert.deepStrictEqual(emptyStrings, []);
|
|
86
86
|
* ```
|
|
87
87
|
*/
|
|
88
|
-
export const create = <
|
|
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<
|
|
146
|
+
newArray<PositiveUint32, S>(asPositiveUint32(array.length + 1), init),
|
|
147
147
|
);
|
|
148
148
|
|
|
149
149
|
let mut_acc = init;
|
|
@@ -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
|
|
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
|
|
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<
|
|
51
|
-
alternative: Optional<
|
|
52
|
-
): (optional: Optional<
|
|
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<
|
|
43
|
+
export function unwrapOr<D>(
|
|
44
44
|
defaultValue: D,
|
|
45
|
-
): (optional: Optional<
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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<
|
|
47
|
-
alternative:
|
|
48
|
-
): (result:
|
|
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
|
|
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
|
-
): <
|
|
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
|
|
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<
|
|
39
|
+
export function unwrapOkOr<D>(
|
|
40
40
|
defaultValue: D,
|
|
41
|
-
): <
|
|
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
|
|
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
|
|
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<
|
|
40
|
-
alternative:
|
|
41
|
-
): (
|
|
42
|
-
result:
|
|
43
|
-
) =>
|
|
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<
|
|
34
|
+
export function unwrapErrOr<D>(
|
|
38
35
|
defaultValue: D,
|
|
39
|
-
): <
|
|
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<
|
|
31
|
+
export function unwrapOkOr<D>(
|
|
35
32
|
defaultValue: D,
|
|
36
|
-
): <
|
|
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<
|
|
28
|
+
export function unwrapWarnOr<D>(
|
|
32
29
|
defaultValue: D,
|
|
33
|
-
): <
|
|
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]
|