Skip to main content
Module

x/unknownutil/mod.ts

🦕 A lightweight utility pack for handling unknown type
Go to Latest
import * as unknownutil from "https://deno.land/x/unknownutil@v3.1.1/mod.ts";

Classes

Represents an error that occurs when an assertion fails.

Functions

Asserts that the given value satisfies the provided predicate.

Ensures that the given value satisfies the provided predicate.

Return true if the type of x is unknown[].

Return a type predicate function that returns true if the type of x is T[].

Return true if the type of x is bigint.

Return true if the type of x is boolean.

Return true if the type of x is function.

Return true if the type of x is instance of ctor.

Return true if the type of x is null.

Return true if the type of x is null or undefined.

Return true if the type of x is number.

Return a type predicate function that returns true if the type of x is ObjectOf<T>. When options.strict is true, the number of keys of x must be equal to the number of keys of predObj. Otherwise, the number of keys of x must be greater than or equal to the number of keys of predObj.

Return a type predicate function that returns true if the type of x is OneOf<T>.

Return true if the type of x is RecordOf<unknown>.

Return a type predicate function that returns true if the type of x is RecordOf<T>.

Return true if the type of x is string.

Return true if the type of x is symbol.

Return a type predicate function that returns true if the type of x is TupleOf<T>.

Return true if the type of x is undefined.

Returns the input value if it satisfies the provided predicate, or undefined otherwise.

Type Aliases

A type predicate function

Synonym of Record<string | number | symbol, T>