JSPM

normalize-bool

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1396
  • Score
    100M100P100Q116453F
  • License MIT

Converts strings representing an on/off-state to booleans

Package Exports

  • normalize-bool

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (normalize-bool) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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