Skip to main content
Go to Latest
method matches.Validator.isA
Re-export
import { matches } from "https://deno.land/x/embassyd_sdk@v0.3.1.1.4/mod.ts";
const { Validator } = matches;

This is a constructor helper that can use a predicate tester in the form of a guard function, and will return a parser that will only parse if the predicate returns true. https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types

Type Parameters

A
B extends A

Parameters

checkIsA: (value: A) => value is B
name: string

Returns

Parser<A, B>