Nutella Pancake Machine

    falseorvalue

    1.0.0 • Public • Published

    False Or Value

    This module exports a function which can be used to return a passed value or return false. Useful for setting defaults.

    var falseOrV = require('falseorvalue')
     
    var options = {
        aString: falseOrV(undefined) || 'Some default',
        aNumber: falseOrV(NaN) || 10,
        anObject: falseOrV({}) || {a: 1},
        anArray: falseOrV([]) || [1,2,3]
    }

    Notes:

    • Returns 0, -0 and -n as passed.
    • Does not handle empty multi-dimensional arrays.
    • Does not handle objects with prototype methods or properties, but without enumerable properties.

    Keywords

    Install

    npm i falseorvalue

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • paperelectron