1.0.0 • Published 8 years ago

is-nullish v1.0.0

Weekly downloads
1
License
MPL-2.0
Repository
github
Last release
8 years ago

node-is-nullish

NPM Package Build Status Coverage Status Dependency Status

Example

var isNull = require("is-nullish");
isNull("");
//true
isNull(0);
//false

Installation

npm i is-nullish

Usage

Differences between falsy, is-nullish, and is-empty:

valuetypeof valueBoolean(value)isNull(value)isEmpty(value)
not defined"undefined"falsetruetrue
undefined"undefined"falsetruetrue
null"object"falsetruetrue
"""string"falsetruetrue
NaN"number"falsetruefalse
0"number"falsefalsetrue
false"boolean"falsefalsefalse
{}"object"truetrue*true
[]"object"truetrue*true
function () {}"function"truetrue*true

*Objects and functions are nullish unless they have non-nullish enumerable properties.

API Reference

isNull(value) ⇒ boolean

Kind: Exported function
Params

  • value *

Example

var f = function (x) { return x; };
isNull(f);
//true
f.objective = "objectify";
isNull(f);
//false

License

MPL 2.0