Parsing a value to match the schema. This is different to validation because it returns a new value.
import * as v from "valibot";
import { personSchema } from "./schemas";
const person = v.parse(personSchema, data);
// person is of type Person
| Library | Version | Optimizations | Error type | Mean | Compare | |||
|---|---|---|---|---|---|---|---|---|
zod | Code snippet | 4.1.12 | JIT | All errors | 9 μs | |||
zod (mini) | Code snippet | 4.1.12 | JIT | All errors | 12 μs | 1.35x | ||
typebox (compile) | Code snippet(Commented code is not benchmarked) | 1.0.51 | JIT | All errors | 249 μs | 28.9x |