humanize-bool

0.0.2 • Public • Published

Boolean Expression Evaluator for humans

Installation

// From NPM
npm install humanize-bool --save
// From Yarn
yarn add humanize-bool 

Usage

import is from 'humanize-bool';

Examples

// Before

if (val === 'cat' || val === 'dog' || val === 'car' || val === 'home') {
  // code here ...
}

// After

if (is(val).any.equalsTo('cat', 'dog', 'car', 'home')) {
  // code here
}
// Before

if (val === undefined || value === null) {
  // code here ...
}

// After

if (is(val).undefined.or.null()) {
  // code here
}
// Before

if (typeof val === null || typeof val === 'function') {
  // code here ...
}

// After

if (is(val).type.null.or.func()) {
  // code here
}
// Before

if (typeof val === 'string' || typeof val === 'number' || typeof val === 'symbol') {
  // code here ...
}

// After

if (is(val).type.string.or.number.or.symbol()) {
  // code here
}

// OR

if (is(val).type.any('string', 'number', 'symbol')) {
  // code here
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    2
  • 0.0.1
    1

Package Sidebar

Install

npm i humanize-bool

Weekly Downloads

3

Version

0.0.2

License

MIT

Unpacked Size

166 kB

Total Files

43

Last publish

Collaborators

  • robusgauli