Skip to content

gin93r/to-bool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To Bool

A small library that converts typical "boolean" values to boolean

Installation

npm install @gin93r/to-bool

Usage

var toBool = require('@gin93r/to-bool');

var b = toBool(0, [options]}); // false

Options

treatUndefinedAsFalse | default: true
treatNullAsFalse | default: true

When true, undefined and null values will be returned as false.

When false, undefined and null will be returned as normal.

var b = toBool(undefined, {treatUndefinedAsFalse:false}) // undefined
var b = toBool(null, {treatNullAsFalse:false}) // null

Tests

npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Build Status Coverage Status

About

A small library that converts typical "boolean" values to boolean.

Resources

License

Stars

Watchers

Forks

Packages

No packages published