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.9.0/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 a type predicate function that returns true if the type of x is AllOf<T>.

Always return true regardless of the type of x.

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 a type predicate function that returns true if the type of x is a literal type of pred.

Return a type predicate function that returns true if the type of x is one of literal type in preds.

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>. If is.OptionalOf() is specified in the predicate function, the property becomes optional. 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 a type predicate function that returns true if the type of x is T or undefined.

Return true if the type of x is Primitive.

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.

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

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

Sets the factory function used to generate assertion error messages.

Type Aliases

A type predicate function

A type predicated by Predicate

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