@kaumlaut/pure 0.5.1 → 0.5.2
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 +1 -1
- package/dist/fetch-state/index.d.ts +16 -1
- package/dist/fetch-state/index.d.ts.map +1 -1
- package/dist/fetch-state/index.js +15 -0
- package/dist/result/index.d.ts.map +1 -1
- package/docs/README.md +2 -2
- package/docs/clone.md +3 -3
- package/docs/fetch-state.md +44 -21
- package/docs/guard.md +25 -25
- package/docs/maybe.md +20 -20
- package/docs/parse.md +3 -3
- package/docs/pipe.md +5 -5
- package/docs/result.md +16 -16
- package/docs/runtime/effect/fetch.md +12 -12
- package/docs/runtime/effect/none.md +2 -2
- package/docs/runtime/effect.md +12 -12
- package/docs/runtime/persistence/none.md +2 -2
- package/docs/runtime/persistence/storage.md +2 -2
- package/docs/runtime/persistence.md +4 -4
- package/docs/runtime.md +9 -9
- package/docs/util.md +2 -2
- package/package.json +1 -1
- package/dist/runtime/persistence/localStorage/index.d.ts +0 -5
- package/dist/runtime/persistence/localStorage/index.d.ts.map +0 -1
- package/dist/runtime/persistence/localStorage/index.js +0 -25
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Provides types and functions to represent fetch request states
|
|
3
3
|
* @module fetch-state
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import { type Guard } from "@kaumlaut/pure/guard";
|
|
6
6
|
/**
|
|
7
7
|
* Represents a failed fetch request
|
|
8
8
|
*/
|
|
@@ -64,11 +64,26 @@ export declare function none(): None;
|
|
|
64
64
|
/**
|
|
65
65
|
* Attempts to create a fetch state of type Success if the given guard passes.
|
|
66
66
|
* Otherwise creates a fetch state of type Failed with the provided error.
|
|
67
|
+
* @example
|
|
68
|
+
const value = attempt(isString, "Not a String")(3);
|
|
69
|
+
if(isSuccess(value)){
|
|
70
|
+
console.log(value.data)
|
|
71
|
+
} else if (isFailed(value)){
|
|
72
|
+
console.error(value.error)
|
|
73
|
+
}
|
|
67
74
|
*/
|
|
68
75
|
export declare function attempt<T>(guard: Guard<T>, error?: string): (data: unknown) => Success<T> | Failed;
|
|
69
76
|
/**
|
|
70
77
|
* A Utility function that allows to map the Failed fetch state to any other fetch state.
|
|
71
78
|
* The mapper function is only called if the given fetch state is Failed.
|
|
79
|
+
* @example
|
|
80
|
+
const value = attempt(isString, "Not a String")(3);
|
|
81
|
+
const mappedValue = mapFailed<string>(state => state.error.includes("404") ? fail("Not Found") : state)(value)
|
|
82
|
+
if(isSuccess(mappedValue)){
|
|
83
|
+
console.log(mappedValue.data)
|
|
84
|
+
} else if (isFailed(mappedValue)){
|
|
85
|
+
console.error(mappedValue.error)
|
|
86
|
+
}
|
|
72
87
|
*/
|
|
73
88
|
export declare function mapFailed<T>(mapper: (state: Failed) => FetchState<T>): (state: FetchState<T>) => FetchState<T>;
|
|
74
89
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetch-state/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetch-state/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,IAAI,EAA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AAK,UAAU,CAAC,CAAC,CAAC,CAQzC"}
|
|
@@ -50,6 +50,13 @@ export function none() {
|
|
|
50
50
|
/**
|
|
51
51
|
* Attempts to create a fetch state of type Success if the given guard passes.
|
|
52
52
|
* Otherwise creates a fetch state of type Failed with the provided error.
|
|
53
|
+
* @example
|
|
54
|
+
const value = attempt(isString, "Not a String")(3);
|
|
55
|
+
if(isSuccess(value)){
|
|
56
|
+
console.log(value.data)
|
|
57
|
+
} else if (isFailed(value)){
|
|
58
|
+
console.error(value.error)
|
|
59
|
+
}
|
|
53
60
|
*/
|
|
54
61
|
export function attempt(guard, error = "Guard did not pass. Ensure the attempted data has the correct type") {
|
|
55
62
|
return (data) => {
|
|
@@ -68,6 +75,14 @@ export function attempt(guard, error = "Guard did not pass. Ensure the attempted
|
|
|
68
75
|
/**
|
|
69
76
|
* A Utility function that allows to map the Failed fetch state to any other fetch state.
|
|
70
77
|
* The mapper function is only called if the given fetch state is Failed.
|
|
78
|
+
* @example
|
|
79
|
+
const value = attempt(isString, "Not a String")(3);
|
|
80
|
+
const mappedValue = mapFailed<string>(state => state.error.includes("404") ? fail("Not Found") : state)(value)
|
|
81
|
+
if(isSuccess(mappedValue)){
|
|
82
|
+
console.log(mappedValue.data)
|
|
83
|
+
} else if (isFailed(mappedValue)){
|
|
84
|
+
console.error(mappedValue.error)
|
|
85
|
+
}
|
|
71
86
|
*/
|
|
72
87
|
export function mapFailed(mapper) {
|
|
73
88
|
return (state) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/result/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAW,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,EAAE,CAAC,CAAC,IAAI;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC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;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC9B,YAAY,EAAE,CAAC,GACd,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAQ7B;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAE5D"}
|
package/docs/README.md
CHANGED
package/docs/clone.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**@kaumlaut/pure v0.5.
|
|
1
|
+
[**@kaumlaut/pure v0.5.2**](README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ Provides value cloning capabilities
|
|
|
14
14
|
|
|
15
15
|
> **Cloneable** = `string` \| `number` \| `boolean` \| `null` \| [`Cloneable`](#cloneable)[] \| \{\[`key`: `string`\]: [`Cloneable`](#cloneable); \}
|
|
16
16
|
|
|
17
|
-
Defined in: [clone/index.ts:9](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
17
|
+
Defined in: [clone/index.ts:9](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/clone/index.ts#L9)
|
|
18
18
|
|
|
19
19
|
Defines the Cloneable type
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ Defines the Cloneable type
|
|
|
24
24
|
|
|
25
25
|
> **clone**\<`T`\>(`value`): `T`
|
|
26
26
|
|
|
27
|
-
Defined in: [clone/index.ts:20](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
27
|
+
Defined in: [clone/index.ts:20](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/clone/index.ts#L20)
|
|
28
28
|
|
|
29
29
|
Recursively clones values to prevent changing of the original value.
|
|
30
30
|
|
package/docs/fetch-state.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**@kaumlaut/pure v0.5.
|
|
1
|
+
[**@kaumlaut/pure v0.5.2**](README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ Provides types and functions to represent fetch request states
|
|
|
14
14
|
|
|
15
15
|
> **Failed** = `object`
|
|
16
16
|
|
|
17
|
-
Defined in: [fetch-state/index.ts:10](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
17
|
+
Defined in: [fetch-state/index.ts:10](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L10)
|
|
18
18
|
|
|
19
19
|
Represents a failed fetch request
|
|
20
20
|
|
|
@@ -24,13 +24,13 @@ Represents a failed fetch request
|
|
|
24
24
|
|
|
25
25
|
> **error**: `Readonly`\<`string`\>
|
|
26
26
|
|
|
27
|
-
Defined in: [fetch-state/index.ts:11](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
27
|
+
Defined in: [fetch-state/index.ts:11](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L11)
|
|
28
28
|
|
|
29
29
|
##### type
|
|
30
30
|
|
|
31
31
|
> **type**: `"Failed"`
|
|
32
32
|
|
|
33
|
-
Defined in: [fetch-state/index.ts:12](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
33
|
+
Defined in: [fetch-state/index.ts:12](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L12)
|
|
34
34
|
|
|
35
35
|
***
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Defined in: [fetch-state/index.ts:12](https://github.com/maxkaemmerer/pure-vue-p
|
|
|
38
38
|
|
|
39
39
|
> **FetchState**\<`T`\> = [`Failed`](#failed) \| [`None`](#none) \| [`Loading`](#loading) \| [`Success`](#success)\<`T`\>
|
|
40
40
|
|
|
41
|
-
Defined in: [fetch-state/index.ts:39](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
41
|
+
Defined in: [fetch-state/index.ts:39](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L39)
|
|
42
42
|
|
|
43
43
|
Represents all possible states of a fetch request
|
|
44
44
|
|
|
@@ -54,7 +54,7 @@ Represents all possible states of a fetch request
|
|
|
54
54
|
|
|
55
55
|
> **Loading** = `object`
|
|
56
56
|
|
|
57
|
-
Defined in: [fetch-state/index.ts:25](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
57
|
+
Defined in: [fetch-state/index.ts:25](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L25)
|
|
58
58
|
|
|
59
59
|
Represents a fetch request that is currently still running
|
|
60
60
|
|
|
@@ -64,7 +64,7 @@ Represents a fetch request that is currently still running
|
|
|
64
64
|
|
|
65
65
|
> **type**: `"Loading"`
|
|
66
66
|
|
|
67
|
-
Defined in: [fetch-state/index.ts:26](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
67
|
+
Defined in: [fetch-state/index.ts:26](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L26)
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
@@ -72,7 +72,7 @@ Defined in: [fetch-state/index.ts:26](https://github.com/maxkaemmerer/pure-vue-p
|
|
|
72
72
|
|
|
73
73
|
> **None** = `object`
|
|
74
74
|
|
|
75
|
-
Defined in: [fetch-state/index.ts:18](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
75
|
+
Defined in: [fetch-state/index.ts:18](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L18)
|
|
76
76
|
|
|
77
77
|
Represents a fetch request that has not been executed
|
|
78
78
|
|
|
@@ -82,7 +82,7 @@ Represents a fetch request that has not been executed
|
|
|
82
82
|
|
|
83
83
|
> **type**: `"None"`
|
|
84
84
|
|
|
85
|
-
Defined in: [fetch-state/index.ts:19](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
85
|
+
Defined in: [fetch-state/index.ts:19](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L19)
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
@@ -90,7 +90,7 @@ Defined in: [fetch-state/index.ts:19](https://github.com/maxkaemmerer/pure-vue-p
|
|
|
90
90
|
|
|
91
91
|
> **Success**\<`T`\> = `object`
|
|
92
92
|
|
|
93
|
-
Defined in: [fetch-state/index.ts:32](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
93
|
+
Defined in: [fetch-state/index.ts:32](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L32)
|
|
94
94
|
|
|
95
95
|
Represents a fetch request that succeeded
|
|
96
96
|
|
|
@@ -106,13 +106,13 @@ Represents a fetch request that succeeded
|
|
|
106
106
|
|
|
107
107
|
> **data**: `Readonly`\<`T`\>
|
|
108
108
|
|
|
109
|
-
Defined in: [fetch-state/index.ts:33](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
109
|
+
Defined in: [fetch-state/index.ts:33](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L33)
|
|
110
110
|
|
|
111
111
|
##### type
|
|
112
112
|
|
|
113
113
|
> **type**: `"Success"`
|
|
114
114
|
|
|
115
|
-
Defined in: [fetch-state/index.ts:34](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
115
|
+
Defined in: [fetch-state/index.ts:34](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L34)
|
|
116
116
|
|
|
117
117
|
## Functions
|
|
118
118
|
|
|
@@ -120,7 +120,7 @@ Defined in: [fetch-state/index.ts:34](https://github.com/maxkaemmerer/pure-vue-p
|
|
|
120
120
|
|
|
121
121
|
> **attempt**\<`T`\>(`guard`, `error`): (`data`) => [`Failed`](#failed) \| [`Success`](#success)\<`T`\>
|
|
122
122
|
|
|
123
|
-
Defined in: [fetch-state/index.ts:
|
|
123
|
+
Defined in: [fetch-state/index.ts:100](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L100)
|
|
124
124
|
|
|
125
125
|
Attempts to create a fetch state of type Success if the given guard passes.
|
|
126
126
|
Otherwise creates a fetch state of type Failed with the provided error.
|
|
@@ -155,13 +155,24 @@ Otherwise creates a fetch state of type Failed with the provided error.
|
|
|
155
155
|
|
|
156
156
|
[`Failed`](#failed) \| [`Success`](#success)\<`T`\>
|
|
157
157
|
|
|
158
|
+
#### Example
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
const value = attempt(isString, "Not a String")(3);
|
|
162
|
+
if(isSuccess(value)){
|
|
163
|
+
console.log(value.data)
|
|
164
|
+
} else if (isFailed(value)){
|
|
165
|
+
console.error(value.error)
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
158
169
|
***
|
|
159
170
|
|
|
160
171
|
### fail()
|
|
161
172
|
|
|
162
173
|
> **fail**(`error`): [`Failed`](#failed)
|
|
163
174
|
|
|
164
|
-
Defined in: [fetch-state/index.ts:67](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
175
|
+
Defined in: [fetch-state/index.ts:67](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L67)
|
|
165
176
|
|
|
166
177
|
Creates a fetch state of type Failed
|
|
167
178
|
|
|
@@ -181,7 +192,7 @@ Creates a fetch state of type Failed
|
|
|
181
192
|
|
|
182
193
|
> **isFailed**\<`T`\>(`state`): `state is Failed`
|
|
183
194
|
|
|
184
|
-
Defined in: [fetch-state/index.ts:49](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
195
|
+
Defined in: [fetch-state/index.ts:49](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L49)
|
|
185
196
|
|
|
186
197
|
Checks whether or not the fetch state is Failed via a type guard
|
|
187
198
|
|
|
@@ -207,7 +218,7 @@ Checks whether or not the fetch state is Failed via a type guard
|
|
|
207
218
|
|
|
208
219
|
> **isLoading**\<`T`\>(`state`): `state is Loading`
|
|
209
220
|
|
|
210
|
-
Defined in: [fetch-state/index.ts:43](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
221
|
+
Defined in: [fetch-state/index.ts:43](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L43)
|
|
211
222
|
|
|
212
223
|
Checks whether or not the fetch state is Loading via a type guard
|
|
213
224
|
|
|
@@ -233,7 +244,7 @@ Checks whether or not the fetch state is Loading via a type guard
|
|
|
233
244
|
|
|
234
245
|
> **isNone**\<`T`\>(`state`): `state is None`
|
|
235
246
|
|
|
236
|
-
Defined in: [fetch-state/index.ts:55](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
247
|
+
Defined in: [fetch-state/index.ts:55](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L55)
|
|
237
248
|
|
|
238
249
|
Checks whether or not the fetch state is None via a type guard
|
|
239
250
|
|
|
@@ -259,7 +270,7 @@ Checks whether or not the fetch state is None via a type guard
|
|
|
259
270
|
|
|
260
271
|
> **isSuccess**\<`T`\>(`state`): `state is Success<T>`
|
|
261
272
|
|
|
262
|
-
Defined in: [fetch-state/index.ts:61](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
273
|
+
Defined in: [fetch-state/index.ts:61](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L61)
|
|
263
274
|
|
|
264
275
|
Checks whether or not the fetch state is Success via a type guard
|
|
265
276
|
|
|
@@ -285,7 +296,7 @@ Checks whether or not the fetch state is Success via a type guard
|
|
|
285
296
|
|
|
286
297
|
> **load**(): [`Loading`](#loading)
|
|
287
298
|
|
|
288
|
-
Defined in: [fetch-state/index.ts:76](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
299
|
+
Defined in: [fetch-state/index.ts:76](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L76)
|
|
289
300
|
|
|
290
301
|
Creates a fetch state of type Loading
|
|
291
302
|
|
|
@@ -299,7 +310,7 @@ Creates a fetch state of type Loading
|
|
|
299
310
|
|
|
300
311
|
> **mapFailed**\<`T`\>(`mapper`): (`state`) => [`FetchState`](#fetchstate)\<`T`\>
|
|
301
312
|
|
|
302
|
-
Defined in: [fetch-state/index.ts:
|
|
313
|
+
Defined in: [fetch-state/index.ts:131](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L131)
|
|
303
314
|
|
|
304
315
|
A Utility function that allows to map the Failed fetch state to any other fetch state.
|
|
305
316
|
The mapper function is only called if the given fetch state is Failed.
|
|
@@ -330,13 +341,25 @@ The mapper function is only called if the given fetch state is Failed.
|
|
|
330
341
|
|
|
331
342
|
[`FetchState`](#fetchstate)\<`T`\>
|
|
332
343
|
|
|
344
|
+
#### Example
|
|
345
|
+
|
|
346
|
+
```ts
|
|
347
|
+
const value = attempt(isString, "Not a String")(3);
|
|
348
|
+
const mappedValue = mapFailed<string>(state => state.error.includes("404") ? fail("Not Found") : state)(value)
|
|
349
|
+
if(isSuccess(mappedValue)){
|
|
350
|
+
console.log(mappedValue.data)
|
|
351
|
+
} else if (isFailed(mappedValue)){
|
|
352
|
+
console.error(mappedValue.error)
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
333
356
|
***
|
|
334
357
|
|
|
335
358
|
### none()
|
|
336
359
|
|
|
337
360
|
> **none**(): [`None`](#none)
|
|
338
361
|
|
|
339
|
-
Defined in: [fetch-state/index.ts:84](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
362
|
+
Defined in: [fetch-state/index.ts:84](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/fetch-state/index.ts#L84)
|
|
340
363
|
|
|
341
364
|
Creates a fetch state of type None
|
|
342
365
|
|
package/docs/guard.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**@kaumlaut/pure v0.5.
|
|
1
|
+
[**@kaumlaut/pure v0.5.2**](README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ Provides easily composable generic type guards
|
|
|
14
14
|
|
|
15
15
|
> **Guard**\<`T`\> = (`value`) => `value is T`
|
|
16
16
|
|
|
17
|
-
Defined in: [guard/index.ts:11](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
17
|
+
Defined in: [guard/index.ts:11](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L11)
|
|
18
18
|
|
|
19
19
|
Represents a type guard
|
|
20
20
|
|
|
@@ -40,7 +40,7 @@ Represents a type guard
|
|
|
40
40
|
|
|
41
41
|
> **isAll**\<`T`\>(`guards`): (`value`) => `value is T`
|
|
42
42
|
|
|
43
|
-
Defined in: [guard/index.ts:16](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
43
|
+
Defined in: [guard/index.ts:16](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L16)
|
|
44
44
|
|
|
45
45
|
Confirms that the given value passes all guards.
|
|
46
46
|
|
|
@@ -76,7 +76,7 @@ Confirms that the given value passes all guards.
|
|
|
76
76
|
|
|
77
77
|
> **isAlways**\<`T`\>(`value`): `value is T`
|
|
78
78
|
|
|
79
|
-
Defined in: [guard/index.ts:133](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
79
|
+
Defined in: [guard/index.ts:133](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L133)
|
|
80
80
|
|
|
81
81
|
Always passes.
|
|
82
82
|
|
|
@@ -102,7 +102,7 @@ Always passes.
|
|
|
102
102
|
|
|
103
103
|
> **isBool**(`value`): `value is boolean`
|
|
104
104
|
|
|
105
|
-
Defined in: [guard/index.ts:147](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
105
|
+
Defined in: [guard/index.ts:147](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L147)
|
|
106
106
|
|
|
107
107
|
Confirms the value is a boolean.
|
|
108
108
|
|
|
@@ -122,7 +122,7 @@ Confirms the value is a boolean.
|
|
|
122
122
|
|
|
123
123
|
> **isExactString**\<`T`\>(`expectedString`): (`value`) => `value is T`
|
|
124
124
|
|
|
125
|
-
Defined in: [guard/index.ts:113](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
125
|
+
Defined in: [guard/index.ts:113](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L113)
|
|
126
126
|
|
|
127
127
|
Confirms the value exactly matched the given string.
|
|
128
128
|
|
|
@@ -158,7 +158,7 @@ Confirms the value exactly matched the given string.
|
|
|
158
158
|
|
|
159
159
|
> **isFloat**(`value`): `value is number`
|
|
160
160
|
|
|
161
|
-
Defined in: [guard/index.ts:58](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
161
|
+
Defined in: [guard/index.ts:58](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L58)
|
|
162
162
|
|
|
163
163
|
Confirms that the value is a floating point number.
|
|
164
164
|
|
|
@@ -178,7 +178,7 @@ Confirms that the value is a floating point number.
|
|
|
178
178
|
|
|
179
179
|
> **isInt**(`value`): `value is number`
|
|
180
180
|
|
|
181
|
-
Defined in: [guard/index.ts:47](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
181
|
+
Defined in: [guard/index.ts:47](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L47)
|
|
182
182
|
|
|
183
183
|
Confirms that the value is an integer.
|
|
184
184
|
|
|
@@ -198,7 +198,7 @@ Confirms that the value is an integer.
|
|
|
198
198
|
|
|
199
199
|
> **isListOf**\<`T`\>(`guard`): (`value`) => `value is T[]`
|
|
200
200
|
|
|
201
|
-
Defined in: [guard/index.ts:162](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
201
|
+
Defined in: [guard/index.ts:162](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L162)
|
|
202
202
|
|
|
203
203
|
Confirms the value is a list of items that all pass the given guard.
|
|
204
204
|
Calls console.debug with an error message to improve debugging when a large type does not match.
|
|
@@ -235,7 +235,7 @@ Calls console.debug with an error message to improve debugging when a large type
|
|
|
235
235
|
|
|
236
236
|
> **isNever**\<`T`\>(`value`): `value is T`
|
|
237
237
|
|
|
238
|
-
Defined in: [guard/index.ts:140](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
238
|
+
Defined in: [guard/index.ts:140](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L140)
|
|
239
239
|
|
|
240
240
|
Never passes.
|
|
241
241
|
|
|
@@ -261,7 +261,7 @@ Never passes.
|
|
|
261
261
|
|
|
262
262
|
> **isNonEmptyListOf**\<`T`\>(`guard`): (`value`) => `value is T`
|
|
263
263
|
|
|
264
|
-
Defined in: [guard/index.ts:232](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
264
|
+
Defined in: [guard/index.ts:232](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L232)
|
|
265
265
|
|
|
266
266
|
Confirms the value is a list with atleast one item and all items match the given guard.
|
|
267
267
|
|
|
@@ -297,7 +297,7 @@ Confirms the value is a list with atleast one item and all items match the given
|
|
|
297
297
|
|
|
298
298
|
> **isNull**(`value`): `value is null`
|
|
299
299
|
|
|
300
|
-
Defined in: [guard/index.ts:154](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
300
|
+
Defined in: [guard/index.ts:154](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L154)
|
|
301
301
|
|
|
302
302
|
Confirms the value is null.
|
|
303
303
|
|
|
@@ -317,7 +317,7 @@ Confirms the value is null.
|
|
|
317
317
|
|
|
318
318
|
> **isNullOr**\<`T`\>(`guard`): (`value`) => `value is T`
|
|
319
319
|
|
|
320
|
-
Defined in: [guard/index.ts:187](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
320
|
+
Defined in: [guard/index.ts:187](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L187)
|
|
321
321
|
|
|
322
322
|
Confirms the value is either null or passes the given Guard.
|
|
323
323
|
|
|
@@ -353,7 +353,7 @@ Confirms the value is either null or passes the given Guard.
|
|
|
353
353
|
|
|
354
354
|
> **isNumber**(`value`): `value is number`
|
|
355
355
|
|
|
356
|
-
Defined in: [guard/index.ts:40](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
356
|
+
Defined in: [guard/index.ts:40](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L40)
|
|
357
357
|
|
|
358
358
|
Confirms that the value is a number.
|
|
359
359
|
|
|
@@ -373,7 +373,7 @@ Confirms that the value is a number.
|
|
|
373
373
|
|
|
374
374
|
> **isNumberBetweenInclusive**\<`T`\>(`min`, `max`): (`value`) => `value is T`
|
|
375
375
|
|
|
376
|
-
Defined in: [guard/index.ts:243](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
376
|
+
Defined in: [guard/index.ts:243](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L243)
|
|
377
377
|
|
|
378
378
|
Confirms the value is number between min and max inclusive.
|
|
379
379
|
Meaning if the value equals min or max the guard passes.
|
|
@@ -414,7 +414,7 @@ Meaning if the value equals min or max the guard passes.
|
|
|
414
414
|
|
|
415
415
|
> **isObjectWithAllKeysMatchingGuard**\<`B`, `T`\>(`guard`): (`value`) => `value is T`
|
|
416
416
|
|
|
417
|
-
Defined in: [guard/index.ts:197](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
417
|
+
Defined in: [guard/index.ts:197](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L197)
|
|
418
418
|
|
|
419
419
|
Confirms the value is an object where every value matches the given guard.
|
|
420
420
|
Calls console.debug with an error message to improve debugging when a large type does not match.
|
|
@@ -455,7 +455,7 @@ Calls console.debug with an error message to improve debugging when a large type
|
|
|
455
455
|
|
|
456
456
|
> **isObjectWithKey**\<`T`\>(`key`): (`value`) => `value is T`
|
|
457
457
|
|
|
458
|
-
Defined in: [guard/index.ts:73](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
458
|
+
Defined in: [guard/index.ts:73](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L73)
|
|
459
459
|
|
|
460
460
|
Confirms that the value is an object containing the specified key.
|
|
461
461
|
|
|
@@ -491,7 +491,7 @@ keyof `T`
|
|
|
491
491
|
|
|
492
492
|
> **isObjectWithKeys**\<`T`\>(`keys`): (`value`) => `value is T`
|
|
493
493
|
|
|
494
|
-
Defined in: [guard/index.ts:83](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
494
|
+
Defined in: [guard/index.ts:83](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L83)
|
|
495
495
|
|
|
496
496
|
Confirms that the value is an object containing the specified keys.
|
|
497
497
|
|
|
@@ -527,7 +527,7 @@ keyof `T`[]
|
|
|
527
527
|
|
|
528
528
|
> **isObjectWithKeysMatchingGuard**\<`T`\>(`guards`): (`value`) => `value is T`
|
|
529
529
|
|
|
530
|
-
Defined in: [guard/index.ts:94](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
530
|
+
Defined in: [guard/index.ts:94](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L94)
|
|
531
531
|
|
|
532
532
|
Confirms that the value is an object whose key value pairs match the corresponding type guards.
|
|
533
533
|
Calls console.debug with an error message to improve debugging when a large type does not match.
|
|
@@ -564,7 +564,7 @@ Calls console.debug with an error message to improve debugging when a large type
|
|
|
564
564
|
|
|
565
565
|
> **isOneOf**\<`T1`, `T2`\>(`a`, `b`): (`value`) => value is T1 \| T2
|
|
566
566
|
|
|
567
|
-
Defined in: [guard/index.ts:177](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
567
|
+
Defined in: [guard/index.ts:177](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L177)
|
|
568
568
|
|
|
569
569
|
Confirms the value passes at least one of the given Guards.
|
|
570
570
|
|
|
@@ -608,7 +608,7 @@ value is T1 \| T2
|
|
|
608
608
|
|
|
609
609
|
> **isOneStringOf**\<`T`\>(`validValues`): (`value`) => `value is T`
|
|
610
610
|
|
|
611
|
-
Defined in: [guard/index.ts:123](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
611
|
+
Defined in: [guard/index.ts:123](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L123)
|
|
612
612
|
|
|
613
613
|
Confirms the value is one of the given valid values.
|
|
614
614
|
|
|
@@ -644,7 +644,7 @@ Confirms the value is one of the given valid values.
|
|
|
644
644
|
|
|
645
645
|
> **isString**(`value`): `value is string`
|
|
646
646
|
|
|
647
|
-
Defined in: [guard/index.ts:23](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
647
|
+
Defined in: [guard/index.ts:23](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L23)
|
|
648
648
|
|
|
649
649
|
Confirms that the value is a string.
|
|
650
650
|
|
|
@@ -664,7 +664,7 @@ Confirms that the value is a string.
|
|
|
664
664
|
|
|
665
665
|
> **isStringOfLength**(`length`): (`value`) => `value is string`
|
|
666
666
|
|
|
667
|
-
Defined in: [guard/index.ts:30](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
667
|
+
Defined in: [guard/index.ts:30](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L30)
|
|
668
668
|
|
|
669
669
|
Confirms that the value is a string with specified length.
|
|
670
670
|
|
|
@@ -694,7 +694,7 @@ Confirms that the value is a string with specified length.
|
|
|
694
694
|
|
|
695
695
|
> **isStringWithPattern**(`pattern`): [`Guard`](#guard)\<`string`\>
|
|
696
696
|
|
|
697
|
-
Defined in: [guard/index.ts:217](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
697
|
+
Defined in: [guard/index.ts:217](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L217)
|
|
698
698
|
|
|
699
699
|
Confirms the value is a string and matches the given regular expression.
|
|
700
700
|
|
|
@@ -714,7 +714,7 @@ Confirms the value is a string and matches the given regular expression.
|
|
|
714
714
|
|
|
715
715
|
> **isUndefined**(`value`): `value is undefined`
|
|
716
716
|
|
|
717
|
-
Defined in: [guard/index.ts:225](https://github.com/maxkaemmerer/pure-vue-poc/blob/
|
|
717
|
+
Defined in: [guard/index.ts:225](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L225)
|
|
718
718
|
|
|
719
719
|
Confirms the value is undefined.
|
|
720
720
|
|