1-liners
Version:
Useful oneliners and shorthand functions
27 lines (24 loc) • 482 B
JavaScript
/**
* @module 1-liners/pipeAll
*
* @description
*
* Pipe arguments through an array of functions.
*
* @example
*
* const pipeAll = require('1-liners/pipeAll');
*
* pipeAll([f, g, h])(1, 2) === h(g(f(1, 2)));
*
*/
;
exports.__esModule = true;
exports["default"] = function (fns) {
return fns.reduceRight(function (f, g) {
return function () {
return f(g.apply(undefined, arguments));
};
});
};
module.exports = exports["default"];