[![Build status][build-image]][build-url] [![Tests coverage][cov-image]][cov-url] [![npm version][npm-image]][npm-url]
- works on the server side, not recommended for the browser
- works on node >= 12
Validate variable types and values
const { isArray, isString, isValidString, isArrayOf } = require('is');
isArray([]); // true
isArray(''); // false
isString(''); // true
isString(10); // false
isValidString(' '); // false
isValidString('-'); // true
isArrayOf([{}, new Date()], 'object'); // true
isArrayOf(['10', null, undefined], 'number'); // true
npm install is
In all functions, it will always return "true" or "false", NEVER an error or another thing
-
Array
-
Boolean
-
Date
-
Is
-
Number
-
Object
-
String