1.0.0 • Published 8 years ago
conditionally v1.0.0
conditionally

Handle conditions easily
Installing
Using npm:
$ npm install conditionallyUsing bower:
$ bower install conditionallyAPI
ternary
ternary callback
Boolean(notBool).ternary(truthyFn, falsyFn);
// or
bool.ternary(truthyFn, falsyFn);truthy
callback if true
Boolean(notBool).truthy(truthyFn);
// or
bool.truthy(truthyFn);falsy
callback if false
Boolean(notBool).falsy(falsyFn);
// or
bool.falsy(falsyFn);Example
bool
const isJohn = name => 'john' == name; // bool
isJohn('john').truthy(function () {
console.log('Hi, John!');
});notBool
const getCurrentUser = () => 'john'; // string (notBool)
Boolean(getCurrentUser()).truthy(function () {
console.log('User is logged in!');
});License
MIT. Copyright (c) 2017 Isaac Ferreira (zaclummys)
1.0.0
8 years ago