tsoid
Version:
Typed functional library to deal with async operations.
15 lines (14 loc) • 423 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const id_1 = require("./id");
/**
* Create a new function that represents all the functions piped
*
* @param {function} fn1
* @param {function[]} fns
*/
function pipe(fn1, ...fns) {
const piped = fns.reduce((pipedFn, fn) => (value) => fn(pipedFn(value)), id_1.default);
return (input) => piped(fn1(input));
}
exports.default = pipe;