Parsing a value to match the schema. This is different to validation because it returns a typed value, instead of a boolean.
Copy to clipboardimport * as v from "valibot"; import { personSchema } from "./schemas"; const person = v.parse( personSchema, data, ); // person is of type Person
Copy to clipboardimport * as v from "valibot"; import { personSchema } from "./schemas"; const person = v.parse(personSchema, data); // person is of type Person
| Library | Version | /wk | Optimizations | Error type | Mean | Compare | ||||
|---|---|---|---|---|---|---|---|---|---|---|
@paseri/compiler (parse) | Code snippet | 0.7.7 | 924 | Precompiled | All errors | 4 μs | ||||
@paseri/compiler (safeParse) | Code snippet | 0.7.7 | 924 | Precompiled | All errors | 1 μs | 3.34x | |||
typia (createValidate) | Code snippet(Setup code is not benchmarked) | 15.1.0 | n/a | Precompiled | All errors | 11 μs | 3x | |||
typia (validate) | Code snippet | 15.1.0 | n/a | Precompiled | All errors | 12 μs | 3.21x | |||
zod-compiler | Code snippet | 2.0.7 | n/a | Precompiled | All errors | 48 ns | 76x | |||
zod-compiler (bag) | Code snippet | 2.0.7 | n/a | Precompiled | All errors | 48 ns | 75.49x | |||
zod-compiler (compact) | Code snippet | 2.0.7 | n/a | Precompiled | All errors | 48 ns | 75.99x | |||