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

x/hono/validator/validator.ts>VBase

Ultrafast web framework for Cloudflare Workers, Deno, and Bun. Fast, but not only fast.
Extremely Popular
Go to Latest
class VBase
Abstract
import { VBase } from "https://deno.land/x/hono@v2.5.5/validator/validator.ts";

Constructors

new
VBase(options: VOptions)

Properties

private
_nested: () => unknown
private
_optional: boolean
private
getMessage: (opts: { ruleName: string; value: Type; }) => string
private
sanitizeValue: (value: Type) => unknown
private
validateType: (value: Type) => boolean
private
validateValue: (func: (value: Type) => boolean, value: Type) => boolean
addSanitizer: (sanitizer: Sanitizer) => unknown
asBoolean: () => VBoolean | VBooleanArray
asNumber: () => VNumber | VNumberArray
baseKeys: string[]
isArray: boolean
isEqual: (comparison: unknown) => unknown
isOptional: () => unknown
isRequired: () => unknown
key: string
message: (text: string) => unknown
rules: Rule[]
sanitizers: Sanitizer[]
target: Target
type:
| "string"
| "number"
| "boolean"
| "object"
validate: <R extends Request>(req: R) => Promise<ValidateResult[]>

Methods

private
validateRule(rule: Rule, value: Type): ValidateResult
protected
getTypeRuleName(): string
addRule(func: RuleFunc): this
addRule(name: string, func: RuleFunc): this
get(value: string)