UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

20 lines (19 loc) 581 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.eitherOr = void 0; const main_1 = require("./main"); function eitherOr(f, g, value) { if (arguments.length === 1) { return function (_g, _value) { return arguments.length === 1 ? eitherOr(f, _g) : eitherOr(f, _g, _value); }; } else if (arguments.length === 2) { return (_value) => eitherOr(f, g, _value); } const val = (0, main_1.getValue)(value); return f(val) || g(val); } exports.eitherOr = eitherOr;