@nerd-bible/valio 0.0.10 → 0.0.11
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 +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# valio
|
|
2
2
|
|
|
3
|
-
Encode and decode
|
|
3
|
+
Encode and decode Typescript types with extensible error handling.
|
|
4
4
|
|
|
5
5
|
## Why?
|
|
6
6
|
|
|
7
7
|
I like [Zod](https://zod.dev), but its codecs don't support
|
|
8
|
-
[custom error contexts.](https://github.com/colinhacks/zod/issues/)
|
|
8
|
+
[custom error contexts.](https://github.com/colinhacks/zod/issues/) I tried
|
|
9
|
+
adding support to Zod but found it easier to start from scratch.
|
|
9
10
|
|
|
10
11
|
## Theory
|
|
11
12
|
|
|
@@ -54,6 +55,7 @@ expect(schema.encode(3)).toEqual({
|
|
|
54
55
|
```
|
|
55
56
|
|
|
56
57
|
There are common builtin codecs for coercion.
|
|
58
|
+
|
|
57
59
|
```ts
|
|
58
60
|
import * as v from "@nerd-bible/valio";
|
|
59
61
|
|
|
@@ -121,5 +123,3 @@ expect(schema.decode(3, new MyContext())).toEqual({
|
|
|
121
123
|
errors: { ".": [{ input: 3, message: "You done messed up" }] },
|
|
122
124
|
});
|
|
123
125
|
```
|
|
124
|
-
|
|
125
|
-
Those are the highlights. Read the `.test.ts` files for the rest.
|