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 | ||||
|---|---|---|---|---|---|---|---|---|---|---|
@railway-ts/pipelines | Code snippet | 0.1.29 | 148 | None | Abort early | 480 ns | ||||
@remix-run/data-schema | Code snippet | 1.0.0 | 14.55K | None | Abort early | 270 ns | 1.78x | |||
effect | Code snippet(Setup code is not benchmarked) | 4.0.1 | 51.26M | None | Abort early | 670 ns | 1.4x | |||
joi | Code snippet | 18.2.9 | 31.1M | None | Abort early | 3 μs | 6.54x | |||
joi (no convert) | Code snippet | 18.2.9 | 31.1M | None | Abort early | 3 μs | 6.42x | |||
runtypes | Code snippet | 7.0.5 | n/a | None | Abort early | 138 μs | 286.7x | |||
runtypes (inspect) | Code snippet | 7.0.5 | n/a | None | Abort early | 126 μs | 262.59x | |||
superstruct | Code snippet | 2.0.2 | 7.87M | None | Abort early | 5 μs | 11.06x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 7.87M | None | Abort early | 5 μs | 11.12x | |||
valibot | Code snippet | 1.5.0 | 25.54M | None | Abort early | 412 ns | 1.16x | |||
valibot (abortPipeEarly only) | Code snippet | 1.5.0 | 25.54M | None | Abort early | 8 μs | 17.33x | |||
yup | Code snippet | 1.7.1 | n/a | None | Abort early | 57 μs | 118.24x | |||
yup (strict) | Code snippet | 1.7.1 | n/a | None | Abort early | 39 μs | 80.84x | |||