Skip to main content
Module

x/abstruct/mod.ts>TypeValidator

Abstract structure for JavaScript data validation
Go to Latest
class TypeValidator
extends IsValidator<unknown, TypeMap[RIn]>
import { TypeValidator } from "https://deno.land/x/abstruct@1.0.0-beta.12/mod.ts";

Validator for JavaScript data type. It executes typeof like operator. The difference with typeof operator is that "object" does not match null.

Examples

Example 1

import { TypeValidator } from "https://deno.land/x/abstruct@$VERSION/validators/operators/typeof.ts";
const iterable =new TypeValidator("string").validate(0);

Constructors

new
TypeValidator(of: RIn)

Methods

is(input: unknown): input is TypeMap[RIn]
toString(): string