normalize-bool

    1.0.0 • Public • Published

    normalize-bool

    Converts strings representing an on/off-state to booleans. Falsy values and a whitelist of keywords are converted to the boolean false. Everything else is considered true.

    Useful for normalizing environment variables and other user-input to booleans.

    Build status js-standard-style

    Installation

    npm install normalize-bool --save
    

    Usage

    var bool = require('normalize-bool')
     
    console.log(bool('no')) // => false
    console.log(bool('yes')) // => true

    API

    var bool = normalizeBool(value)

    Converts the input value to a boolean. Falsy values and a whitelist of keywords are converted to the boolean false. Everything else is considered true.

    The following values are considered false:

    License

    MIT

    Install

    npm i normalize-bool

    DownloadsWeekly Downloads

    2,572

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • watson