UNPKG

f-utility

Version:

functional utilities

31 lines (28 loc) 808 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fork = undefined; var _entrust = require("entrust"); /** * a delegatee last function for Future.fork ing * @method fork * @param {function} badPath - a function * @param {function} goodPath - a function * @param {Future} future * @returns {*} the result of the fork * @public * @example * import {pipe, fork, I} from 'f-utility' * import {trace} from 'xtrace' * import F from 'fluture' * const odd = (x) => (x % 2 === 0 ? F.of(x) : F.reject(`${x} is odd`)) * const semiSafeOddity = pipe( * odd, * trace(`oddity`), * fork(console.warn, console.log) * ) * semiSafeOddity(5) // console.warn(`5 is odd`) * semiSafeOddity(4) // console.log(4) */ var fork = exports.fork = (0, _entrust.e2)("fork");