UNPKG

@common-utilities/compose

Version:

A basic implementation of the common utility function, Compose 🚂

17 lines • 577 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.compose = void 0; /** * compose 🚂 * ---- * a common function that takes the output from one function * and automatically patches it to the input of the next function * until it spits out the final value * ---- * @param {fns} an array of functions * @returns the next/final value */ const compose = (...fns) => (patchedValue) => fns.reduceRight((fnVal, fn) => fn(fnVal), patchedValue); exports.compose = compose; exports.default = exports.compose; //# sourceMappingURL=index.js.map