Is

is

This is a definitive JavaScript type testing library.

Get it: npm install is

Sample usage:

1
2
3
4
5
6
7
8
9
var is = require('is');
is.type(true, 'boolean');
is.type(1, 'boolean');
is.type(1, 'number');
is.type([], 'object');
is.array([]);
is.odd(9);
is.even(2);
// So on...

It has all uber cool is checks as below:

[ 'type', 'a', 'defined', 'empty', 'equal', 'hosted', 'instanceof', 'instance', 'null', 'nil', 'undefined', 'undef', 'arguments', 'args', 'array', 'arraylike', 'boolean', 'false', 'true', 'date', 'element', 'error', 'function', 'fn', 'number', 'infinite', 'decimal', 'divisibleBy', 'int', 'maximum', 'minimum', 'nan', 'even', 'odd', 'ge', 'gt', 'le', 'lt', 'within', 'object', 'hash', 'regexp', 'string' ]

GIT FTW:

is

Thanks to Enrico Marino for is :)

Suggest a module

Comments