Nocturnal Practitioners of Magic
    Have ideas to improve npm?Join in the discussion! »

    is-nullish

    1.0.0 • Public • Published

    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:

    value typeof value Boolean(value) isNull(value) isEmpty(value)
    not defined "undefined" false true true
    undefined "undefined" false true true
    null "object" false true true
    "" "string" false true true
    NaN "number" false true false
    0 "number" false false true
    false "boolean" false false false
    {} "object" true true* true
    [] "object" true true* true
    function () {} "function" true true* 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

    Install

    npm i is-nullish

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MPL-2.0

    Last publish

    Collaborators

    • avatar