UNPKG

type-plus

Version:
16 lines 655 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.compose = void 0; /** * Compose functions to produce a new function. * @params args functions to be composed. * Each function will receive the return value of the previous function as its parameters. * @return The composed function will expect the parameters of the first function, * and return the result of the last function. */ function compose(...fns) { // eslint-disable-next-line @typescript-eslint/no-unsafe-return return (...args) => fns.reduce((args, fn) => [fn(...args)], args)[0]; } exports.compose = compose; //# sourceMappingURL=compose.js.map