Skip to main content
Module

x/is_what/src/index.ts

JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.
Go to Latest
import * as isWhat from "https://deno.land/x/is_what@v4.1.15-0/src/index.ts";

Variables

Returns true whether the payload is null or undefined

Functions

Returns the object type of the given payload

Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)

Returns whether the payload is an array

Returns whether the payload is a Blob

Returns whether the payload is a boolean

Returns whether the payload is a Date, and that the date is valid

Returns whether the payload is a an empty array

Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)

Returns whether the payload is ''

Returns whether the payload is an Error

Returns whether the payload is a File

Returns whether the payload is a an array with at least 1 item

Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)

Returns whether the payload is a string, BUT returns false for ''

Returns whether the payload is a function (regular or async)

Checks if a value is an instance of a class or a class name. Useful when you want to check if a value is an instance of a class that may not be defined in the current scope. For example, if you want to check if a value is an OffscreenCanvas instance, you might not want to do the song and dance of using typeof OffscreenCanvas !== 'undefined' and then shimming OffscreenCanvas if the types aren't around.

Returns whether the payload is a Map

Returns whether the payload is literally the value NaN (it's NaN and also a number)

Returns whether the payload is a negative number (but not 0)

Returns whether the payload is null

Returns whether the payload is a number (but not NaN)

Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)

Returns whether the payload is an object like a type passed in < >

A factory function that creates a function to check if the payload is one of the given types.

Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)

Returns whether the payload is a positive number (but not 0)

Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)

Returns whether the payload is a Promise

Returns whether the payload is a regular expression (RegExp)

Returns whether the payload is a Set

Returns whether the payload is a string

Returns whether the payload is a Symbol

Does a generic check to check that the given payload is of a given type. In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!); It will, however, differentiate between object and null

Returns whether the payload is undefined

Returns whether the payload is a WeakMap

Returns whether the payload is a WeakSet