JSPM

uncertain-boolean

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q9943F
  • License MIT

Indeterminate booleans as POJO

Package Exports

  • uncertain-boolean

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 (uncertain-boolean) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

uncertain-boolean Build Status

Flow control for indeterminate booleans as POJO

Your API returns booleans, but sometimes a value is unknown. You want to have uncertain or null or true, but as plain javascript.

Install

$ npm install --save uncertain-boolean

Usage

var Uncertain = require('uncertain-boolean')

var value = Uncertain() // => 'uncertain'
Uncertain.is(value) // => true
Uncertain.is(true) // => false
Uncertain.is(false) // => false

Uncertain.cast(true) // => true
Uncertain.cast('true') // => true
Uncertain.cast(false) // => false
Uncertain.cast('false') // => true
Uncertain.cast(0) // => false
Uncertain.cast(1) // => true
Uncertain.cast(null) // => 'uncertain'
Uncertain.cast(undefined) // => 'uncertain'

License

MIT © Andrew Joslin