1.0.1 • Published 5 years ago

@_agco/types v1.0.1

Weekly downloads
1
License
MIT
Repository
bitbucket
Last release
5 years ago

types.js

A tiny type checking library written in JavaScript.

Usage

The library exposes different APIs for checking data types. Each of the APIs accept only one parameter and returns a boolean value.


isArray(value: any)

Checks if the provided value is an Array.

const Result = Types.isArray([]);

isBoolean(value: any)

Checks if the provided value is a boolean.

const Result = Types.isBoolean(true);

isFunction(value: any)

Checks if the provided value is a function.

const Result = Types.isFunction(() => undefined);

isNumber(value: any)

Checks if the provided value is a number.

const Result = Types.isNumber(123);

isObject(value: any)

Checks if the provided value is an object (including arrays).

const Result = Types.isObject({});

isString(value: any)

Checks if the provided value is a string.

const Result = Types.isString(123);

isSymbol(value: any)

Checks if the provided value is a symbol.

const Result = Types.isSymbol(Symbol(1));

isUndefined(value: any)

Checks if the provided value is of type undefined.

const Result = Types.isUndefined(undefined);
1.0.1

5 years ago