1.0.3 • Public • Published


Small utility to check variable types.


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


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.


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

Package Sidebar


npm i typeverifier

Weekly Downloads






Last publish


  • thereignn