Skip to main content
Module

x/silicon/deps.ts>ensure

Deno module to generate images from source code using Aloxaf/silicon.
Latest
function ensure
import { ensure } from "https://deno.land/x/silicon@v1.0.0/deps.ts";

Ensures that the given value satisfies the provided predicate.

import { ensure } from "./util.ts";
import is from "./is.ts";

const a: unknown = "hello";
const _: string = ensure(a, is.String);

Parameters

x: unknown

The value to be ensured.

pred: Predicate<T>

The predicate function to test the value against.

optional
options: { message?: string; name?: string; } = [UNSUPPORTED]

Optional configuration for the assertion.

Returns

The input value x.