UNPKG

crocks

Version:

A collection of well known Algebraic Datatypes for your utter enjoyment.

19 lines (14 loc) 550 B
/** @license ISC License (c) copyright 2017 original and current authors */ /** @author Ian Hofmann-Hicks (evil) */ var curry = require('../core/curry') var isFunction = require('../core/isFunction') function reduceRight(fn, init, m) { if(!isFunction(fn)) { throw new TypeError('reduceRight: Function required for first argument') } else if(!(m && isFunction(m.reduceRight))) { throw new TypeError('reduceRight: Right Foldable required for third argument') } return m.reduceRight(fn, init) } module.exports = curry(reduceRight)