@_agco/types

a tiny type checking library

Usage no npm install needed!

<script type="module">
  import AgcoTypes from 'https://cdn.skypack.dev/@_agco/types';
</script>

README

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