@resultsafe/core-fp-result 0.1.10 → 0.2.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/README.md +355 -305
- package/cjs/constructors/Err.js.map +1 -1
- package/cjs/constructors/Ok.js.map +1 -1
- package/cjs/guards/isErr.js.map +1 -1
- package/cjs/guards/isErrAnd.js.map +1 -1
- package/cjs/guards/isOk.js.map +1 -1
- package/cjs/guards/isOkAnd.js.map +1 -1
- package/cjs/methods/andThen.js.map +1 -1
- package/cjs/methods/err.js.map +1 -1
- package/cjs/methods/expect.js.map +1 -1
- package/cjs/methods/expectErr.js.map +1 -1
- package/cjs/methods/flatten.js.map +1 -1
- package/cjs/methods/inspect.js.map +1 -1
- package/cjs/methods/inspectErr.js.map +1 -1
- package/cjs/methods/map.js.map +1 -1
- package/cjs/methods/mapErr.js.map +1 -1
- package/cjs/methods/match.js.map +1 -1
- package/cjs/methods/ok.js.map +1 -1
- package/cjs/methods/orElse.js.map +1 -1
- package/cjs/methods/tap.js.map +1 -1
- package/cjs/methods/tapErr.js.map +1 -1
- package/cjs/methods/transpose.js.map +1 -1
- package/cjs/methods/unwrap.js.map +1 -1
- package/cjs/methods/unwrapErr.js.map +1 -1
- package/cjs/methods/unwrapOr.js.map +1 -1
- package/cjs/methods/unwrapOrElse.js.map +1 -1
- package/cjs/refiners/isTypedVariant.js.map +1 -1
- package/cjs/refiners/isTypedVariantOf.js.map +1 -1
- package/cjs/refiners/matchVariant.js.map +1 -1
- package/cjs/refiners/matchVariantStrict.js.map +1 -1
- package/cjs/refiners/refineAsyncResult.js.map +1 -1
- package/cjs/refiners/refineAsyncResultU.js.map +1 -1
- package/cjs/refiners/refineResult.js.map +1 -1
- package/cjs/refiners/refineResultU.js.map +1 -1
- package/cjs/refiners/refineVariantMap.js.map +1 -1
- package/cjs/refiners/utils/getPayloadKeys.js.map +1 -1
- package/docs/assets/logo.svg +0 -0
- package/esm/constructors/Err.js.map +1 -1
- package/esm/constructors/Ok.js.map +1 -1
- package/esm/guards/isErr.js.map +1 -1
- package/esm/guards/isErrAnd.js.map +1 -1
- package/esm/guards/isOk.js.map +1 -1
- package/esm/guards/isOkAnd.js.map +1 -1
- package/esm/methods/andThen.js.map +1 -1
- package/esm/methods/err.js.map +1 -1
- package/esm/methods/expect.js.map +1 -1
- package/esm/methods/expectErr.js.map +1 -1
- package/esm/methods/flatten.js.map +1 -1
- package/esm/methods/inspect.js.map +1 -1
- package/esm/methods/inspectErr.js.map +1 -1
- package/esm/methods/map.js.map +1 -1
- package/esm/methods/mapErr.js.map +1 -1
- package/esm/methods/match.js.map +1 -1
- package/esm/methods/ok.js.map +1 -1
- package/esm/methods/orElse.js.map +1 -1
- package/esm/methods/tap.js.map +1 -1
- package/esm/methods/tapErr.js.map +1 -1
- package/esm/methods/transpose.js.map +1 -1
- package/esm/methods/unwrap.js.map +1 -1
- package/esm/methods/unwrapErr.js.map +1 -1
- package/esm/methods/unwrapOr.js.map +1 -1
- package/esm/methods/unwrapOrElse.js.map +1 -1
- package/esm/refiners/isTypedVariant.js.map +1 -1
- package/esm/refiners/isTypedVariantOf.js.map +1 -1
- package/esm/refiners/matchVariant.js.map +1 -1
- package/esm/refiners/matchVariantStrict.js.map +1 -1
- package/esm/refiners/refineAsyncResult.js.map +1 -1
- package/esm/refiners/refineAsyncResultU.js.map +1 -1
- package/esm/refiners/refineResult.js.map +1 -1
- package/esm/refiners/refineResultU.js.map +1 -1
- package/esm/refiners/refineVariantMap.js.map +1 -1
- package/esm/refiners/utils/getPayloadKeys.js.map +1 -1
- package/package.json +1 -1
- package/types/constructors/Err.d.ts +4 -4
- package/types/constructors/Err.d.ts.map +1 -1
- package/types/constructors/Ok.d.ts +4 -4
- package/types/constructors/Ok.d.ts.map +1 -1
- package/types/guards/isErr.d.ts +5 -5
- package/types/guards/isErr.d.ts.map +1 -1
- package/types/guards/isErrAnd.d.ts +6 -6
- package/types/guards/isErrAnd.d.ts.map +1 -1
- package/types/guards/isOk.d.ts +5 -5
- package/types/guards/isOk.d.ts.map +1 -1
- package/types/guards/isOkAnd.d.ts +6 -6
- package/types/guards/isOkAnd.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/methods/andThen.d.ts +7 -7
- package/types/methods/andThen.d.ts.map +1 -1
- package/types/methods/err.d.ts +7 -8
- package/types/methods/err.d.ts.map +1 -1
- package/types/methods/expect.d.ts +9 -9
- package/types/methods/expect.d.ts.map +1 -1
- package/types/methods/expectErr.d.ts +9 -9
- package/types/methods/expectErr.d.ts.map +1 -1
- package/types/methods/flatten.d.ts +3 -3
- package/types/methods/flatten.d.ts.map +1 -1
- package/types/methods/inspect.d.ts +8 -8
- package/types/methods/inspect.d.ts.map +1 -1
- package/types/methods/inspectErr.d.ts +8 -8
- package/types/methods/inspectErr.d.ts.map +1 -1
- package/types/methods/map.d.ts +9 -9
- package/types/methods/map.d.ts.map +1 -1
- package/types/methods/mapErr.d.ts +8 -8
- package/types/methods/mapErr.d.ts.map +1 -1
- package/types/methods/match.d.ts +8 -8
- package/types/methods/match.d.ts.map +1 -1
- package/types/methods/ok.d.ts +7 -8
- package/types/methods/ok.d.ts.map +1 -1
- package/types/methods/orElse.d.ts +9 -9
- package/types/methods/orElse.d.ts.map +1 -1
- package/types/methods/tap.d.ts +7 -7
- package/types/methods/tap.d.ts.map +1 -1
- package/types/methods/tapErr.d.ts +7 -7
- package/types/methods/tapErr.d.ts.map +1 -1
- package/types/methods/transpose.d.ts +5 -6
- package/types/methods/transpose.d.ts.map +1 -1
- package/types/methods/unwrap.d.ts +8 -8
- package/types/methods/unwrap.d.ts.map +1 -1
- package/types/methods/unwrapErr.d.ts +8 -8
- package/types/methods/unwrapErr.d.ts.map +1 -1
- package/types/methods/unwrapOr.d.ts +8 -8
- package/types/methods/unwrapOr.d.ts.map +1 -1
- package/types/methods/unwrapOrElse.d.ts +8 -8
- package/types/methods/unwrapOrElse.d.ts.map +1 -1
- package/types/refiners/isTypedVariant.d.ts +3 -3
- package/types/refiners/isTypedVariantOf.d.ts +3 -3
- package/types/refiners/matchVariant.d.ts +5 -5
- package/types/refiners/matchVariantStrict.d.ts +6 -6
- package/types/refiners/refineAsyncResult.d.ts +17 -15
- package/types/refiners/refineAsyncResult.d.ts.map +1 -1
- package/types/refiners/refineAsyncResultU.d.ts +13 -11
- package/types/refiners/refineAsyncResultU.d.ts.map +1 -1
- package/types/refiners/refineResult.d.ts +18 -16
- package/types/refiners/refineResult.d.ts.map +1 -1
- package/types/refiners/refineResultU.d.ts +13 -11
- package/types/refiners/refineResultU.d.ts.map +1 -1
- package/types/refiners/refineVariantMap.d.ts +8 -8
- package/types/refiners/refineVariantMap.d.ts.map +1 -1
- package/types/refiners/types/Handler.d.ts +9 -1
- package/types/refiners/types/Handler.d.ts.map +1 -1
- package/types/refiners/types/MatchBuilder.d.ts +20 -1
- package/types/refiners/types/MatchBuilder.d.ts.map +1 -1
- package/types/refiners/types/Matcher.d.ts +23 -1
- package/types/refiners/types/Matcher.d.ts.map +1 -1
- package/types/refiners/types/SyncRefinedResult.d.ts +26 -2
- package/types/refiners/types/SyncRefinedResult.d.ts.map +1 -1
- package/types/refiners/types/SyncRefinedResultUnion.d.ts +25 -2
- package/types/refiners/types/SyncRefinedResultUnion.d.ts.map +1 -1
- package/types/refiners/types/SyncValidatorMap.d.ts +26 -2
- package/types/refiners/types/SyncValidatorMap.d.ts.map +1 -1
- package/types/refiners/types/UniversalAsyncRefinedResult.d.ts +28 -2
- package/types/refiners/types/UniversalAsyncRefinedResult.d.ts.map +1 -1
- package/types/refiners/types/UniversalRefinedResult.d.ts +28 -2
- package/types/refiners/types/UniversalRefinedResult.d.ts.map +1 -1
- package/types/refiners/types/VariantOf.d.ts +20 -1
- package/types/refiners/types/VariantOf.d.ts.map +1 -1
- package/types/refiners/utils/getPayloadKeys.d.ts +6 -5
- package/types/refiners/utils/getPayloadKeys.d.ts.map +1 -1
- package/types/types/core/index.d.ts +3 -0
- package/types/types/core/index.d.ts.map +1 -0
- package/types/types/index.d.ts +1 -2
- package/types/types/index.d.ts.map +1 -1
- package/umd/resultsafe-monorepo-core-fp-result.umd.js.map +1 -1
- package/types/shared-types.d.ts +0 -22
- package/types/shared-types.d.ts.map +0 -1
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Chains a computation that returns another `Result`.
|
|
4
4
|
*
|
|
5
5
|
* @typeParam T - The input success type.
|
|
6
6
|
* @typeParam U - The output success type.
|
|
7
|
-
* @typeParam E -
|
|
8
|
-
* @param result -
|
|
9
|
-
* @param fn -
|
|
10
|
-
* @returns
|
|
7
|
+
* @typeParam E - The shared error type.
|
|
8
|
+
* @param result - The source `Result`.
|
|
9
|
+
* @param fn - The function applied when `result` is `Ok`.
|
|
10
|
+
* @returns The transformed `Result` or the original `Err`.
|
|
11
11
|
* @since 0.1.0
|
|
12
|
-
* @see {@link map} -
|
|
12
|
+
* @see {@link map} - Transforms only the success value.
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { Ok, Err, andThen } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"andThen.d.ts","sourceRoot":"","sources":["../../../src/methods/andThen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"andThen.d.ts","sourceRoot":"","sources":["../../../src/methods/andThen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAC7B,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAC7B,MAAM,CAAC,CAAC,EAAE,CAAC,CAAiE,CAAC"}
|
package/types/methods/err.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { type Option } from '../
|
|
2
|
-
import { type Result } from '../shared-types.js';
|
|
1
|
+
import { type Option, type Result } from '../types/core/index.js';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Extracts the error branch as an `Option`.
|
|
5
4
|
*
|
|
6
|
-
* @typeParam T -
|
|
7
|
-
* @typeParam E -
|
|
8
|
-
* @param result -
|
|
9
|
-
* @returns `Some(error)`
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @returns `Some(error)` for `Err`, otherwise `None`.
|
|
10
9
|
* @since 0.1.0
|
|
11
|
-
* @see {@link ok} -
|
|
10
|
+
* @see {@link ok} - Extracts the success branch.
|
|
12
11
|
* @example
|
|
13
12
|
* ```ts
|
|
14
13
|
* import { Err, err } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"err.d.ts","sourceRoot":"","sources":["../../../src/methods/err.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"err.d.ts","sourceRoot":"","sources":["../../../src/methods/err.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CACd,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Returns the success value or throws an exception with a custom message.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param msg -
|
|
9
|
-
* @returns
|
|
10
|
-
* @throws Error -
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param msg - The error message used when `result` is `Err`.
|
|
9
|
+
* @returns The unwrapped success value.
|
|
10
|
+
* @throws Error - Throws an exception when `result` is `Err`.
|
|
11
11
|
* @since 0.1.0
|
|
12
|
-
* @see {@link expectErr} -
|
|
12
|
+
* @see {@link expectErr} - Symmetric helper for the error branch.
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { Ok, expect } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../src/methods/expect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../src/methods/expect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,MAAM,KAAG,CAKhE,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Returns the error value or throws an exception with a custom message.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param msg -
|
|
9
|
-
* @returns
|
|
10
|
-
* @throws Error -
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param msg - The error message used when `result` is `Ok`.
|
|
9
|
+
* @returns The unwrapped error value.
|
|
10
|
+
* @throws Error - Throws an exception when `result` is `Ok`.
|
|
11
11
|
* @since 0.1.0
|
|
12
|
-
* @see {@link expect} -
|
|
12
|
+
* @see {@link expect} - Symmetric helper for the success branch.
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { Err, expectErr } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectErr.d.ts","sourceRoot":"","sources":["../../../src/methods/expectErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"expectErr.d.ts","sourceRoot":"","sources":["../../../src/methods/expectErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,MAAM,KAAG,CAKnE,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Collapses a nested `Result<Result<T, E>, E>` one level.
|
|
4
4
|
*
|
|
5
5
|
* @typeParam T - The inner success value type.
|
|
6
6
|
* @typeParam E - The shared error value type.
|
|
7
|
-
* @param result -
|
|
7
|
+
* @param result - The nested `Result` to collapse.
|
|
8
8
|
* @returns A single-layer `Result<T, E>`.
|
|
9
9
|
* @since 0.1.0
|
|
10
10
|
* @see {@link andThen} - Chains computations that already return `Result`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/methods/flatten.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/methods/flatten.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CACZ,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Performs a side effect for the success value and returns the original `Result`.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param fn -
|
|
9
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param fn - The side effect function for the success branch.
|
|
9
|
+
* @returns The same `Result` instance.
|
|
10
10
|
* @since 0.1.0
|
|
11
|
-
* @see {@link tap} -
|
|
11
|
+
* @see {@link tap} - Equivalent helper for the success branch.
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { Ok, inspect } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../src/methods/inspect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../src/methods/inspect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,CAAC,EAC1B,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KACrB,MAAM,CAAC,CAAC,EAAE,CAAC,CAKb,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Performs a side effect for the error value and returns the original `Result`.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param fn -
|
|
9
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param fn - The side effect function for the error branch.
|
|
9
|
+
* @returns The same `Result` instance.
|
|
10
10
|
* @since 0.1.0
|
|
11
|
-
* @see {@link tapErr} -
|
|
11
|
+
* @see {@link tapErr} - Equivalent helper for the error branch.
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { Err, inspectErr } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspectErr.d.ts","sourceRoot":"","sources":["../../../src/methods/inspectErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inspectErr.d.ts","sourceRoot":"","sources":["../../../src/methods/inspectErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,CAAC,EAC7B,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KACrB,MAAM,CAAC,CAAC,EAAE,CAAC,CAKb,CAAC"}
|
package/types/methods/map.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Transforms the success value while preserving the error branch.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam U -
|
|
7
|
-
* @typeParam E -
|
|
8
|
-
* @param result -
|
|
9
|
-
* @param fn -
|
|
10
|
-
* @returns
|
|
5
|
+
* @typeParam T - The input success value type.
|
|
6
|
+
* @typeParam U - The output success value type.
|
|
7
|
+
* @typeParam E - The error value type.
|
|
8
|
+
* @param result - The source `Result`.
|
|
9
|
+
* @param fn - The transformation function for the success value.
|
|
10
|
+
* @returns The transformed `Ok` or the original `Err`.
|
|
11
11
|
* @since 0.1.0
|
|
12
|
-
* @see {@link mapErr} -
|
|
12
|
+
* @see {@link mapErr} - Transforms the error branch.
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { Ok, map } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/methods/map.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/methods/map.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EACzB,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KAClB,MAAM,CAAC,CAAC,EAAE,CAAC,CAGgB,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Transforms the error value while preserving the success branch.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @typeParam F -
|
|
8
|
-
* @param result -
|
|
9
|
-
* @param fn -
|
|
10
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The input error value type.
|
|
7
|
+
* @typeParam F - The output error value type.
|
|
8
|
+
* @param result - The source `Result`.
|
|
9
|
+
* @param fn - The transformation function for the error value.
|
|
10
|
+
* @returns The transformed `Err` or the original `Ok`.
|
|
11
11
|
* @since 0.1.0
|
|
12
12
|
* @see {@link map} - Transforms the success branch.
|
|
13
13
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapErr.d.ts","sourceRoot":"","sources":["../../../src/methods/mapErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mapErr.d.ts","sourceRoot":"","sources":["../../../src/methods/mapErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAC5B,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KAClB,MAAM,CAAC,CAAC,EAAE,CAAC,CAGgB,CAAC"}
|
package/types/methods/match.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Pattern matches the `Result` into a single output value.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
7
|
* @typeParam U - The output type returned by both handlers.
|
|
8
|
-
* @param result -
|
|
9
|
-
* @param okFn -
|
|
10
|
-
* @param errFn -
|
|
11
|
-
* @returns
|
|
8
|
+
* @param result - The source `Result`.
|
|
9
|
+
* @param okFn - The handler for the success branch.
|
|
10
|
+
* @param errFn - The handler for the error branch.
|
|
11
|
+
* @returns The output value produced by the selected handler.
|
|
12
12
|
* @since 0.1.0
|
|
13
13
|
* @see {@link unwrapOrElse} - Similar shape with default fallback semantics.
|
|
14
14
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../src/methods/match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../src/methods/match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAC3B,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EACrB,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KACrB,CAOF,CAAC"}
|
package/types/methods/ok.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { type Option } from '../
|
|
2
|
-
import { type Result } from '../shared-types.js';
|
|
1
|
+
import { type Option, type Result } from '../types/core/index.js';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Extracts the success branch as an `Option`.
|
|
5
4
|
*
|
|
6
|
-
* @typeParam T -
|
|
7
|
-
* @typeParam E -
|
|
8
|
-
* @param result -
|
|
9
|
-
* @returns `Some(value)`
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @returns `Some(value)` for `Ok`, otherwise `None`.
|
|
10
9
|
* @since 0.1.0
|
|
11
|
-
* @see {@link err} -
|
|
10
|
+
* @see {@link err} - Extracts the error branch.
|
|
12
11
|
* @example
|
|
13
12
|
* ```ts
|
|
14
13
|
* import { Ok, ok } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ok.d.ts","sourceRoot":"","sources":["../../../src/methods/ok.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"ok.d.ts","sourceRoot":"","sources":["../../../src/methods/ok.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,EAAE,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CACd,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Recovers from an error by transforming `Err` into another `Result`.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @typeParam F -
|
|
8
|
-
* @param result -
|
|
9
|
-
* @param fn -
|
|
10
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The input error value type.
|
|
7
|
+
* @typeParam F - The output error value type.
|
|
8
|
+
* @param result - The source `Result`.
|
|
9
|
+
* @param fn - The recovery function applied to `Err`.
|
|
10
|
+
* @returns The recovered `Result` or the original `Ok`.
|
|
11
11
|
* @since 0.1.0
|
|
12
|
-
* @see {@link andThen} -
|
|
12
|
+
* @see {@link andThen} - Chains the success branch.
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { Err, Ok, orElse } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orElse.d.ts","sourceRoot":"","sources":["../../../src/methods/orElse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"orElse.d.ts","sourceRoot":"","sources":["../../../src/methods/orElse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAC5B,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAC7B,MAAM,CAAC,CAAC,EAAE,CAAC,CAC+C,CAAC"}
|
package/types/methods/tap.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Result } from '../
|
|
1
|
+
import type { Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Performs a side effect for the `Ok` value and returns the input `Result`.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param fn -
|
|
9
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param fn - The side effect callback for the success branch.
|
|
9
|
+
* @returns The unchanged `Result`.
|
|
10
10
|
* @since 0.1.0
|
|
11
11
|
* @see {@link tapErr} - Executes a side effect for the error branch.
|
|
12
12
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../../src/methods/tap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../../src/methods/tap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EACtB,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KACrB,MAAM,CAAC,CAAC,EAAE,CAAC,CAKb,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Performs a side effect for the `Err` value and returns the input `Result`.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param fn -
|
|
9
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param fn - The side effect callback for the error branch.
|
|
9
|
+
* @returns The unchanged `Result`.
|
|
10
10
|
* @since 0.1.0
|
|
11
11
|
* @see {@link tap} - Executes a side effect for the success branch.
|
|
12
12
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tapErr.d.ts","sourceRoot":"","sources":["../../../src/methods/tapErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tapErr.d.ts","sourceRoot":"","sources":["../../../src/methods/tapErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EACzB,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KACrB,MAAM,CAAC,CAAC,EAAE,CAAC,CAKb,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { type Option } from '../
|
|
2
|
-
import { type Result } from '../shared-types.js';
|
|
1
|
+
import { type Option, type Result } from '../types/core/index.js';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Transforms `Result<Option<T>, E>` into `Option<Result<T, E>>`.
|
|
5
4
|
*
|
|
6
5
|
* @typeParam T - The success value type inside `Option`.
|
|
7
|
-
* @typeParam E -
|
|
8
|
-
* @param result -
|
|
9
|
-
* @returns
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result` containing an `Option`.
|
|
8
|
+
* @returns The transposed `Option<Result<T, E>>`.
|
|
10
9
|
* @since 0.1.0
|
|
11
10
|
* @see {@link flatten} - Collapses nested `Result` values.
|
|
12
11
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpose.d.ts","sourceRoot":"","sources":["../../../src/methods/transpose.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"transpose.d.ts","sourceRoot":"","sources":["../../../src/methods/transpose.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAC5B,QAAQ,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAOrB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Returns the success value or throws an exception if the result is `Err`.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @returns
|
|
9
|
-
* @throws Error -
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @returns The success payload.
|
|
9
|
+
* @throws Error - Throws an exception when called on `Err`.
|
|
10
10
|
* @since 0.1.0
|
|
11
|
-
* @see {@link unwrapOr} -
|
|
11
|
+
* @see {@link unwrapOr} - Returns a fallback instead of throwing.
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { Ok, unwrap } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unwrap.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"unwrap.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,CAKnD,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Returns the error value or throws an exception if the result is `Ok`.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @returns
|
|
9
|
-
* @throws Error -
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @returns The error payload.
|
|
9
|
+
* @throws Error - Throws an exception when called on `Ok`.
|
|
10
10
|
* @since 0.1.0
|
|
11
|
-
* @see {@link unwrapOrElse} -
|
|
11
|
+
* @see {@link unwrapOrElse} - Returns a success fallback without throwing.
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { Err, unwrapErr } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapErr.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrapErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"unwrapErr.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrapErr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,CAKtD,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Returns the success value or the provided default fallback.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param defaultValue -
|
|
9
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param defaultValue - The fallback value for `Err`.
|
|
9
|
+
* @returns The success payload or `defaultValue`.
|
|
10
10
|
* @since 0.1.0
|
|
11
|
-
* @see {@link unwrapOrElse} -
|
|
11
|
+
* @see {@link unwrapOrElse} - Computes the fallback lazily.
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { Err, unwrapOr } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapOr.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrapOr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"unwrapOr.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrapOr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,KAAG,CAC3B,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Result } from '../
|
|
1
|
+
import { type Result } from '../types/core/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Returns the success value or computes a fallback from the error.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam T -
|
|
6
|
-
* @typeParam E -
|
|
7
|
-
* @param result -
|
|
8
|
-
* @param fn -
|
|
9
|
-
* @returns
|
|
5
|
+
* @typeParam T - The success value type.
|
|
6
|
+
* @typeParam E - The error value type.
|
|
7
|
+
* @param result - The source `Result`.
|
|
8
|
+
* @param fn - The fallback provider function for `Err`.
|
|
9
|
+
* @returns The success payload or the computed fallback.
|
|
10
10
|
* @since 0.1.0
|
|
11
|
-
* @see {@link unwrapOr} -
|
|
11
|
+
* @see {@link unwrapOr} - Uses an eager fallback value.
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { Err, unwrapOrElse } from '@resultsafe/core-fp-result';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapOrElse.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrapOrElse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"unwrapOrElse.d.ts","sourceRoot":"","sources":["../../../src/methods/unwrapOrElse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,EAC/B,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KAClB,CAMF,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Creates a runtime type guard for a discriminated union variant.
|
|
3
3
|
*
|
|
4
4
|
* @typeParam K - The discriminant literal type.
|
|
5
|
-
* @param variant -
|
|
5
|
+
* @param variant - The discriminant value to match.
|
|
6
6
|
* @returns A predicate that checks `{ type: K }` shape.
|
|
7
7
|
* @since 0.1.0
|
|
8
|
-
* @see {@link isTypedVariantOf} -
|
|
8
|
+
* @see {@link isTypedVariantOf} - Extends check with payload keys.
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
11
11
|
* import { isTypedVariant } from '@resultsafe/core-fp-result';
|