Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/valibot/src/methods/safeParser/index.ts>safeParser

The modular and type safe schema library for validating structural data 🤖
Latest
function safeParser
import { safeParser } from "https://deno.land/x/valibot@v1.0.0-beta.5/src/methods/safeParser/index.ts";

Returns a function that parses an unknown input based on a schema.

Type Parameters

TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>

Parameters

schema: TSchema

The schema to be used.

Returns

SafeParser<TSchema, undefined>

The parser function.

Returns a function that parses an unknown input based on a schema.

Type Parameters

TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>
TConfig extends Config<InferIssue<TSchema>> | undefined

Parameters

schema: TSchema

The schema to be used.

config: TConfig

The parser configuration.

Returns

The parser function.