@kaumlaut/pure 0.5.0 → 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 +23 -0
- package/docs/clone.md +45 -0
- package/docs/fetch-state.md +368 -0
- package/docs/guard.md +729 -0
- package/docs/maybe.md +481 -0
- package/docs/parse.md +47 -0
- package/docs/pipe.md +95 -0
- package/docs/result.md +363 -0
- package/docs/runtime/effect/fetch.md +169 -0
- package/docs/runtime/effect/none.md +19 -0
- package/docs/runtime/effect.md +179 -0
- package/docs/runtime/persistence/none.md +29 -0
- package/docs/runtime/persistence/storage.md +39 -0
- package/docs/runtime/persistence.md +63 -0
- package/docs/runtime.md +167 -0
- package/docs/util.md +33 -0
- package/package.json +5 -3
- 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/docs/guard.md
ADDED
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
[**@kaumlaut/pure v0.5.2**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@kaumlaut/pure](README.md) / guard
|
|
6
|
+
|
|
7
|
+
# guard
|
|
8
|
+
|
|
9
|
+
Provides easily composable generic type guards
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### Guard()\<T\>
|
|
14
|
+
|
|
15
|
+
> **Guard**\<`T`\> = (`value`) => `value is T`
|
|
16
|
+
|
|
17
|
+
Defined in: [guard/index.ts:11](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L11)
|
|
18
|
+
|
|
19
|
+
Represents a type guard
|
|
20
|
+
|
|
21
|
+
#### Type Parameters
|
|
22
|
+
|
|
23
|
+
##### T
|
|
24
|
+
|
|
25
|
+
`T`
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
##### value
|
|
30
|
+
|
|
31
|
+
`unknown`
|
|
32
|
+
|
|
33
|
+
#### Returns
|
|
34
|
+
|
|
35
|
+
`value is T`
|
|
36
|
+
|
|
37
|
+
## Functions
|
|
38
|
+
|
|
39
|
+
### isAll()
|
|
40
|
+
|
|
41
|
+
> **isAll**\<`T`\>(`guards`): (`value`) => `value is T`
|
|
42
|
+
|
|
43
|
+
Defined in: [guard/index.ts:16](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L16)
|
|
44
|
+
|
|
45
|
+
Confirms that the given value passes all guards.
|
|
46
|
+
|
|
47
|
+
#### Type Parameters
|
|
48
|
+
|
|
49
|
+
##### T
|
|
50
|
+
|
|
51
|
+
`T`
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
##### guards
|
|
56
|
+
|
|
57
|
+
[`Guard`](#guard)\<`T`\>[]
|
|
58
|
+
|
|
59
|
+
#### Returns
|
|
60
|
+
|
|
61
|
+
> (`value`): `value is T`
|
|
62
|
+
|
|
63
|
+
##### Parameters
|
|
64
|
+
|
|
65
|
+
###### value
|
|
66
|
+
|
|
67
|
+
`unknown`
|
|
68
|
+
|
|
69
|
+
##### Returns
|
|
70
|
+
|
|
71
|
+
`value is T`
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### isAlways()
|
|
76
|
+
|
|
77
|
+
> **isAlways**\<`T`\>(`value`): `value is T`
|
|
78
|
+
|
|
79
|
+
Defined in: [guard/index.ts:133](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L133)
|
|
80
|
+
|
|
81
|
+
Always passes.
|
|
82
|
+
|
|
83
|
+
#### Type Parameters
|
|
84
|
+
|
|
85
|
+
##### T
|
|
86
|
+
|
|
87
|
+
`T`
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### value
|
|
92
|
+
|
|
93
|
+
`unknown`
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`value is T`
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
### isBool()
|
|
102
|
+
|
|
103
|
+
> **isBool**(`value`): `value is boolean`
|
|
104
|
+
|
|
105
|
+
Defined in: [guard/index.ts:147](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L147)
|
|
106
|
+
|
|
107
|
+
Confirms the value is a boolean.
|
|
108
|
+
|
|
109
|
+
#### Parameters
|
|
110
|
+
|
|
111
|
+
##### value
|
|
112
|
+
|
|
113
|
+
`unknown`
|
|
114
|
+
|
|
115
|
+
#### Returns
|
|
116
|
+
|
|
117
|
+
`value is boolean`
|
|
118
|
+
|
|
119
|
+
***
|
|
120
|
+
|
|
121
|
+
### isExactString()
|
|
122
|
+
|
|
123
|
+
> **isExactString**\<`T`\>(`expectedString`): (`value`) => `value is T`
|
|
124
|
+
|
|
125
|
+
Defined in: [guard/index.ts:113](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L113)
|
|
126
|
+
|
|
127
|
+
Confirms the value exactly matched the given string.
|
|
128
|
+
|
|
129
|
+
#### Type Parameters
|
|
130
|
+
|
|
131
|
+
##### T
|
|
132
|
+
|
|
133
|
+
`T` *extends* `string`
|
|
134
|
+
|
|
135
|
+
#### Parameters
|
|
136
|
+
|
|
137
|
+
##### expectedString
|
|
138
|
+
|
|
139
|
+
`string`
|
|
140
|
+
|
|
141
|
+
#### Returns
|
|
142
|
+
|
|
143
|
+
> (`value`): `value is T`
|
|
144
|
+
|
|
145
|
+
##### Parameters
|
|
146
|
+
|
|
147
|
+
###### value
|
|
148
|
+
|
|
149
|
+
`unknown`
|
|
150
|
+
|
|
151
|
+
##### Returns
|
|
152
|
+
|
|
153
|
+
`value is T`
|
|
154
|
+
|
|
155
|
+
***
|
|
156
|
+
|
|
157
|
+
### isFloat()
|
|
158
|
+
|
|
159
|
+
> **isFloat**(`value`): `value is number`
|
|
160
|
+
|
|
161
|
+
Defined in: [guard/index.ts:58](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L58)
|
|
162
|
+
|
|
163
|
+
Confirms that the value is a floating point number.
|
|
164
|
+
|
|
165
|
+
#### Parameters
|
|
166
|
+
|
|
167
|
+
##### value
|
|
168
|
+
|
|
169
|
+
`unknown`
|
|
170
|
+
|
|
171
|
+
#### Returns
|
|
172
|
+
|
|
173
|
+
`value is number`
|
|
174
|
+
|
|
175
|
+
***
|
|
176
|
+
|
|
177
|
+
### isInt()
|
|
178
|
+
|
|
179
|
+
> **isInt**(`value`): `value is number`
|
|
180
|
+
|
|
181
|
+
Defined in: [guard/index.ts:47](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L47)
|
|
182
|
+
|
|
183
|
+
Confirms that the value is an integer.
|
|
184
|
+
|
|
185
|
+
#### Parameters
|
|
186
|
+
|
|
187
|
+
##### value
|
|
188
|
+
|
|
189
|
+
`unknown`
|
|
190
|
+
|
|
191
|
+
#### Returns
|
|
192
|
+
|
|
193
|
+
`value is number`
|
|
194
|
+
|
|
195
|
+
***
|
|
196
|
+
|
|
197
|
+
### isListOf()
|
|
198
|
+
|
|
199
|
+
> **isListOf**\<`T`\>(`guard`): (`value`) => `value is T[]`
|
|
200
|
+
|
|
201
|
+
Defined in: [guard/index.ts:162](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L162)
|
|
202
|
+
|
|
203
|
+
Confirms the value is a list of items that all pass the given guard.
|
|
204
|
+
Calls console.debug with an error message to improve debugging when a large type does not match.
|
|
205
|
+
|
|
206
|
+
#### Type Parameters
|
|
207
|
+
|
|
208
|
+
##### T
|
|
209
|
+
|
|
210
|
+
`T`
|
|
211
|
+
|
|
212
|
+
#### Parameters
|
|
213
|
+
|
|
214
|
+
##### guard
|
|
215
|
+
|
|
216
|
+
[`Guard`](#guard)\<`T`\>
|
|
217
|
+
|
|
218
|
+
#### Returns
|
|
219
|
+
|
|
220
|
+
> (`value`): `value is T[]`
|
|
221
|
+
|
|
222
|
+
##### Parameters
|
|
223
|
+
|
|
224
|
+
###### value
|
|
225
|
+
|
|
226
|
+
`unknown`
|
|
227
|
+
|
|
228
|
+
##### Returns
|
|
229
|
+
|
|
230
|
+
`value is T[]`
|
|
231
|
+
|
|
232
|
+
***
|
|
233
|
+
|
|
234
|
+
### isNever()
|
|
235
|
+
|
|
236
|
+
> **isNever**\<`T`\>(`value`): `value is T`
|
|
237
|
+
|
|
238
|
+
Defined in: [guard/index.ts:140](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L140)
|
|
239
|
+
|
|
240
|
+
Never passes.
|
|
241
|
+
|
|
242
|
+
#### Type Parameters
|
|
243
|
+
|
|
244
|
+
##### T
|
|
245
|
+
|
|
246
|
+
`T`
|
|
247
|
+
|
|
248
|
+
#### Parameters
|
|
249
|
+
|
|
250
|
+
##### value
|
|
251
|
+
|
|
252
|
+
`unknown`
|
|
253
|
+
|
|
254
|
+
#### Returns
|
|
255
|
+
|
|
256
|
+
`value is T`
|
|
257
|
+
|
|
258
|
+
***
|
|
259
|
+
|
|
260
|
+
### isNonEmptyListOf()
|
|
261
|
+
|
|
262
|
+
> **isNonEmptyListOf**\<`T`\>(`guard`): (`value`) => `value is T`
|
|
263
|
+
|
|
264
|
+
Defined in: [guard/index.ts:232](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L232)
|
|
265
|
+
|
|
266
|
+
Confirms the value is a list with atleast one item and all items match the given guard.
|
|
267
|
+
|
|
268
|
+
#### Type Parameters
|
|
269
|
+
|
|
270
|
+
##### T
|
|
271
|
+
|
|
272
|
+
`T`
|
|
273
|
+
|
|
274
|
+
#### Parameters
|
|
275
|
+
|
|
276
|
+
##### guard
|
|
277
|
+
|
|
278
|
+
[`Guard`](#guard)\<`T`\>
|
|
279
|
+
|
|
280
|
+
#### Returns
|
|
281
|
+
|
|
282
|
+
> (`value`): `value is T`
|
|
283
|
+
|
|
284
|
+
##### Parameters
|
|
285
|
+
|
|
286
|
+
###### value
|
|
287
|
+
|
|
288
|
+
`unknown`
|
|
289
|
+
|
|
290
|
+
##### Returns
|
|
291
|
+
|
|
292
|
+
`value is T`
|
|
293
|
+
|
|
294
|
+
***
|
|
295
|
+
|
|
296
|
+
### isNull()
|
|
297
|
+
|
|
298
|
+
> **isNull**(`value`): `value is null`
|
|
299
|
+
|
|
300
|
+
Defined in: [guard/index.ts:154](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L154)
|
|
301
|
+
|
|
302
|
+
Confirms the value is null.
|
|
303
|
+
|
|
304
|
+
#### Parameters
|
|
305
|
+
|
|
306
|
+
##### value
|
|
307
|
+
|
|
308
|
+
`unknown`
|
|
309
|
+
|
|
310
|
+
#### Returns
|
|
311
|
+
|
|
312
|
+
`value is null`
|
|
313
|
+
|
|
314
|
+
***
|
|
315
|
+
|
|
316
|
+
### isNullOr()
|
|
317
|
+
|
|
318
|
+
> **isNullOr**\<`T`\>(`guard`): (`value`) => `value is T`
|
|
319
|
+
|
|
320
|
+
Defined in: [guard/index.ts:187](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L187)
|
|
321
|
+
|
|
322
|
+
Confirms the value is either null or passes the given Guard.
|
|
323
|
+
|
|
324
|
+
#### Type Parameters
|
|
325
|
+
|
|
326
|
+
##### T
|
|
327
|
+
|
|
328
|
+
`T`
|
|
329
|
+
|
|
330
|
+
#### Parameters
|
|
331
|
+
|
|
332
|
+
##### guard
|
|
333
|
+
|
|
334
|
+
[`Guard`](#guard)\<`T`\>
|
|
335
|
+
|
|
336
|
+
#### Returns
|
|
337
|
+
|
|
338
|
+
> (`value`): `value is T`
|
|
339
|
+
|
|
340
|
+
##### Parameters
|
|
341
|
+
|
|
342
|
+
###### value
|
|
343
|
+
|
|
344
|
+
`unknown`
|
|
345
|
+
|
|
346
|
+
##### Returns
|
|
347
|
+
|
|
348
|
+
`value is T`
|
|
349
|
+
|
|
350
|
+
***
|
|
351
|
+
|
|
352
|
+
### isNumber()
|
|
353
|
+
|
|
354
|
+
> **isNumber**(`value`): `value is number`
|
|
355
|
+
|
|
356
|
+
Defined in: [guard/index.ts:40](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L40)
|
|
357
|
+
|
|
358
|
+
Confirms that the value is a number.
|
|
359
|
+
|
|
360
|
+
#### Parameters
|
|
361
|
+
|
|
362
|
+
##### value
|
|
363
|
+
|
|
364
|
+
`unknown`
|
|
365
|
+
|
|
366
|
+
#### Returns
|
|
367
|
+
|
|
368
|
+
`value is number`
|
|
369
|
+
|
|
370
|
+
***
|
|
371
|
+
|
|
372
|
+
### isNumberBetweenInclusive()
|
|
373
|
+
|
|
374
|
+
> **isNumberBetweenInclusive**\<`T`\>(`min`, `max`): (`value`) => `value is T`
|
|
375
|
+
|
|
376
|
+
Defined in: [guard/index.ts:243](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L243)
|
|
377
|
+
|
|
378
|
+
Confirms the value is number between min and max inclusive.
|
|
379
|
+
Meaning if the value equals min or max the guard passes.
|
|
380
|
+
|
|
381
|
+
#### Type Parameters
|
|
382
|
+
|
|
383
|
+
##### T
|
|
384
|
+
|
|
385
|
+
`T`
|
|
386
|
+
|
|
387
|
+
#### Parameters
|
|
388
|
+
|
|
389
|
+
##### min
|
|
390
|
+
|
|
391
|
+
`number`
|
|
392
|
+
|
|
393
|
+
##### max
|
|
394
|
+
|
|
395
|
+
`number`
|
|
396
|
+
|
|
397
|
+
#### Returns
|
|
398
|
+
|
|
399
|
+
> (`value`): `value is T`
|
|
400
|
+
|
|
401
|
+
##### Parameters
|
|
402
|
+
|
|
403
|
+
###### value
|
|
404
|
+
|
|
405
|
+
`unknown`
|
|
406
|
+
|
|
407
|
+
##### Returns
|
|
408
|
+
|
|
409
|
+
`value is T`
|
|
410
|
+
|
|
411
|
+
***
|
|
412
|
+
|
|
413
|
+
### isObjectWithAllKeysMatchingGuard()
|
|
414
|
+
|
|
415
|
+
> **isObjectWithAllKeysMatchingGuard**\<`B`, `T`\>(`guard`): (`value`) => `value is T`
|
|
416
|
+
|
|
417
|
+
Defined in: [guard/index.ts:197](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L197)
|
|
418
|
+
|
|
419
|
+
Confirms the value is an object where every value matches the given guard.
|
|
420
|
+
Calls console.debug with an error message to improve debugging when a large type does not match.
|
|
421
|
+
|
|
422
|
+
#### Type Parameters
|
|
423
|
+
|
|
424
|
+
##### B
|
|
425
|
+
|
|
426
|
+
`B`
|
|
427
|
+
|
|
428
|
+
##### T
|
|
429
|
+
|
|
430
|
+
`T` *extends* `object`
|
|
431
|
+
|
|
432
|
+
#### Parameters
|
|
433
|
+
|
|
434
|
+
##### guard
|
|
435
|
+
|
|
436
|
+
[`Guard`](#guard)\<`B`\>
|
|
437
|
+
|
|
438
|
+
#### Returns
|
|
439
|
+
|
|
440
|
+
> (`value`): `value is T`
|
|
441
|
+
|
|
442
|
+
##### Parameters
|
|
443
|
+
|
|
444
|
+
###### value
|
|
445
|
+
|
|
446
|
+
`unknown`
|
|
447
|
+
|
|
448
|
+
##### Returns
|
|
449
|
+
|
|
450
|
+
`value is T`
|
|
451
|
+
|
|
452
|
+
***
|
|
453
|
+
|
|
454
|
+
### isObjectWithKey()
|
|
455
|
+
|
|
456
|
+
> **isObjectWithKey**\<`T`\>(`key`): (`value`) => `value is T`
|
|
457
|
+
|
|
458
|
+
Defined in: [guard/index.ts:73](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L73)
|
|
459
|
+
|
|
460
|
+
Confirms that the value is an object containing the specified key.
|
|
461
|
+
|
|
462
|
+
#### Type Parameters
|
|
463
|
+
|
|
464
|
+
##### T
|
|
465
|
+
|
|
466
|
+
`T` *extends* `object`
|
|
467
|
+
|
|
468
|
+
#### Parameters
|
|
469
|
+
|
|
470
|
+
##### key
|
|
471
|
+
|
|
472
|
+
keyof `T`
|
|
473
|
+
|
|
474
|
+
#### Returns
|
|
475
|
+
|
|
476
|
+
> (`value`): `value is T`
|
|
477
|
+
|
|
478
|
+
##### Parameters
|
|
479
|
+
|
|
480
|
+
###### value
|
|
481
|
+
|
|
482
|
+
`unknown`
|
|
483
|
+
|
|
484
|
+
##### Returns
|
|
485
|
+
|
|
486
|
+
`value is T`
|
|
487
|
+
|
|
488
|
+
***
|
|
489
|
+
|
|
490
|
+
### isObjectWithKeys()
|
|
491
|
+
|
|
492
|
+
> **isObjectWithKeys**\<`T`\>(`keys`): (`value`) => `value is T`
|
|
493
|
+
|
|
494
|
+
Defined in: [guard/index.ts:83](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L83)
|
|
495
|
+
|
|
496
|
+
Confirms that the value is an object containing the specified keys.
|
|
497
|
+
|
|
498
|
+
#### Type Parameters
|
|
499
|
+
|
|
500
|
+
##### T
|
|
501
|
+
|
|
502
|
+
`T` *extends* `object`
|
|
503
|
+
|
|
504
|
+
#### Parameters
|
|
505
|
+
|
|
506
|
+
##### keys
|
|
507
|
+
|
|
508
|
+
keyof `T`[]
|
|
509
|
+
|
|
510
|
+
#### Returns
|
|
511
|
+
|
|
512
|
+
> (`value`): `value is T`
|
|
513
|
+
|
|
514
|
+
##### Parameters
|
|
515
|
+
|
|
516
|
+
###### value
|
|
517
|
+
|
|
518
|
+
`unknown`
|
|
519
|
+
|
|
520
|
+
##### Returns
|
|
521
|
+
|
|
522
|
+
`value is T`
|
|
523
|
+
|
|
524
|
+
***
|
|
525
|
+
|
|
526
|
+
### isObjectWithKeysMatchingGuard()
|
|
527
|
+
|
|
528
|
+
> **isObjectWithKeysMatchingGuard**\<`T`\>(`guards`): (`value`) => `value is T`
|
|
529
|
+
|
|
530
|
+
Defined in: [guard/index.ts:94](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L94)
|
|
531
|
+
|
|
532
|
+
Confirms that the value is an object whose key value pairs match the corresponding type guards.
|
|
533
|
+
Calls console.debug with an error message to improve debugging when a large type does not match.
|
|
534
|
+
|
|
535
|
+
#### Type Parameters
|
|
536
|
+
|
|
537
|
+
##### T
|
|
538
|
+
|
|
539
|
+
`T` *extends* `object`
|
|
540
|
+
|
|
541
|
+
#### Parameters
|
|
542
|
+
|
|
543
|
+
##### guards
|
|
544
|
+
|
|
545
|
+
\{ \[K in string \| number \| symbol\]: Guard\<T\[K\]\> \}
|
|
546
|
+
|
|
547
|
+
#### Returns
|
|
548
|
+
|
|
549
|
+
> (`value`): `value is T`
|
|
550
|
+
|
|
551
|
+
##### Parameters
|
|
552
|
+
|
|
553
|
+
###### value
|
|
554
|
+
|
|
555
|
+
`unknown`
|
|
556
|
+
|
|
557
|
+
##### Returns
|
|
558
|
+
|
|
559
|
+
`value is T`
|
|
560
|
+
|
|
561
|
+
***
|
|
562
|
+
|
|
563
|
+
### isOneOf()
|
|
564
|
+
|
|
565
|
+
> **isOneOf**\<`T1`, `T2`\>(`a`, `b`): (`value`) => value is T1 \| T2
|
|
566
|
+
|
|
567
|
+
Defined in: [guard/index.ts:177](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L177)
|
|
568
|
+
|
|
569
|
+
Confirms the value passes at least one of the given Guards.
|
|
570
|
+
|
|
571
|
+
#### Type Parameters
|
|
572
|
+
|
|
573
|
+
##### T1
|
|
574
|
+
|
|
575
|
+
`T1`
|
|
576
|
+
|
|
577
|
+
##### T2
|
|
578
|
+
|
|
579
|
+
`T2`
|
|
580
|
+
|
|
581
|
+
#### Parameters
|
|
582
|
+
|
|
583
|
+
##### a
|
|
584
|
+
|
|
585
|
+
[`Guard`](#guard)\<`T1`\>
|
|
586
|
+
|
|
587
|
+
##### b
|
|
588
|
+
|
|
589
|
+
[`Guard`](#guard)\<`T2`\>
|
|
590
|
+
|
|
591
|
+
#### Returns
|
|
592
|
+
|
|
593
|
+
> (`value`): value is T1 \| T2
|
|
594
|
+
|
|
595
|
+
##### Parameters
|
|
596
|
+
|
|
597
|
+
###### value
|
|
598
|
+
|
|
599
|
+
`unknown`
|
|
600
|
+
|
|
601
|
+
##### Returns
|
|
602
|
+
|
|
603
|
+
value is T1 \| T2
|
|
604
|
+
|
|
605
|
+
***
|
|
606
|
+
|
|
607
|
+
### isOneStringOf()
|
|
608
|
+
|
|
609
|
+
> **isOneStringOf**\<`T`\>(`validValues`): (`value`) => `value is T`
|
|
610
|
+
|
|
611
|
+
Defined in: [guard/index.ts:123](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L123)
|
|
612
|
+
|
|
613
|
+
Confirms the value is one of the given valid values.
|
|
614
|
+
|
|
615
|
+
#### Type Parameters
|
|
616
|
+
|
|
617
|
+
##### T
|
|
618
|
+
|
|
619
|
+
`T` *extends* `string`
|
|
620
|
+
|
|
621
|
+
#### Parameters
|
|
622
|
+
|
|
623
|
+
##### validValues
|
|
624
|
+
|
|
625
|
+
`string`[]
|
|
626
|
+
|
|
627
|
+
#### Returns
|
|
628
|
+
|
|
629
|
+
> (`value`): `value is T`
|
|
630
|
+
|
|
631
|
+
##### Parameters
|
|
632
|
+
|
|
633
|
+
###### value
|
|
634
|
+
|
|
635
|
+
`unknown`
|
|
636
|
+
|
|
637
|
+
##### Returns
|
|
638
|
+
|
|
639
|
+
`value is T`
|
|
640
|
+
|
|
641
|
+
***
|
|
642
|
+
|
|
643
|
+
### isString()
|
|
644
|
+
|
|
645
|
+
> **isString**(`value`): `value is string`
|
|
646
|
+
|
|
647
|
+
Defined in: [guard/index.ts:23](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L23)
|
|
648
|
+
|
|
649
|
+
Confirms that the value is a string.
|
|
650
|
+
|
|
651
|
+
#### Parameters
|
|
652
|
+
|
|
653
|
+
##### value
|
|
654
|
+
|
|
655
|
+
`unknown`
|
|
656
|
+
|
|
657
|
+
#### Returns
|
|
658
|
+
|
|
659
|
+
`value is string`
|
|
660
|
+
|
|
661
|
+
***
|
|
662
|
+
|
|
663
|
+
### isStringOfLength()
|
|
664
|
+
|
|
665
|
+
> **isStringOfLength**(`length`): (`value`) => `value is string`
|
|
666
|
+
|
|
667
|
+
Defined in: [guard/index.ts:30](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L30)
|
|
668
|
+
|
|
669
|
+
Confirms that the value is a string with specified length.
|
|
670
|
+
|
|
671
|
+
#### Parameters
|
|
672
|
+
|
|
673
|
+
##### length
|
|
674
|
+
|
|
675
|
+
`number`
|
|
676
|
+
|
|
677
|
+
#### Returns
|
|
678
|
+
|
|
679
|
+
> (`value`): `value is string`
|
|
680
|
+
|
|
681
|
+
##### Parameters
|
|
682
|
+
|
|
683
|
+
###### value
|
|
684
|
+
|
|
685
|
+
`unknown`
|
|
686
|
+
|
|
687
|
+
##### Returns
|
|
688
|
+
|
|
689
|
+
`value is string`
|
|
690
|
+
|
|
691
|
+
***
|
|
692
|
+
|
|
693
|
+
### isStringWithPattern()
|
|
694
|
+
|
|
695
|
+
> **isStringWithPattern**(`pattern`): [`Guard`](#guard)\<`string`\>
|
|
696
|
+
|
|
697
|
+
Defined in: [guard/index.ts:217](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L217)
|
|
698
|
+
|
|
699
|
+
Confirms the value is a string and matches the given regular expression.
|
|
700
|
+
|
|
701
|
+
#### Parameters
|
|
702
|
+
|
|
703
|
+
##### pattern
|
|
704
|
+
|
|
705
|
+
`RegExp`
|
|
706
|
+
|
|
707
|
+
#### Returns
|
|
708
|
+
|
|
709
|
+
[`Guard`](#guard)\<`string`\>
|
|
710
|
+
|
|
711
|
+
***
|
|
712
|
+
|
|
713
|
+
### isUndefined()
|
|
714
|
+
|
|
715
|
+
> **isUndefined**(`value`): `value is undefined`
|
|
716
|
+
|
|
717
|
+
Defined in: [guard/index.ts:225](https://github.com/maxkaemmerer/pure-vue-poc/blob/1f00f47d2f3c329e3dda9a01eb5ed8ebf93253d3/pure/src/guard/index.ts#L225)
|
|
718
|
+
|
|
719
|
+
Confirms the value is undefined.
|
|
720
|
+
|
|
721
|
+
#### Parameters
|
|
722
|
+
|
|
723
|
+
##### value
|
|
724
|
+
|
|
725
|
+
`unknown`
|
|
726
|
+
|
|
727
|
+
#### Returns
|
|
728
|
+
|
|
729
|
+
`value is undefined`
|