isempty-typeof
v1.0.0
Published
To check the data is empty or not. And also check the type of object wheater Array, Object, Function, Number, String or Boolean
Downloads
3
Maintainers
Readme
isempty-typeof
To check the data is empty or not. And also check the type of object wheater Array, Object, Function, Number, String or Boolean. It is very light weight module.
Install
npm install isempty-typeof --save
How to require/import
import check from 'isempty-typeof';
or
const check = require('isempty-typeof');
Examples of how to use it
// To check data is empty or not
checks.isEmpty([]); // true
checks.isEmpty([1,2]); // false
checks.isEmpty({}); // true
checks.isEmpty({a:"A"}); // false
checks.isEmpty(0); // true
checks.isEmpty(0,true); // false
// To check the typeOf.
checks.strictTypeOf([]); //Array
checks.strictTypeOf([1,2]); //Array
checks.strictTypeOf({}); //Object
Note
In isEmpty method if you consider zero not to a empty then send secound parameter true.
checks.isEmpty(0); // true
checks.isEmpty(0,true); // false