Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

isempty-typeof

1.0.0 • Public • Published

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

Install

npm i isempty-typeof

DownloadsWeekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

3.72 kB

Total Files

3

Last publish

Collaborators

  • avatar