@_agco/types

1.0.1 • Public • Published

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);

Package Sidebar

Install

npm i @_agco/types

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.67 kB

Total Files

5

Last publish

Collaborators

  • _ajaygupta