f-utility
Version:
functional utilities
25 lines (22 loc) • 654 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ternary = exports.__ternary = undefined;
var _katsuCurry = require("katsu-curry");
/**
* a ternary statement, but curried and lazy
* @method ternary
* @param {*} cn - anything to be evaluated as truthy
* @param {*} b - anything
* @param {*} a - anything
* @returns {mixed} a / b
* @example
* import {ternary} from `f-utility`
* ternary(true, `a`, `b`) // `a`
* ternary(false, `a`, `b`) // `b`
*/
var __ternary = exports.__ternary = function __ternary(cn, b, a) {
return cn ? a : b;
};
var ternary = exports.ternary = (0, _katsuCurry.curry)(__ternary);
;