JSPM

typeverifier

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q27671F
  • License GPL-2.0

Small utility class to get and check variable types

Package Exports

  • typeverifier

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (typeverifier) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

typeverifier

Small utility class to get and check variable types.

Instalation

You can directly install it via npm using npm install typeverifier command.

In ES6 syntax you would import it with the command: import typeverifier from 'typeverifier';.

In ES5 syntax you would write: var typeverifier = require('typeverifier');

Usage

Let's presume you've imported the module using ES6 modules.

import typeverifier from 'typeverifier';

The following methods are available and return true or false.

  • typeverifier.defined(val) - Whether val is an defined or not (not undefined or null)
  • typeverifier.null(val) - Whether val is null
  • typeverifier.string(val) - Whether val is a String or not
  • typeverifier.number(val) - Whether val is a Number or not
  • typeverifier.boolean(val) - Whether val is a Boolean or not
  • typeverifier.array(val) - Whether val is an Array or not
  • typeverifier.object(val) - Whether val is an Object or not
  • typeverifier.emptyObject(val) - Whether val is an empty Object or not
  • typeverifier.regex(val) - Whether val is a RegExp or not
  • typeverifier.date(val) - Whether val is a Date or not
  • typeverifier.func(val) - Whether val is a Function or not
  • typeverifier.error(val) - Whether val is an Error or not
  • typeverifier.instanceOf(val, name) - Whether val is an instance of the class whose name is identical to the name parameter