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
Optimizations
Abort early
| Library | Version | /wk | Optimizations | Error type | Mean | Compare | ||||
|---|---|---|---|---|---|---|---|---|---|---|
@railway-ts/pipelines | Code snippet | 0.1.29 | n/a | None | Abort early | 16 μs | ||||
@remix-run/data-schema | Code snippet | 1.0.0 | n/a | None | Abort early | 7 μs | 2.37x | |||
effect | Code snippet(Setup code is not benchmarked) | 4.1.2 | n/a | None | Abort early | 9 μs | 1.84x | |||
joi | Code snippet | 18.3.2 | n/a | None | Abort early | 38 μs | 2.38x | |||
joi (no convert) | Code snippet | 18.3.2 | n/a | None | Abort early | 35 μs | 2.18x | |||
runtypes | Code snippet | 7.0.5 | n/a | None | Abort early | 75 μs | 4.72x | |||
runtypes (inspect) | Code snippet | 7.0.5 | n/a | None | Abort early | 73 μs | 4.56x | |||
superstruct | Code snippet | 2.0.2 | n/a | None | Abort early | 53 μs | 3.29x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | n/a | None | Abort early | 52 μs | 3.26x | |||
valibot | Code snippet | 1.5.0 | n/a | None | Abort early | 7 μs | 2.24x | |||
valibot (abortPipeEarly only) | Code snippet | 1.5.0 | n/a | None | Abort early | 7 μs | 2.23x | |||
yup | Code snippet | 1.7.1 | n/a | None | Abort early | 139 μs | 8.71x | |||
yup (strict) | Code snippet | 1.7.1 | n/a | None | Abort early | 114 μs | 7.15x | |||