Checking if a given value matches the schema. This is different to parsing because it doesn't return a new value.
import * as v from "valibot";
import { personSchema } from "./schemas";
if (v.is(personSchema, data)) {
// data is narrowed to Person
}
Optimizations
| Library | Version | Optimizations | Mean | Compare | |||
|---|---|---|---|---|---|---|---|
typia (createIs) | Code snippet(Commented code is not benchmarked) | 10.0.2 | Precompiled | 1 μs | |||
typia (is) | Code snippet | 10.0.2 | Precompiled | 1 μs | 1.07x |