import { assert } from "https://deno.land/x/abstruct@1.0.0/validation.ts";
Assert that the input passes validator.
Examples
Example 1
Example 1
import {
assert,
number,
props,
string,
ValidationError,
} from "https://deno.land/x/abstruct@$VERSION/mod.ts";
import {
assertEquals,
assertIsError,
} from "https://deno.land/std/testing/asserts.ts";
const Profile = props({ name: string, age: number });
try {
assert(Profile, { name: null, age: null });
} catch (e) {
assertIsError(e, ValidationError, "<string validation message>");
}
Parameters
input: In
optional
options: Readonly<SingleAssertOptions | MultiAssertOptions> = [UNSUPPORTED]