JSPM

typeverifier

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q20779F
  • License WTFPL-2.0

Small utility to 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 to check variable types.

Usage

typeverifier is available as an npm package. Simply run npm install typeverifier command.

To use it in your project:

import typeverifier from 'typeverifier'; // ES6 syntax
var typeverifier = require('typeverifier'); // ES5 syntax

API

The following methods are available and return true or false.

  1. defined(val): Whether val is an defined or not (different from undefined or null)

  2. null(val): Whether val is null

  3. string(val): Whether val is a String or not

  4. number(val): Whether val is a Number or not

  5. boolean(val): Whether val is a Boolean or not

  6. array(val): Whether val is an Array or not

  7. object(val): Whether val is an Object literal or not (different from undefined or null)

  8. emptyObject(val): Whether val is an empty Object literal or not

  9. regex(val): Whether val is a RegExp or not

  10. date(val): Whether val is a Date or not

  11. func(val): Whether val is a Function or not

  12. error(val): Whether val is an Error or not

  13. instanceOf(val, name): Whether val is an instance of the class whose name is identical to the name parameter. Do not use this class to check primitives, Arrays, Functions, Dates, RegExps, Objects, etc (rely on instanceof for those cases). Use it only for developer authored classes.

License

This software is released under the terms of WTFPL v2.0 license.