@unthrown/pattern 0.1.0 → 0.3.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/docs/index.md +17 -17
- package/package.json +2 -2
package/docs/index.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
function defect(): object;
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Defined in: [index.ts:60](https://github.com/btravstack/unthrown/blob/
|
|
17
|
+
Defined in: [index.ts:60](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L60)
|
|
18
18
|
|
|
19
19
|
A `ts-pattern` pattern matching the `Defect` variant of a `Result`. With no
|
|
20
20
|
argument it matches any `Defect`; pass a sub-pattern to constrain or select
|
|
@@ -26,7 +26,7 @@ the unknown `cause`.
|
|
|
26
26
|
|
|
27
27
|
| Name | Type | Defined in |
|
|
28
28
|
| ------ | ------ | ------ |
|
|
29
|
-
| `tag` | `"Defect"` | [index.ts:60](https://github.com/btravstack/unthrown/blob/
|
|
29
|
+
| `tag` | `"Defect"` | [index.ts:60](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L60) |
|
|
30
30
|
|
|
31
31
|
#### Call Signature
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ the unknown `cause`.
|
|
|
34
34
|
function defect<V>(cause): object;
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Defined in: [index.ts:61](https://github.com/btravstack/unthrown/blob/
|
|
37
|
+
Defined in: [index.ts:61](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L61)
|
|
38
38
|
|
|
39
39
|
A `ts-pattern` pattern matching the `Defect` variant of a `Result`. With no
|
|
40
40
|
argument it matches any `Defect`; pass a sub-pattern to constrain or select
|
|
@@ -58,8 +58,8 @@ the unknown `cause`.
|
|
|
58
58
|
|
|
59
59
|
| Name | Type | Defined in |
|
|
60
60
|
| ------ | ------ | ------ |
|
|
61
|
-
| `cause` | `V` | [index.ts:61](https://github.com/btravstack/unthrown/blob/
|
|
62
|
-
| `tag` | `"Defect"` | [index.ts:61](https://github.com/btravstack/unthrown/blob/
|
|
61
|
+
| `cause` | `V` | [index.ts:61](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L61) |
|
|
62
|
+
| `tag` | `"Defect"` | [index.ts:61](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L61) |
|
|
63
63
|
|
|
64
64
|
***
|
|
65
65
|
|
|
@@ -71,7 +71,7 @@ the unknown `cause`.
|
|
|
71
71
|
function err(): object;
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
Defined in: [index.ts:47](https://github.com/btravstack/unthrown/blob/
|
|
74
|
+
Defined in: [index.ts:47](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L47)
|
|
75
75
|
|
|
76
76
|
A `ts-pattern` pattern matching the `Err` variant of a `Result`. With no
|
|
77
77
|
argument it matches any `Err`; pass a sub-pattern (e.g. [tag](#tag)) to
|
|
@@ -83,7 +83,7 @@ constrain or select the `error`.
|
|
|
83
83
|
|
|
84
84
|
| Name | Type | Defined in |
|
|
85
85
|
| ------ | ------ | ------ |
|
|
86
|
-
| `tag` | `"Err"` | [index.ts:47](https://github.com/btravstack/unthrown/blob/
|
|
86
|
+
| `tag` | `"Err"` | [index.ts:47](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L47) |
|
|
87
87
|
|
|
88
88
|
#### Call Signature
|
|
89
89
|
|
|
@@ -91,7 +91,7 @@ constrain or select the `error`.
|
|
|
91
91
|
function err<V>(error): object;
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
Defined in: [index.ts:48](https://github.com/btravstack/unthrown/blob/
|
|
94
|
+
Defined in: [index.ts:48](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L48)
|
|
95
95
|
|
|
96
96
|
A `ts-pattern` pattern matching the `Err` variant of a `Result`. With no
|
|
97
97
|
argument it matches any `Err`; pass a sub-pattern (e.g. [tag](#tag)) to
|
|
@@ -115,8 +115,8 @@ constrain or select the `error`.
|
|
|
115
115
|
|
|
116
116
|
| Name | Type | Defined in |
|
|
117
117
|
| ------ | ------ | ------ |
|
|
118
|
-
| `error` | `V` | [index.ts:48](https://github.com/btravstack/unthrown/blob/
|
|
119
|
-
| `tag` | `"Err"` | [index.ts:48](https://github.com/btravstack/unthrown/blob/
|
|
118
|
+
| `error` | `V` | [index.ts:48](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L48) |
|
|
119
|
+
| `tag` | `"Err"` | [index.ts:48](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L48) |
|
|
120
120
|
|
|
121
121
|
***
|
|
122
122
|
|
|
@@ -128,7 +128,7 @@ constrain or select the `error`.
|
|
|
128
128
|
function ok(): object;
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
-
Defined in: [index.ts:34](https://github.com/btravstack/unthrown/blob/
|
|
131
|
+
Defined in: [index.ts:34](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L34)
|
|
132
132
|
|
|
133
133
|
A `ts-pattern` pattern matching the `Ok` variant of a `Result`. With no
|
|
134
134
|
argument it matches any `Ok`; pass a sub-pattern to constrain or select the
|
|
@@ -141,7 +141,7 @@ argument it matches any `Ok`; pass a sub-pattern to constrain or select the
|
|
|
141
141
|
|
|
142
142
|
| Name | Type | Defined in |
|
|
143
143
|
| ------ | ------ | ------ |
|
|
144
|
-
| `tag` | `"Ok"` | [index.ts:34](https://github.com/btravstack/unthrown/blob/
|
|
144
|
+
| `tag` | `"Ok"` | [index.ts:34](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L34) |
|
|
145
145
|
|
|
146
146
|
#### Call Signature
|
|
147
147
|
|
|
@@ -149,7 +149,7 @@ argument it matches any `Ok`; pass a sub-pattern to constrain or select the
|
|
|
149
149
|
function ok<V>(value): object;
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
Defined in: [index.ts:35](https://github.com/btravstack/unthrown/blob/
|
|
152
|
+
Defined in: [index.ts:35](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L35)
|
|
153
153
|
|
|
154
154
|
A `ts-pattern` pattern matching the `Ok` variant of a `Result`. With no
|
|
155
155
|
argument it matches any `Ok`; pass a sub-pattern to constrain or select the
|
|
@@ -174,8 +174,8 @@ argument it matches any `Ok`; pass a sub-pattern to constrain or select the
|
|
|
174
174
|
|
|
175
175
|
| Name | Type | Defined in |
|
|
176
176
|
| ------ | ------ | ------ |
|
|
177
|
-
| `tag` | `"Ok"` | [index.ts:35](https://github.com/btravstack/unthrown/blob/
|
|
178
|
-
| `value` | `V` | [index.ts:35](https://github.com/btravstack/unthrown/blob/
|
|
177
|
+
| `tag` | `"Ok"` | [index.ts:35](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L35) |
|
|
178
|
+
| `value` | `V` | [index.ts:35](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L35) |
|
|
179
179
|
|
|
180
180
|
***
|
|
181
181
|
|
|
@@ -185,7 +185,7 @@ argument it matches any `Ok`; pass a sub-pattern to constrain or select the
|
|
|
185
185
|
function tag<Tag>(value): object;
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
Defined in: [index.ts:80](https://github.com/btravstack/unthrown/blob/
|
|
188
|
+
Defined in: [index.ts:80](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L80)
|
|
189
189
|
|
|
190
190
|
A `ts-pattern` pattern matching any value whose `_tag` equals `value` (e.g. a
|
|
191
191
|
`TaggedError`). Equivalent to the object pattern `{ _tag: value }`, but reads
|
|
@@ -210,7 +210,7 @@ variant — including its payload.
|
|
|
210
210
|
|
|
211
211
|
| Name | Type | Defined in |
|
|
212
212
|
| ------ | ------ | ------ |
|
|
213
|
-
| `_tag` | `Tag` | [index.ts:80](https://github.com/btravstack/unthrown/blob/
|
|
213
|
+
| `_tag` | `Tag` | [index.ts:80](https://github.com/btravstack/unthrown/blob/1e34025e0177665dde9c50faca313fd1b95e5545/packages/pattern/src/index.ts#L80) |
|
|
214
214
|
|
|
215
215
|
#### Example
|
|
216
216
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unthrown/pattern",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "ts-pattern integration for unthrown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"errors-as-values",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"./package.json": "./package.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"unthrown": "0.
|
|
46
|
+
"unthrown": "0.3.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "24.13.2",
|