1-liners
Version:
Useful oneliners and shorthand functions
23 lines (20 loc) • 491 B
JavaScript
/**
* @module 1-liners/foldRight
*
* @description
*
* Same as [`array.reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/array/reduceRight).
*
* @example
*
* const foldRight = require('1-liners/foldRight');
*
* foldRight(sub, 1, [1, 2, 3]); // => -5
*
*/
;
exports.__esModule = true;
exports["default"] = function (fold, initial, arr) {
return arr.reduceRight(fold, initial);
};
module.exports = exports["default"];