isnullorempty
Version:
Check if a given object is null or empty
51 lines (37 loc) • 1.06 kB
Markdown
//img.shields.io/npm/v/isnullorempty.svg?style=flat-square)](https://www.npmjs.com/package/isnullorempty)
A simple module that lets you check if a given object is null or empty
Firstly, you have to install the module
```
npm i isnullorempty --save
```
And then you can import the module and start working
```javascript
const isNullOrEmpty = require("isnullorempty");
if(isNullOrEmpty(null)) {
//...
}
```
Or you can work with some more specific functions
```javascript
const inoe = require("isnullorempty");
if(inoe.isNull(value)) {
// Returns true for null
}
if(inoe.isEmpty(value)) {
// BUGGED: Returns true for null, undefined, [], {} or ""
}
if(inoe.isUndefined(value)) {
// Returns true for undefined
}
if(inoe.isNullOrEmpty(value)) {
// Same as the "basic" one
// Returns true for null, undefined, [], {} or ""
}
if(inoe.isNullOrUndefined(value)) {
// Returns true for null or undefined
}
```
[ ](http://www.wtfpl.net/)
[![npm-version](https: