bvl
v1.0.2
Published
Fallback when a value is not Boolean.
Downloads
11
Maintainers
Readme
BVL
Fallback when a value is not Boolean
.
Installation
Via 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.