@resultsafe/core-fp-result 0.1.8 → 0.1.10
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 +305 -302
- package/README.ru.md +304 -302
- package/docs/api/README.md +52 -7
- package/docs/api/{constructors → functions}/Err.md +9 -11
- package/docs/api/{constructors → functions}/Ok.md +9 -11
- package/docs/api/{methods → functions}/andThen.md +9 -11
- package/docs/api/{methods/err.md → functions/err-1.md} +9 -11
- package/docs/api/{methods → functions}/expect.md +10 -12
- package/docs/api/{methods → functions}/expectErr.md +10 -12
- package/docs/api/{methods → functions}/flatten.md +9 -11
- package/docs/api/{methods → functions}/inspect.md +9 -11
- package/docs/api/{methods → functions}/inspectErr.md +9 -11
- package/docs/api/{guards → functions}/isErr.md +9 -11
- package/docs/api/{guards → functions}/isErrAnd.md +9 -11
- package/docs/api/{guards → functions}/isOk.md +9 -11
- package/docs/api/{guards → functions}/isOkAnd.md +9 -11
- package/docs/api/{refiners → functions}/isTypedVariant.md +11 -13
- package/docs/api/{refiners → functions}/isTypedVariantOf.md +11 -13
- package/docs/api/{methods → functions}/map.md +9 -11
- package/docs/api/{methods → functions}/mapErr.md +9 -11
- package/docs/api/{methods → functions}/match.md +9 -11
- package/docs/api/{refiners → functions}/matchVariant.md +9 -11
- package/docs/api/{refiners → functions}/matchVariantStrict.md +10 -12
- package/docs/api/{methods/ok.md → functions/ok-1.md} +9 -11
- package/docs/api/{methods → functions}/orElse.md +9 -11
- package/docs/api/{refiners → functions}/refineAsyncResult.md +17 -19
- package/docs/api/{refiners → functions}/refineAsyncResultU.md +9 -11
- package/docs/api/{refiners → functions}/refineResult.md +17 -19
- package/docs/api/{refiners → functions}/refineResultU.md +9 -11
- package/docs/api/{refiners → functions}/refineVariantMap.md +9 -11
- package/docs/api/{methods → functions}/tap.md +9 -11
- package/docs/api/{methods → functions}/tapErr.md +9 -11
- package/docs/api/{methods → functions}/transpose.md +9 -11
- package/docs/api/{methods → functions}/unwrap.md +10 -12
- package/docs/api/{methods → functions}/unwrapErr.md +10 -12
- package/docs/api/{methods → functions}/unwrapOr.md +9 -11
- package/docs/api/{methods → functions}/unwrapOrElse.md +9 -11
- package/docs/api/type-aliases/Handler.md +1 -1
- package/docs/api/type-aliases/MatchBuilder.md +1 -1
- package/docs/api/type-aliases/Matcher.md +1 -1
- package/docs/api/type-aliases/SyncRefinedResult.md +1 -1
- package/docs/api/type-aliases/SyncRefinedResultUnion.md +1 -1
- package/docs/api/type-aliases/SyncValidatorMap.md +1 -1
- package/docs/api/type-aliases/UniversalAsyncRefinedResult.md +1 -1
- package/docs/api/type-aliases/UniversalRefinedResult.md +1 -1
- package/docs/api/type-aliases/VariantOf.md +1 -1
- package/docs/examples/auth/index.md +1 -1
- package/docs/examples/auth/token.md +1 -1
- package/docs/examples/connection/connect.md +1 -1
- package/docs/examples/connection/index.md +1 -1
- package/docs/examples/connection/reconnect.md +1 -1
- package/docs/examples/errors/index.md +1 -1
- package/docs/examples/errors/retry.md +1 -1
- package/docs/examples/index.md +1 -1
- package/docs/examples/streaming/index.md +1 -1
- package/docs/examples/streaming/text.md +1 -1
- package/docs/meta/AI-AGENT-RULES.md +1 -1
- package/docs/meta/CONTEXT.md +1 -1
- package/docs/meta/MANIFEST.md +1 -1
- package/docs/meta/registry/COUNTERS.md +1 -1
- package/docs/meta/registry/ENTITIES.md +1 -1
- package/package.json +1 -1
- package/docs/api/constructors/index.md +0 -7
- package/docs/api/guards/index.md +0 -9
- package/docs/api/index.md +0 -9
- package/docs/api/methods/index.md +0 -24
- package/docs/api/modules.md +0 -10
- package/docs/api/refiners/index.md +0 -14
- package/docs/api/type-aliases/index.md +0 -14
package/README.md
CHANGED
|
@@ -1,302 +1,305 @@
|
|
|
1
|
-
# @resultsafe/core-fp-result
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@resultsafe/core-fp-result)
|
|
10
|
+
[](https://www.npmjs.com/package/@resultsafe/core-fp-result)
|
|
11
|
+
[](./LICENSE)
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
13
|
+
[](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/README.md)
|
|
14
|
+
[](./package.json)
|
|
15
|
+
[](https://github.com/Livooon/resultsafe)
|
|
16
|
+
|
|
17
|
+
A Rust-inspired Result package for explicit, composable, and type-friendly APIs in TypeScript and JavaScript.
|
|
18
|
+
|
|
19
|
+
**Language:** English | [Русский](https://github.com/resultsafe/monorepo/blob/main/packages/core/fp/result/README.ru.md)
|
|
20
|
+
|
|
21
|
+
**Documentation:** [API index](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/README.md) · [Modules](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/modules.md)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
## Contents
|
|
25
|
+
|
|
26
|
+
- [Why this package](#why-this-package)
|
|
27
|
+
- [Monorepo context](#monorepo-context)
|
|
28
|
+
- [Key features](#key-features)
|
|
29
|
+
- [Package](#package)
|
|
30
|
+
- [Installation](#installation)
|
|
31
|
+
- [Quick start](#quick-start)
|
|
32
|
+
- [Core API overview](#core-api-overview)
|
|
33
|
+
- [Build and distribution formats](#build-and-distribution-formats)
|
|
34
|
+
- [Monorepo and package structure](#monorepo-and-package-structure)
|
|
35
|
+
- [When to use this project](#when-to-use-this-project)
|
|
36
|
+
- [Documentation links](#documentation-links)
|
|
37
|
+
- [License](#license)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Why this package
|
|
42
|
+
|
|
43
|
+
`@resultsafe/core-fp-result` provides explicit success/error flows instead of hidden control paths and exception-first branching.
|
|
44
|
+
|
|
45
|
+
Its core package, [`@resultsafe/core-fp-result`](https://www.npmjs.com/package/@resultsafe/core-fp-result), provides a Rust-inspired `Result` API for TypeScript and JavaScript with:
|
|
46
|
+
|
|
47
|
+
- explicit `Ok` / `Err`
|
|
48
|
+
- predictable functional composition
|
|
49
|
+
- safe branching through guards and matching
|
|
50
|
+
- disciplined extraction APIs
|
|
51
|
+
- advanced refinement utilities for typed variants and strict matching
|
|
52
|
+
|
|
53
|
+
The goal is not to imitate Rust mechanically, but to bring the same clarity of intent to Node.js libraries: explicit values, predictable branching, and APIs organized for long-term maintenance.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Monorepo context
|
|
58
|
+
|
|
59
|
+
`@resultsafe/core-fp-result` is the TypeScript/JavaScript package inside the multilingual `resultsafe/monorepo`.
|
|
60
|
+
|
|
61
|
+
The monorepo applies shared Rust-inspired design concepts across language-specific packages. TypeScript/JavaScript is the current production package track, while Python is planned as a separate package track with the same conceptual model.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Key features
|
|
66
|
+
|
|
67
|
+
- Rust-inspired `Result` model for TypeScript and JavaScript.
|
|
68
|
+
- Explicit constructors via `Ok` and `Err`.
|
|
69
|
+
- Composable transformations with APIs such as `map`, `mapErr`, `andThen`, and `orElse`.
|
|
70
|
+
- Safe branching through guards like `isOk`, `isErr`, `isOkAnd`, `isErrAnd`, and matching helpers.
|
|
71
|
+
- Controlled extraction with `unwrap`, `unwrapOr`, `unwrapErr`, `expect`, and `expectErr`.
|
|
72
|
+
- Advanced refinement layer for typed variants, strict matching, and result narrowing.
|
|
73
|
+
- Coherent module structure instead of a flat utility dump.
|
|
74
|
+
- Type output for TypeScript users for better DX and safer integrations.
|
|
75
|
+
- Flexible distribution formats with Types, ESM, CJS, and UMD builds.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Package
|
|
80
|
+
|
|
81
|
+
### `@resultsafe/core-fp-result`
|
|
82
|
+
|
|
83
|
+
A focused Result library for explicit error handling and FP-style composition.
|
|
84
|
+
|
|
85
|
+
It is designed for developers who want:
|
|
86
|
+
|
|
87
|
+
- clear success/error modeling
|
|
88
|
+
- predictable transformations
|
|
89
|
+
- explicit branching and extraction
|
|
90
|
+
- better readability in error-heavy flows
|
|
91
|
+
- a structured Rust-inspired API surface in TypeScript/JavaScript
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Installation
|
|
96
|
+
|
|
97
|
+
### Package
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pnpm add @resultsafe/core-fp-result
|
|
101
|
+
|
|
102
|
+
# Alternative
|
|
103
|
+
npm install @resultsafe/core-fp-result
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Monorepo
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pnpm install
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Quick start
|
|
115
|
+
|
|
116
|
+
A typical Result flow starts with explicit constructors and then composes through functions rather than implicit exception paths.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import {
|
|
120
|
+
Ok,
|
|
121
|
+
map,
|
|
122
|
+
unwrapOr,
|
|
123
|
+
} from "@resultsafe/core-fp-result";
|
|
124
|
+
|
|
125
|
+
const initial = Ok(21);
|
|
126
|
+
const doubled = map(initial, (value) => value * 2);
|
|
127
|
+
const finalValue = unwrapOr(doubled, 0);
|
|
128
|
+
|
|
129
|
+
console.log(finalValue); // 42
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Basic `Ok` / `Err` example
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { Ok, Err, match } from "@resultsafe/core-fp-result";
|
|
136
|
+
|
|
137
|
+
const parsePort = (input: string) => {
|
|
138
|
+
const port = Number(input);
|
|
139
|
+
return Number.isInteger(port) && port > 0
|
|
140
|
+
? Ok(port)
|
|
141
|
+
: Err("Invalid port");
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const result = parsePort("3000");
|
|
145
|
+
const message = match(result, (value) => `Port: ${value}`, (error) => `Error: ${error}`);
|
|
146
|
+
|
|
147
|
+
console.log(message);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
<!-- AI-AGENT: Each function has 3 links: Source (GitHub UI), Raw (direct code), Code (new UI) -->
|
|
153
|
+
<!-- Raw links are best for automated code analysis and parsing -->
|
|
154
|
+
|
|
155
|
+
## Core API overview
|
|
156
|
+
|
|
157
|
+
### Core Types
|
|
158
|
+
|
|
159
|
+
- [`Result<T, E>`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/core/Result.ts) — Success/failure container [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/core/Result.ts "View raw code")
|
|
160
|
+
- [`Option<T>`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/core/Option.ts) — Optional value container [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/core/Option.ts "View raw code")
|
|
161
|
+
|
|
162
|
+
### Type Helpers
|
|
163
|
+
|
|
164
|
+
- [`VariantConfig`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/VariantConfig.ts) — Variant configuration [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/VariantConfig.ts "View raw code")
|
|
165
|
+
- [`PayloadKeys<T>`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/PayloadKeys.ts) — Extract payload keys [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/PayloadKeys.ts "View raw code")
|
|
166
|
+
- [`ValidatorFn<T>`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/ValidatorFn.ts) — Sync validator function [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/ValidatorFn.ts "View raw code")
|
|
167
|
+
- [`AsyncValidatorFn`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/AsyncValidatorFn.ts) — Async validator function [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/types/refiners/AsyncValidatorFn.ts "View raw code")
|
|
168
|
+
|
|
169
|
+
### Constructors
|
|
170
|
+
|
|
171
|
+
- [`Ok`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/constructors/Ok.ts) — Create success result [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/constructors/Ok.ts "View raw code")
|
|
172
|
+
- [`Err`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/constructors/Err.ts) — Create error result [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/constructors/Err.ts "View raw code")
|
|
173
|
+
|
|
174
|
+
### Guards
|
|
175
|
+
|
|
176
|
+
- [`isOk`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isOk.ts) — Check if success [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isOk.ts "View raw code")
|
|
177
|
+
- [`isErr`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isErr.ts) — Check if error [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isErr.ts "View raw code")
|
|
178
|
+
- [`isOkAnd`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isOkAnd.ts) — Check success with predicate [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isOkAnd.ts "View raw code")
|
|
179
|
+
- [`isErrAnd`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isErrAnd.ts) — Check error with predicate [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/guards/isErrAnd.ts "View raw code")
|
|
180
|
+
|
|
181
|
+
### Methods
|
|
182
|
+
|
|
183
|
+
#### Transformation
|
|
184
|
+
|
|
185
|
+
- [`map`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/map.ts) — Transform success value [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/map.ts "View raw code")
|
|
186
|
+
- [`mapErr`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/mapErr.ts) — Transform error value [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/mapErr.ts "View raw code")
|
|
187
|
+
|
|
188
|
+
#### Chaining
|
|
189
|
+
|
|
190
|
+
- [`andThen`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/andThen.ts) — Chain computations returning Result [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/andThen.ts "View raw code")
|
|
191
|
+
- [`orElse`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/orElse.ts) — Recover from error [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/orElse.ts "View raw code")
|
|
192
|
+
|
|
193
|
+
#### Extraction
|
|
194
|
+
|
|
195
|
+
- [`unwrap`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrap.ts) — Extract value or throw [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrap.ts "View raw code")
|
|
196
|
+
- [`unwrapOr`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrapOr.ts) — Extract value or default [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrapOr.ts "View raw code")
|
|
197
|
+
- [`unwrapOrElse`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrapOrElse.ts) — Extract value or compute default [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrapOrElse.ts "View raw code")
|
|
198
|
+
- [`unwrapErr`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrapErr.ts) — Extract error or throw [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/unwrapErr.ts "View raw code")
|
|
199
|
+
- [`expect`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/expect.ts) — Extract value or throw with message [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/expect.ts "View raw code")
|
|
200
|
+
- [`expectErr`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/expectErr.ts) — Extract error or throw with message [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/expectErr.ts "View raw code")
|
|
201
|
+
|
|
202
|
+
#### Side Effects
|
|
203
|
+
|
|
204
|
+
- [`tap`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/tap.ts) — Side effect on success [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/tap.ts "View raw code")
|
|
205
|
+
- [`tapErr`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/tapErr.ts) — Side effect on error [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/tapErr.ts "View raw code")
|
|
206
|
+
- [`inspect`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/inspect.ts) — Debug on success [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/inspect.ts "View raw code")
|
|
207
|
+
- [`inspectErr`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/inspectErr.ts) — Debug on error [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/inspectErr.ts "View raw code")
|
|
208
|
+
|
|
209
|
+
#### Advanced
|
|
210
|
+
|
|
211
|
+
- [`match`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/match.ts) — Pattern matching [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/match.ts "View raw code")
|
|
212
|
+
- [`flatten`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/flatten.ts) — Flatten nested Result [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/flatten.ts "View raw code")
|
|
213
|
+
- [`transpose`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/transpose.ts) — Result<Option> → Option<Result> [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/transpose.ts "View raw code")
|
|
214
|
+
- [`ok`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/ok.ts) — Convert to Option (success) [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/ok.ts "View raw code")
|
|
215
|
+
- [`err`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/err.ts) — Convert to Option (error) [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/methods/err.ts "View raw code")
|
|
216
|
+
|
|
217
|
+
### Refiners
|
|
218
|
+
|
|
219
|
+
- [`isTypedVariant`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/isTypedVariant.ts) — Type guard for variant [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/isTypedVariant.ts "View raw code")
|
|
220
|
+
- [`isTypedVariantOf`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/isTypedVariantOf.ts) — Type guard with variant map [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/isTypedVariantOf.ts "View raw code")
|
|
221
|
+
- [`matchVariant`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/matchVariant.ts) — Match variant with handlers [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/matchVariant.ts "View raw code")
|
|
222
|
+
- [`matchVariantStrict`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/matchVariantStrict.ts) — Strict variant matching [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/matchVariantStrict.ts "View raw code")
|
|
223
|
+
- [`refineAsyncResult`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineAsyncResult.ts) — Async result refinement [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineAsyncResult.ts "View raw code")
|
|
224
|
+
- [`refineAsyncResultU`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineAsyncResultU.ts) — Async refinement (uncurried) [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineAsyncResultU.ts "View raw code")
|
|
225
|
+
- [`refineResult`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineResult.ts) — Synchronous result refinement [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineResult.ts "View raw code")
|
|
226
|
+
- [`refineResultU`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineResultU.ts) — Synchronous refinement (uncurried) [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineResultU.ts "View raw code")
|
|
227
|
+
- [`refineVariantMap`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineVariantMap.ts) — Refine variant map [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/refineVariantMap.ts "View raw code")
|
|
228
|
+
|
|
229
|
+
### Type aliases
|
|
230
|
+
|
|
231
|
+
- [`Handler`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/Handler.ts) — Match handler type [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/Handler.ts "View raw code")
|
|
232
|
+
- [`MatchBuilder`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/MatchBuilder.ts) — Match builder type [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/MatchBuilder.ts "View raw code")
|
|
233
|
+
- [`Matcher`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/Matcher.ts) — Matcher function type [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/Matcher.ts "View raw code")
|
|
234
|
+
- [`SyncRefinedResult`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/SyncRefinedResult.ts) — Synchronous refined result [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/SyncRefinedResult.ts "View raw code")
|
|
235
|
+
- [`SyncRefinedResultUnion`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/SyncRefinedResultUnion.ts) — Union of refined results [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/SyncRefinedResultUnion.ts "View raw code")
|
|
236
|
+
- [`SyncValidatorMap`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/SyncValidatorMap.ts) — Validator map type [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/SyncValidatorMap.ts "View raw code")
|
|
237
|
+
- [`UniversalAsyncRefinedResult`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/UniversalAsyncRefinedResult.ts) — Async refined result [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/UniversalAsyncRefinedResult.ts "View raw code")
|
|
238
|
+
- [`UniversalRefinedResult`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/UniversalRefinedResult.ts) — Universal refined result [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/UniversalRefinedResult.ts "View raw code")
|
|
239
|
+
- [`VariantOf`](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/VariantOf.ts) — Variant type helper [🔗](https://raw.githubusercontent.com/Livooon/resultsafe/main/packages/core/fp/result/src/refiners/types/VariantOf.ts "View raw code")
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Build and distribution formats
|
|
244
|
+
|
|
245
|
+
- Types: `build:types`
|
|
246
|
+
- ESM: `build:esm`
|
|
247
|
+
- CJS: `build:cjs`
|
|
248
|
+
- UMD: `build:umd`
|
|
249
|
+
|
|
250
|
+
This package ships typed declarations and multiple runtime module formats for broad compatibility.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Monorepo and package structure
|
|
255
|
+
|
|
256
|
+
```txt
|
|
257
|
+
src/
|
|
258
|
+
constructors/
|
|
259
|
+
guards/
|
|
260
|
+
methods/
|
|
261
|
+
refiners/
|
|
262
|
+
types/
|
|
263
|
+
utils/
|
|
264
|
+
internal/
|
|
265
|
+
index.ts
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## When to use this project
|
|
271
|
+
|
|
272
|
+
Use this project when you want:
|
|
273
|
+
|
|
274
|
+
- explicit success/error modeling
|
|
275
|
+
- predictable FP-style composition
|
|
276
|
+
- visible control flow
|
|
277
|
+
- stronger type-guided result handling in TypeScript
|
|
278
|
+
- advanced refinement tools for typed variants and strict result matching
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Documentation links
|
|
283
|
+
|
|
284
|
+
- [API entry (README)](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/README.md)
|
|
285
|
+
- [API entry (index)](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/index.md)
|
|
286
|
+
- [Modules](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/modules.md)
|
|
287
|
+
- [Constructors module](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/constructors/index.md)
|
|
288
|
+
- [Guards module](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/guards/index.md)
|
|
289
|
+
- [Methods module](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/methods/index.md)
|
|
290
|
+
- [Refiners module](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/refiners/index.md)
|
|
291
|
+
- [Type aliases module](https://unpkg.com/@resultsafe/core-fp-result@latest/docs/api/type-aliases/index.md)
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
Back to top: [@resultsafe/core-fp-result](#top)
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
## Author
|
|
298
|
+
|
|
299
|
+
Denis Savasteev
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## License
|
|
304
|
+
|
|
305
|
+
[MIT](./LICENSE)
|