ts-data-forge 7.1.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/dist/guard/is-non-null-object.d.mts +3 -3
- package/dist/guard/is-non-null-object.mjs +3 -3
- package/dist/guard/is-record.d.mts +47 -29
- package/dist/guard/is-record.d.mts.map +1 -1
- package/dist/guard/is-record.mjs +48 -30
- package/dist/guard/is-record.mjs.map +1 -1
- package/dist/others/fast-deep-equal.d.mts.map +1 -1
- package/dist/others/fast-deep-equal.mjs +7 -5
- package/dist/others/fast-deep-equal.mjs.map +1 -1
- package/package.json +4 -4
- 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
- package/src/guard/is-non-null-object.mts +3 -3
- package/src/guard/is-record.mts +49 -30
- package/src/guard/is-record.test.mts +133 -61
- package/src/others/fast-deep-equal.mts +10 -8
|
@@ -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,E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=== '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;;;;"}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* - Excludes functions (they have `typeof` === `"function"`, not `"object"`)
|
|
14
14
|
* - Includes arrays, dates, regex, and other object instances
|
|
15
15
|
*
|
|
16
|
-
* **Note:** This function returns `true` for arrays. If you need
|
|
17
|
-
*
|
|
16
|
+
* **Note:** This function returns `true` for arrays. If you need
|
|
17
|
+
* record-oriented narrowing that excludes arrays, use `isRecord()` instead.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
*
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* @param u - The value to check
|
|
30
30
|
* @returns `true` if `u` is an object and not `null`, `false` otherwise. When
|
|
31
31
|
* `true`, TypeScript narrows the type to `object`.
|
|
32
|
-
* @see {@link isRecord} - For
|
|
32
|
+
* @see {@link isRecord} - For record-oriented type narrowing (excludes arrays)
|
|
33
33
|
*/
|
|
34
34
|
export declare const isNonNullObject: (u: unknown) => u is object;
|
|
35
35
|
//# sourceMappingURL=is-non-null-object.d.mts.map
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* - Excludes functions (they have `typeof` === `"function"`, not `"object"`)
|
|
14
14
|
* - Includes arrays, dates, regex, and other object instances
|
|
15
15
|
*
|
|
16
|
-
* **Note:** This function returns `true` for arrays. If you need
|
|
17
|
-
*
|
|
16
|
+
* **Note:** This function returns `true` for arrays. If you need
|
|
17
|
+
* record-oriented narrowing that excludes arrays, use `isRecord()` instead.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
*
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* @param u - The value to check
|
|
30
30
|
* @returns `true` if `u` is an object and not `null`, `false` otherwise. When
|
|
31
31
|
* `true`, TypeScript narrows the type to `object`.
|
|
32
|
-
* @see {@link isRecord} - For
|
|
32
|
+
* @see {@link isRecord} - For record-oriented type narrowing (excludes arrays)
|
|
33
33
|
*/
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
|
35
35
|
const isNonNullObject = (u) => typeof u === 'object' && u !== null;
|
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
import { type MutableRecord, type UnknownRecord } from 'ts-type-forge';
|
|
2
2
|
/**
|
|
3
|
-
* Type guard that checks if a value is a
|
|
4
|
-
* object
|
|
3
|
+
* Type guard that checks if a value is a record — a non-null, non-array
|
|
4
|
+
* object — and narrows it to `UnknownRecord` (= `ReadonlyRecord<string,
|
|
5
|
+
* unknown>`).
|
|
5
6
|
*
|
|
6
|
-
* This function is
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* types like Date, RegExp, etc., focusing on objects that can be safely treated
|
|
10
|
-
* as property collections.
|
|
7
|
+
* This function is designed to be combined with {@link hasKey} to probe
|
|
8
|
+
* values of type `unknown` (e.g. parsed JSON, caught errors, external data)
|
|
9
|
+
* in a type-safe way: `if (isRecord(u) && hasKey(u, 'some-key')) { ... }`.
|
|
11
10
|
*
|
|
12
11
|
* **Type Narrowing Behavior:**
|
|
13
12
|
*
|
|
14
|
-
* - Narrows `unknown` to `UnknownRecord` (
|
|
15
|
-
*
|
|
16
|
-
* - Excludes
|
|
17
|
-
*
|
|
18
|
-
* with
|
|
19
|
-
* - Returns `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
13
|
+
* - Narrows `unknown` to `UnknownRecord` (= `ReadonlyRecord<string, unknown>`)
|
|
14
|
+
* - Excludes `null`, `undefined`, primitives, and functions
|
|
15
|
+
* - Excludes arrays: arrays have no string index signature, so they are not
|
|
16
|
+
* assignable to `UnknownRecord`; admitting them at runtime would be
|
|
17
|
+
* inconsistent with the narrowed type
|
|
18
|
+
* - Returns `true` for every other non-null object, including dictionary
|
|
19
|
+
* objects created with `Object.create(null)` and instances such as `Date`,
|
|
20
|
+
* `RegExp`, `Map`, `Set`, `Error`, and user-defined classes
|
|
21
|
+
*
|
|
22
|
+
* **Why non-plain objects are included:** since every property of
|
|
23
|
+
* `UnknownRecord` is typed `unknown`, reading properties from any object
|
|
24
|
+
* through this narrowing is type-safe, and `hasKey` (backed by
|
|
25
|
+
* `Object.hasOwn`) answers own-property questions correctly on any object
|
|
26
|
+
* (e.g. `Map` entries are not own properties, so `hasKey` correctly returns
|
|
27
|
+
* `false` for them). Restricting the guard to plain objects would require
|
|
28
|
+
* prototype checks that misjudge cross-realm objects and would prevent
|
|
29
|
+
* probing useful instances such as `Error` subclasses.
|
|
30
|
+
*
|
|
31
|
+
* **Implementation:** `isNonNullObject(u) && !Array.isArray(u)`.
|
|
23
32
|
*
|
|
24
33
|
* @example
|
|
25
34
|
*
|
|
26
35
|
* ```ts
|
|
27
|
-
* const entries: readonly unknown[] = [
|
|
36
|
+
* const entries: readonly unknown[] = [
|
|
37
|
+
* { id: 1 },
|
|
38
|
+
* [1, 2],
|
|
39
|
+
* 'str',
|
|
40
|
+
* 0,
|
|
41
|
+
* null,
|
|
42
|
+
* ] as const;
|
|
28
43
|
*
|
|
29
44
|
* const records = entries.filter(isRecord);
|
|
30
45
|
*
|
|
@@ -32,29 +47,31 @@ import { type MutableRecord, type UnknownRecord } from 'ts-type-forge';
|
|
|
32
47
|
* ```
|
|
33
48
|
*
|
|
34
49
|
* @param u - The value to check
|
|
35
|
-
* @returns `true` if `u` is a non-null object
|
|
36
|
-
*
|
|
37
|
-
* @see {@link isNonNullObject} - For checking any object
|
|
50
|
+
* @returns `true` if `u` is a non-null, non-array object, `false` otherwise.
|
|
51
|
+
* When `true`, TypeScript narrows the type to `UnknownRecord`.
|
|
52
|
+
* @see {@link isNonNullObject} - For checking any non-null object (includes arrays)
|
|
38
53
|
* @see {@link hasKey} - For checking if a record has specific keys
|
|
39
54
|
*/
|
|
40
55
|
export declare const isRecord: (u: unknown) => u is UnknownRecord;
|
|
41
56
|
/**
|
|
42
|
-
* Type guard that checks if a value is a mutable record
|
|
57
|
+
* Type guard that checks if a value is a mutable record.
|
|
43
58
|
*
|
|
44
|
-
* This function
|
|
45
|
-
*
|
|
46
|
-
*
|
|
59
|
+
* This function has the same runtime behavior as {@link isRecord} (non-null,
|
|
60
|
+
* non-array object check), but narrows the type to `MutableRecord<string,
|
|
61
|
+
* unknown>`, which is useful when you need to add or overwrite properties on
|
|
62
|
+
* the narrowed object.
|
|
47
63
|
*
|
|
48
64
|
* **Type Narrowing Behavior:**
|
|
49
65
|
*
|
|
50
66
|
* - Narrows `unknown` to `MutableRecord<string, unknown>`
|
|
51
|
-
* - Excludes `null`, `undefined`, primitives,
|
|
52
|
-
* - Returns `true` for
|
|
53
|
-
* -
|
|
67
|
+
* - Excludes `null`, `undefined`, primitives, functions, and arrays
|
|
68
|
+
* - Returns `true` for every other non-null object (see {@link isRecord} for
|
|
69
|
+
* details on non-plain objects such as `Date`, `Map`, and `Set`)
|
|
54
70
|
*
|
|
55
71
|
* **Implementation:** This is a type alias for {@link isRecord}.
|
|
56
72
|
*
|
|
57
73
|
* @example
|
|
74
|
+
*
|
|
58
75
|
* ```ts
|
|
59
76
|
* const obj: unknown = { foo: 1 } as const;
|
|
60
77
|
*
|
|
@@ -64,8 +81,9 @@ export declare const isRecord: (u: unknown) => u is UnknownRecord;
|
|
|
64
81
|
* ```
|
|
65
82
|
*
|
|
66
83
|
* @param u - The value to check
|
|
67
|
-
* @returns `true` if `u` is a
|
|
68
|
-
* When `true`, TypeScript narrows the type to `MutableRecord<string,
|
|
84
|
+
* @returns `true` if `u` is a non-null, non-array object, `false` otherwise.
|
|
85
|
+
* When `true`, TypeScript narrows the type to `MutableRecord<string,
|
|
86
|
+
* unknown>`.
|
|
69
87
|
* @see {@link isRecord} - For the underlying implementation and more details
|
|
70
88
|
*/
|
|
71
89
|
export declare const isMutableRecord: (u: unknown) => u is MutableRecord<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-record.d.mts","sourceRoot":"","sources":["../../src/guard/is-record.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGvE
|
|
1
|
+
{"version":3,"file":"is-record.d.mts","sourceRoot":"","sources":["../../src/guard/is-record.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,aACF,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,eAAe,EAAE,CAC5B,CAAC,EAAE,OAAO,KACP,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,OAAO,CAAY,CAAC"}
|