Checking if a given value matches the schema. This is different to parsing because it doesn't return a new value.
Copy to clipboardimport * as v from "valibot"; import { personSchema } from "./schemas"; if (v.is(personSchema, data)) { // data is narrowed to Person }
Optimizations
| Library | Version | Downloads (/wk) | Optimizations | Mean | Compare | ||||
|---|---|---|---|---|---|---|---|---|---|
typia (createIs) | Code snippet(Commented code is not benchmarked) | 12.0.2 | 259.06K | Precompiled | 50 ns | ||||
typia (is) | Code snippet | 12.0.2 | 259.06K | Precompiled | 65 ns | 1.29x | |||