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 | ||||
|---|---|---|---|---|---|---|---|---|---|---|
ata-validator | Code snippet | 1.21.0 | 2.75K | JIT | All errors | 73 ns | ||||
sury (asResult + compiled) | Code snippet(Setup code is not benchmarked) | 11.0.0 | 333.97K | JIT | All errors | 9 μs | 120.77x | |||
sury (parseOrThrow + compiled) | Code snippet(Setup code is not benchmarked) | 11.0.0 | 333.97K | JIT | All errors | 10 μs | 131.59x | |||
sury (asResult) | Code snippet | 11.0.0 | 333.97K | JIT | All errors | 10 μs | 142.84x | |||
sury | Code snippet | 11.0.0 | 333.97K | JIT | All errors | 11 μs | 145.22x | |||
zod | Code snippet | 4.6.5 | 209.22M | JIT | All errors | 12 μs | 169.5x | |||
zod (compile) | Code snippet | 4.6.5 | 209.22M | JIT | All errors | 13 μs | 175.14x | |||
zod/mini | Code snippet | 4.6.5 | 209.22M | JIT | All errors | 21 μs | 288.84x | |||
zod/mini (compile) | Code snippet | 4.6.5 | 209.22M | JIT | All errors | 22 μs | 296.54x | |||
typebox (schema compile) | Code snippet(Setup code is not benchmarked) | 1.3.30 | 9.44M | JIT | All errors | 24 μs | 327.43x | |||
typebox (script compile) | Code snippet(Setup code is not benchmarked) | 1.3.30 | 9.44M | JIT | All errors | 25 μs | 341.95x | |||
typebox (schema) | Code snippet | 1.3.30 | 9.44M | JIT | All errors | 27 μs | 372.19x | |||
typebox (compile) | Code snippet(Setup code is not benchmarked) | 1.3.30 | 9.44M | JIT | All errors | 32 μs | 442.71x | |||
typebox | Code snippet | 1.3.30 | 9.44M | JIT | All errors | 37 μs | 511.49x | |||
arktype | Code snippet | 2.2.3 | 1.48M | JIT | All errors | 97 μs | 1_333.44x | |||