Skip to content

Fallback when a value is not Boolean.

License

Notifications You must be signed in to change notification settings

value-fallback/BVL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BVL

license npm npm Travis ESLint Gluons

Fallback when a value is not Boolean.

Installation

Via NPM:

NPM

npm install bvl

Via Yarn:

yarn add bvl

Usage

const bvl = require('bvl');

// When a value is not Boolean, it will return fallback value.
let a = bvl(10, 'x'); // a = 'x'
let b = bvl([1, 2, 3], 5); // b = 5

// When a value is Boolean, it will return that value.
let c = bvl(true, 1); // c = true
let d = bvl(false, true); // d = false

API

bvl(value, fallbackValue)

value

A main value.

fallbackValue

A fallback value.