Create runtime-checked structs with Zod
| node_modules | ||
| .gitignore | ||
| index.js | ||
| LICENSE.md | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
zod-struct
Create runtime-checked structs with Zod.
Usage
import Struct from "zod-struct"
import { z } from "zod"
const Person = new Struct(z.object({
name: z.string(),
email: z.string().email()
}))
const alice = new Person({
name: "Alice",
email: "[email protected]"
})
// Checks validity with schema on property change
alice.name = "Alice Example"