@gin93r/to-bool

0.1.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @gin93r/to-bool

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • gin93r