Skip to main content
Module

x/enzastdlib/schema/mod.ts>Validator

enzastdlib is a set of TypeScript modules that follow a common design API philosophy aiming at sane defaults and ease-of-use targeting the Deno TypeScript runtime.
Latest
interface Validator
import { type Validator } from "https://deno.land/x/enzastdlib@v0.0.4/schema/mod.ts";

Represents a JSON Schema validator made by makeValidator.

Type Parameters

optional
Type = unknown

Methods

instanceOf(value: Type | unknown): value is Type

Returns true if the specified value has no validation errors, otherwise false.

test(value: Type | unknown): Error[] | undefined

Returns Error objects of any validation errors that have occured regarding the specified value, if any.

validate(value: Type | unknown): value is Type

Throws an exception if any validation errors occured regarding the specified value, otherwise returns true.