Utilities for checking types.
Install the package by running the following command in terminal:
npm install @deox/check-types
The module can be imported using import
in ES Modules and require
in Common JS as shown below:
ES Modules:
// index.ts
import { isPlainObject } from "@deox/check-types";
// ...
Common JS:
// index.cjs
const { isPlainObject } = require("@deox/check-types");
// ...
Following functions are available:
-
getClass(input)
: Returns the name of constructor class ofinput
as string. -
isNull(arg)
: Checks whetherarg
isnull
or not -
isArray(arg)
: Check whetherarg
is anArray
-
isString(arg)
: Check whetherarg
is aString
-
isFunction(arg)
: Check whetherarg
is aFunction
-
isBigInt(arg)
: Check whetherarg
is aBigInt
-
isSymbol(arg)
: Check whetherarg
is aSymbol
-
isBoolean(arg)
: Check whetherarg
is aBoolean
-
isUndefined(arg)
: Check whetherarg
isundefined
-
isNumberAny(arg)
: Check whetherarg
is aNumber
includingNaN
andInfinity
-
isNaN(arg)
: Check whetherarg
isNaN
-
isFinite(arg)
: Check whetherarg
isNumber
and isFinite -
isNumber(arg)
: Check whetherarg
is aNumber
excludingNaN
andInfinity
-
isObjectAny(arg)
: Check whetherarg
is anObject
includingnull
-
isObject(arg)
: Check whetherarg
is anObject
excludingnull
andArray
-
isPlainObject(arg)
: Check whetherarg
is a plain object -
isRegExp(arg)
: Check whetherarg
is aRegExp
-
isDate(arg)
: Check whetherarg
is aDate
-
isURL(arg)
: Check whetherarg
is anURL
-
isError(arg)
: Check whetherarg
is anError