@kaumlaut/pure 0.5.2 → 1.0.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/LICENSE +21 -0
- package/README.md +1 -1
- package/package.json +12 -4
- package/docs/README.md +0 -23
- package/docs/clone.md +0 -45
- package/docs/fetch-state.md +0 -368
- package/docs/guard.md +0 -729
- package/docs/maybe.md +0 -481
- package/docs/parse.md +0 -47
- package/docs/pipe.md +0 -95
- package/docs/result.md +0 -363
- package/docs/runtime/effect/fetch.md +0 -169
- package/docs/runtime/effect/none.md +0 -19
- package/docs/runtime/effect.md +0 -179
- package/docs/runtime/persistence/none.md +0 -29
- package/docs/runtime/persistence/storage.md +0 -39
- package/docs/runtime/persistence.md +0 -63
- package/docs/runtime.md +0 -167
- package/docs/util.md +0 -33
package/docs/maybe.md
DELETED
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
[**@kaumlaut/pure v0.5.2**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@kaumlaut/pure](README.md) / maybe
|
|
6
|
-
|
|
7
|
-
# maybe
|
|
8
|
-
|
|
9
|
-
Provides types representing the Maybe concept as well as functions to work with it.
|
|
10
|
-
|
|
11
|
-
## Type Aliases
|
|
12
|
-
|
|
13
|
-
### Just\<T\>
|
|
14
|
-
|
|
15
|
-
> **Just**\<`T`\> = `object`
|
|
16
|
-
|
|
17
|
-
Defined in: [maybe/index.ts:18](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L18)
|
|
18
|
-
|
|
19
|
-
Represents a Maybe containing a value.
|
|
20
|
-
|
|
21
|
-
#### Example
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
if (isJust(maybe)) {
|
|
25
|
-
// the isJust guard tells typescript that maybe has a value of type number
|
|
26
|
-
console.log("Something here: " + maybe.value)
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
#### Type Parameters
|
|
31
|
-
|
|
32
|
-
##### T
|
|
33
|
-
|
|
34
|
-
`T`
|
|
35
|
-
|
|
36
|
-
#### Properties
|
|
37
|
-
|
|
38
|
-
##### type
|
|
39
|
-
|
|
40
|
-
> **type**: `"maybe-just"`
|
|
41
|
-
|
|
42
|
-
Defined in: [maybe/index.ts:19](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L19)
|
|
43
|
-
|
|
44
|
-
##### value
|
|
45
|
-
|
|
46
|
-
> **value**: `T`
|
|
47
|
-
|
|
48
|
-
Defined in: [maybe/index.ts:20](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L20)
|
|
49
|
-
|
|
50
|
-
***
|
|
51
|
-
|
|
52
|
-
### Maybe\<T\>
|
|
53
|
-
|
|
54
|
-
> **Maybe**\<`T`\> = [`Just`](#just)\<`T`\> \| [`Nothing`](#nothing)
|
|
55
|
-
|
|
56
|
-
Defined in: [maybe/index.ts:38](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L38)
|
|
57
|
-
|
|
58
|
-
Represents the Maybe type.
|
|
59
|
-
|
|
60
|
-
#### Type Parameters
|
|
61
|
-
|
|
62
|
-
##### T
|
|
63
|
-
|
|
64
|
-
`T`
|
|
65
|
-
|
|
66
|
-
***
|
|
67
|
-
|
|
68
|
-
### Nothing
|
|
69
|
-
|
|
70
|
-
> **Nothing** = `object`
|
|
71
|
-
|
|
72
|
-
Defined in: [maybe/index.ts:31](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L31)
|
|
73
|
-
|
|
74
|
-
Represents a Maybe not containing a value.
|
|
75
|
-
|
|
76
|
-
#### Example
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
if (isNothing(maybe)) {
|
|
80
|
-
// no value property exists on maybe
|
|
81
|
-
console.log("Nothing here")
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
#### Properties
|
|
86
|
-
|
|
87
|
-
##### type
|
|
88
|
-
|
|
89
|
-
> **type**: `"maybe-nothing"`
|
|
90
|
-
|
|
91
|
-
Defined in: [maybe/index.ts:32](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L32)
|
|
92
|
-
|
|
93
|
-
## Functions
|
|
94
|
-
|
|
95
|
-
### filter()
|
|
96
|
-
|
|
97
|
-
> **filter**\<`T`\>(`func`): (`maybe`) => [`Maybe`](#maybe)\<`T`\>
|
|
98
|
-
|
|
99
|
-
Defined in: [maybe/index.ts:99](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L99)
|
|
100
|
-
|
|
101
|
-
Converts the given Maybe into a Nothing if it is Just but does not pass the given function.
|
|
102
|
-
|
|
103
|
-
#### Type Parameters
|
|
104
|
-
|
|
105
|
-
##### T
|
|
106
|
-
|
|
107
|
-
`T`
|
|
108
|
-
|
|
109
|
-
#### Parameters
|
|
110
|
-
|
|
111
|
-
##### func
|
|
112
|
-
|
|
113
|
-
(`value`) => `boolean`
|
|
114
|
-
|
|
115
|
-
#### Returns
|
|
116
|
-
|
|
117
|
-
> (`maybe`): [`Maybe`](#maybe)\<`T`\>
|
|
118
|
-
|
|
119
|
-
##### Parameters
|
|
120
|
-
|
|
121
|
-
###### maybe
|
|
122
|
-
|
|
123
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
124
|
-
|
|
125
|
-
##### Returns
|
|
126
|
-
|
|
127
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
128
|
-
|
|
129
|
-
***
|
|
130
|
-
|
|
131
|
-
### isJust()
|
|
132
|
-
|
|
133
|
-
> **isJust**\<`T`\>(`maybe`): `maybe is Just<T>`
|
|
134
|
-
|
|
135
|
-
Defined in: [maybe/index.ts:69](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L69)
|
|
136
|
-
|
|
137
|
-
A Guard confirming that the given maybe value is a Just.
|
|
138
|
-
|
|
139
|
-
#### Type Parameters
|
|
140
|
-
|
|
141
|
-
##### T
|
|
142
|
-
|
|
143
|
-
`T`
|
|
144
|
-
|
|
145
|
-
#### Parameters
|
|
146
|
-
|
|
147
|
-
##### maybe
|
|
148
|
-
|
|
149
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
150
|
-
|
|
151
|
-
#### Returns
|
|
152
|
-
|
|
153
|
-
`maybe is Just<T>`
|
|
154
|
-
|
|
155
|
-
***
|
|
156
|
-
|
|
157
|
-
### isMaybe()
|
|
158
|
-
|
|
159
|
-
> **isMaybe**\<`T`\>(`value`): `value is Maybe<T>`
|
|
160
|
-
|
|
161
|
-
Defined in: [maybe/index.ts:76](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L76)
|
|
162
|
-
|
|
163
|
-
A Guard confirming that the given value is a Maybe.
|
|
164
|
-
|
|
165
|
-
#### Type Parameters
|
|
166
|
-
|
|
167
|
-
##### T
|
|
168
|
-
|
|
169
|
-
`T`
|
|
170
|
-
|
|
171
|
-
#### Parameters
|
|
172
|
-
|
|
173
|
-
##### value
|
|
174
|
-
|
|
175
|
-
`unknown`
|
|
176
|
-
|
|
177
|
-
#### Returns
|
|
178
|
-
|
|
179
|
-
`value is Maybe<T>`
|
|
180
|
-
|
|
181
|
-
***
|
|
182
|
-
|
|
183
|
-
### isNothing()
|
|
184
|
-
|
|
185
|
-
> **isNothing**\<`T`\>(`maybe`): `maybe is Nothing`
|
|
186
|
-
|
|
187
|
-
Defined in: [maybe/index.ts:62](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L62)
|
|
188
|
-
|
|
189
|
-
A Guard confirming that the given maybe value is a Nothing.
|
|
190
|
-
|
|
191
|
-
#### Type Parameters
|
|
192
|
-
|
|
193
|
-
##### T
|
|
194
|
-
|
|
195
|
-
`T`
|
|
196
|
-
|
|
197
|
-
#### Parameters
|
|
198
|
-
|
|
199
|
-
##### maybe
|
|
200
|
-
|
|
201
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
202
|
-
|
|
203
|
-
#### Returns
|
|
204
|
-
|
|
205
|
-
`maybe is Nothing`
|
|
206
|
-
|
|
207
|
-
***
|
|
208
|
-
|
|
209
|
-
### just()
|
|
210
|
-
|
|
211
|
-
> **just**\<`T`\>(`value`): [`Just`](#just)\<`T`\>
|
|
212
|
-
|
|
213
|
-
Defined in: [maybe/index.ts:52](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L52)
|
|
214
|
-
|
|
215
|
-
Creates a maybe containing a value. (Just)
|
|
216
|
-
|
|
217
|
-
#### Type Parameters
|
|
218
|
-
|
|
219
|
-
##### T
|
|
220
|
-
|
|
221
|
-
`T`
|
|
222
|
-
|
|
223
|
-
#### Parameters
|
|
224
|
-
|
|
225
|
-
##### value
|
|
226
|
-
|
|
227
|
-
`T`
|
|
228
|
-
|
|
229
|
-
#### Returns
|
|
230
|
-
|
|
231
|
-
[`Just`](#just)\<`T`\>
|
|
232
|
-
|
|
233
|
-
***
|
|
234
|
-
|
|
235
|
-
### map()
|
|
236
|
-
|
|
237
|
-
> **map**\<`T`, `R`\>(`func`): (`maybe`) => [`Maybe`](#maybe)\<`R`\>
|
|
238
|
-
|
|
239
|
-
Defined in: [maybe/index.ts:84](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L84)
|
|
240
|
-
|
|
241
|
-
Applies the func function to the value if the given Maybe is a Just and returns it wrapped in a Just. Otherwise returns the given Maybe.
|
|
242
|
-
|
|
243
|
-
#### Type Parameters
|
|
244
|
-
|
|
245
|
-
##### T
|
|
246
|
-
|
|
247
|
-
`T`
|
|
248
|
-
|
|
249
|
-
##### R
|
|
250
|
-
|
|
251
|
-
`R`
|
|
252
|
-
|
|
253
|
-
#### Parameters
|
|
254
|
-
|
|
255
|
-
##### func
|
|
256
|
-
|
|
257
|
-
(`value`) => `R`
|
|
258
|
-
|
|
259
|
-
#### Returns
|
|
260
|
-
|
|
261
|
-
> (`maybe`): [`Maybe`](#maybe)\<`R`\>
|
|
262
|
-
|
|
263
|
-
##### Parameters
|
|
264
|
-
|
|
265
|
-
###### maybe
|
|
266
|
-
|
|
267
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
268
|
-
|
|
269
|
-
##### Returns
|
|
270
|
-
|
|
271
|
-
[`Maybe`](#maybe)\<`R`\>
|
|
272
|
-
|
|
273
|
-
***
|
|
274
|
-
|
|
275
|
-
### mapToMaybe()
|
|
276
|
-
|
|
277
|
-
> **mapToMaybe**\<`T`, `R`\>(`func`): (`maybe`) => [`Maybe`](#maybe)\<`R`\>
|
|
278
|
-
|
|
279
|
-
Defined in: [maybe/index.ts:150](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L150)
|
|
280
|
-
|
|
281
|
-
Maps the a value contained within a Just using the given function without wrapping it in another Just.
|
|
282
|
-
Returns the given Maybe if it is a Nothing.
|
|
283
|
-
|
|
284
|
-
#### Type Parameters
|
|
285
|
-
|
|
286
|
-
##### T
|
|
287
|
-
|
|
288
|
-
`T`
|
|
289
|
-
|
|
290
|
-
##### R
|
|
291
|
-
|
|
292
|
-
`R`
|
|
293
|
-
|
|
294
|
-
#### Parameters
|
|
295
|
-
|
|
296
|
-
##### func
|
|
297
|
-
|
|
298
|
-
(`value`) => [`Maybe`](#maybe)\<`R`\>
|
|
299
|
-
|
|
300
|
-
#### Returns
|
|
301
|
-
|
|
302
|
-
> (`maybe`): [`Maybe`](#maybe)\<`R`\>
|
|
303
|
-
|
|
304
|
-
##### Parameters
|
|
305
|
-
|
|
306
|
-
###### maybe
|
|
307
|
-
|
|
308
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
309
|
-
|
|
310
|
-
##### Returns
|
|
311
|
-
|
|
312
|
-
[`Maybe`](#maybe)\<`R`\>
|
|
313
|
-
|
|
314
|
-
***
|
|
315
|
-
|
|
316
|
-
### maybeByGuard()
|
|
317
|
-
|
|
318
|
-
> **maybeByGuard**\<`T`\>(`guard`): (`value`) => [`Maybe`](#maybe)\<`T`\>
|
|
319
|
-
|
|
320
|
-
Defined in: [maybe/index.ts:140](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L140)
|
|
321
|
-
|
|
322
|
-
Creates a Just if the Guard passes for the given value. Otherwise Creates a Nothing.
|
|
323
|
-
|
|
324
|
-
#### Type Parameters
|
|
325
|
-
|
|
326
|
-
##### T
|
|
327
|
-
|
|
328
|
-
`T`
|
|
329
|
-
|
|
330
|
-
#### Parameters
|
|
331
|
-
|
|
332
|
-
##### guard
|
|
333
|
-
|
|
334
|
-
[`Guard`](guard.md#guard)\<`T`\>
|
|
335
|
-
|
|
336
|
-
#### Returns
|
|
337
|
-
|
|
338
|
-
> (`value`): [`Maybe`](#maybe)\<`T`\>
|
|
339
|
-
|
|
340
|
-
##### Parameters
|
|
341
|
-
|
|
342
|
-
###### value
|
|
343
|
-
|
|
344
|
-
`unknown`
|
|
345
|
-
|
|
346
|
-
##### Returns
|
|
347
|
-
|
|
348
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
349
|
-
|
|
350
|
-
***
|
|
351
|
-
|
|
352
|
-
### nothing()
|
|
353
|
-
|
|
354
|
-
> **nothing**(): [`Nothing`](#nothing)
|
|
355
|
-
|
|
356
|
-
Defined in: [maybe/index.ts:43](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L43)
|
|
357
|
-
|
|
358
|
-
Creates a maybe not containing a value. (Nothing)
|
|
359
|
-
|
|
360
|
-
#### Returns
|
|
361
|
-
|
|
362
|
-
[`Nothing`](#nothing)
|
|
363
|
-
|
|
364
|
-
***
|
|
365
|
-
|
|
366
|
-
### toResult()
|
|
367
|
-
|
|
368
|
-
> **toResult**\<`T`, `E`\>(`error`): (`maybe`) => [`Result`](result.md#result)\<`T`, `E`\>
|
|
369
|
-
|
|
370
|
-
Defined in: [maybe/index.ts:133](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L133)
|
|
371
|
-
|
|
372
|
-
Converts the given Maybe to a Result.
|
|
373
|
-
A Nothing becomes an Err with the given error.
|
|
374
|
-
A Just becomes an Ok with the contained value.
|
|
375
|
-
|
|
376
|
-
#### Type Parameters
|
|
377
|
-
|
|
378
|
-
##### T
|
|
379
|
-
|
|
380
|
-
`T`
|
|
381
|
-
|
|
382
|
-
##### E
|
|
383
|
-
|
|
384
|
-
`E`
|
|
385
|
-
|
|
386
|
-
#### Parameters
|
|
387
|
-
|
|
388
|
-
##### error
|
|
389
|
-
|
|
390
|
-
`E`
|
|
391
|
-
|
|
392
|
-
#### Returns
|
|
393
|
-
|
|
394
|
-
> (`maybe`): [`Result`](result.md#result)\<`T`, `E`\>
|
|
395
|
-
|
|
396
|
-
##### Parameters
|
|
397
|
-
|
|
398
|
-
###### maybe
|
|
399
|
-
|
|
400
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
401
|
-
|
|
402
|
-
##### Returns
|
|
403
|
-
|
|
404
|
-
[`Result`](result.md#result)\<`T`, `E`\>
|
|
405
|
-
|
|
406
|
-
***
|
|
407
|
-
|
|
408
|
-
### tryMap()
|
|
409
|
-
|
|
410
|
-
> **tryMap**\<`T`, `R`\>(`func`): (`maybe`) => [`Maybe`](#maybe)\<`R`\>
|
|
411
|
-
|
|
412
|
-
Defined in: [maybe/index.ts:166](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L166)
|
|
413
|
-
|
|
414
|
-
Maps the a value contained within a Just using the given function without wrapping it in another Just.
|
|
415
|
-
Returns the given Maybe if it is a Nothing.
|
|
416
|
-
|
|
417
|
-
#### Type Parameters
|
|
418
|
-
|
|
419
|
-
##### T
|
|
420
|
-
|
|
421
|
-
`T`
|
|
422
|
-
|
|
423
|
-
##### R
|
|
424
|
-
|
|
425
|
-
`R`
|
|
426
|
-
|
|
427
|
-
#### Parameters
|
|
428
|
-
|
|
429
|
-
##### func
|
|
430
|
-
|
|
431
|
-
(`value`) => `R`
|
|
432
|
-
|
|
433
|
-
#### Returns
|
|
434
|
-
|
|
435
|
-
> (`maybe`): [`Maybe`](#maybe)\<`R`\>
|
|
436
|
-
|
|
437
|
-
##### Parameters
|
|
438
|
-
|
|
439
|
-
###### maybe
|
|
440
|
-
|
|
441
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
442
|
-
|
|
443
|
-
##### Returns
|
|
444
|
-
|
|
445
|
-
[`Maybe`](#maybe)\<`R`\>
|
|
446
|
-
|
|
447
|
-
***
|
|
448
|
-
|
|
449
|
-
### withDefault()
|
|
450
|
-
|
|
451
|
-
> **withDefault**\<`T`\>(`defaultValue`): (`maybe`) => `T`
|
|
452
|
-
|
|
453
|
-
Defined in: [maybe/index.ts:118](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/maybe/index.ts#L118)
|
|
454
|
-
|
|
455
|
-
Unwraps a Maybe, returning the value if it is a Just or the default value if it is a Nothing.
|
|
456
|
-
|
|
457
|
-
#### Type Parameters
|
|
458
|
-
|
|
459
|
-
##### T
|
|
460
|
-
|
|
461
|
-
`T`
|
|
462
|
-
|
|
463
|
-
#### Parameters
|
|
464
|
-
|
|
465
|
-
##### defaultValue
|
|
466
|
-
|
|
467
|
-
`T`
|
|
468
|
-
|
|
469
|
-
#### Returns
|
|
470
|
-
|
|
471
|
-
> (`maybe`): `T`
|
|
472
|
-
|
|
473
|
-
##### Parameters
|
|
474
|
-
|
|
475
|
-
###### maybe
|
|
476
|
-
|
|
477
|
-
[`Maybe`](#maybe)\<`T`\>
|
|
478
|
-
|
|
479
|
-
##### Returns
|
|
480
|
-
|
|
481
|
-
`T`
|
package/docs/parse.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
[**@kaumlaut/pure v0.5.2**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@kaumlaut/pure](README.md) / parse
|
|
6
|
-
|
|
7
|
-
# parse
|
|
8
|
-
|
|
9
|
-
## Functions
|
|
10
|
-
|
|
11
|
-
### asFloat()
|
|
12
|
-
|
|
13
|
-
> **asFloat**(`value`): [`Result`](result.md#result)\<`number`, `string`\>
|
|
14
|
-
|
|
15
|
-
Defined in: [parse/index.ts:19](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/parse/index.ts#L19)
|
|
16
|
-
|
|
17
|
-
Attempts to parse a string as an float. Returning ok if successful or err if not.
|
|
18
|
-
|
|
19
|
-
#### Parameters
|
|
20
|
-
|
|
21
|
-
##### value
|
|
22
|
-
|
|
23
|
-
`string`
|
|
24
|
-
|
|
25
|
-
#### Returns
|
|
26
|
-
|
|
27
|
-
[`Result`](result.md#result)\<`number`, `string`\>
|
|
28
|
-
|
|
29
|
-
***
|
|
30
|
-
|
|
31
|
-
### asInt()
|
|
32
|
-
|
|
33
|
-
> **asInt**(`value`): [`Result`](result.md#result)\<`number`, `string`\>
|
|
34
|
-
|
|
35
|
-
Defined in: [parse/index.ts:6](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/parse/index.ts#L6)
|
|
36
|
-
|
|
37
|
-
Attempts to parse a string as an interger. Returning ok if successful or err if not.
|
|
38
|
-
|
|
39
|
-
#### Parameters
|
|
40
|
-
|
|
41
|
-
##### value
|
|
42
|
-
|
|
43
|
-
`string`
|
|
44
|
-
|
|
45
|
-
#### Returns
|
|
46
|
-
|
|
47
|
-
[`Result`](result.md#result)\<`number`, `string`\>
|
package/docs/pipe.md
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
[**@kaumlaut/pure v0.5.2**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@kaumlaut/pure](README.md) / pipe
|
|
6
|
-
|
|
7
|
-
# pipe
|
|
8
|
-
|
|
9
|
-
## Type Aliases
|
|
10
|
-
|
|
11
|
-
### Pipe\<IT\>
|
|
12
|
-
|
|
13
|
-
> **Pipe**\<`IT`\> = `object`
|
|
14
|
-
|
|
15
|
-
Defined in: [pipe/index.ts:4](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/pipe/index.ts#L4)
|
|
16
|
-
|
|
17
|
-
Represents a function pipeline
|
|
18
|
-
|
|
19
|
-
#### Type Parameters
|
|
20
|
-
|
|
21
|
-
##### IT
|
|
22
|
-
|
|
23
|
-
`IT`
|
|
24
|
-
|
|
25
|
-
#### Properties
|
|
26
|
-
|
|
27
|
-
##### into()
|
|
28
|
-
|
|
29
|
-
> **into**: \<`RT`\>(`func`) => [`Pipe`](#pipe)\<`RT`\>
|
|
30
|
-
|
|
31
|
-
Defined in: [pipe/index.ts:5](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/pipe/index.ts#L5)
|
|
32
|
-
|
|
33
|
-
###### Type Parameters
|
|
34
|
-
|
|
35
|
-
###### RT
|
|
36
|
-
|
|
37
|
-
`RT`
|
|
38
|
-
|
|
39
|
-
###### Parameters
|
|
40
|
-
|
|
41
|
-
###### func
|
|
42
|
-
|
|
43
|
-
(`input`) => `RT`
|
|
44
|
-
|
|
45
|
-
###### Returns
|
|
46
|
-
|
|
47
|
-
[`Pipe`](#pipe)\<`RT`\>
|
|
48
|
-
|
|
49
|
-
##### out()
|
|
50
|
-
|
|
51
|
-
> **out**: () => `IT`
|
|
52
|
-
|
|
53
|
-
Defined in: [pipe/index.ts:6](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/pipe/index.ts#L6)
|
|
54
|
-
|
|
55
|
-
###### Returns
|
|
56
|
-
|
|
57
|
-
`IT`
|
|
58
|
-
|
|
59
|
-
## Functions
|
|
60
|
-
|
|
61
|
-
### put()
|
|
62
|
-
|
|
63
|
-
> **put**\<`IT`\>(`data`): [`Pipe`](#pipe)\<`IT`\>
|
|
64
|
-
|
|
65
|
-
Defined in: [pipe/index.ts:20](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/pipe/index.ts#L20)
|
|
66
|
-
|
|
67
|
-
Creates a Pipe that allows you to chain multiple functions using into.
|
|
68
|
-
Is meant to make larger functions more readable.
|
|
69
|
-
|
|
70
|
-
#### Type Parameters
|
|
71
|
-
|
|
72
|
-
##### IT
|
|
73
|
-
|
|
74
|
-
`IT`
|
|
75
|
-
|
|
76
|
-
#### Parameters
|
|
77
|
-
|
|
78
|
-
##### data
|
|
79
|
-
|
|
80
|
-
`IT`
|
|
81
|
-
|
|
82
|
-
#### Returns
|
|
83
|
-
|
|
84
|
-
[`Pipe`](#pipe)\<`IT`\>
|
|
85
|
-
|
|
86
|
-
#### Example
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
const output = put("3")
|
|
90
|
-
.into(asInt)
|
|
91
|
-
.into(toMaybe)
|
|
92
|
-
.into(withDefault(0))
|
|
93
|
-
.into((input) => input * 3.14)
|
|
94
|
-
.into((input) => input.toPrecision());
|
|
95
|
-
```
|