| var pipe = |
| /*#__PURE__*/ |
| require("./pipe"); |
| |
| var reverse = |
| /*#__PURE__*/ |
| require("./reverse"); |
| /** |
| * Performs right-to-left function composition. The last argument may have |
| * any arity; the remaining arguments must be unary. |
| * |
| * **Note:** The result of compose is not automatically curried. |
| * |
| * @func |
| * @memberOf R |
| * @since v0.1.0 |
| * @category Function |
| * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) |
| * @param {...Function} ...functions The functions to compose |
| * @return {Function} |
| * @see R.pipe |
| * @example |
| * |
| * const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName |
| * const yellGreeting = R.compose(R.toUpper, classyGreeting); |
| * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" |
| * |
| * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 |
| * |
| * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) |
| */ |
| |
| |
| function compose() { |
| if (arguments.length === 0) { |
| throw new Error('compose requires at least one argument'); |
| } |
| |
| return pipe.apply(this, reverse(arguments)); |
| } |
| |
| module.exports = compose; |