UNPKG

1.17 kBJavaScriptView Raw
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3");
4/**
5 * `o` is a curried composition function that returns a unary function.
6 * Like [`compose`](#compose), `o` performs right-to-left function composition.
7 * Unlike [`compose`](#compose), the rightmost function passed to `o` will be
8 * invoked with only one argument. Also, unlike [`compose`](#compose), `o` is
9 * limited to accepting only 2 unary functions. The name o was chosen because
10 * of its similarity to the mathematical composition operator ∘.
11 *
12 * @func
13 * @memberOf R
14 * @since v0.24.0
15 * @category Function
16 * @sig (b -> c) -> (a -> b) -> a -> c
17 * @param {Function} f
18 * @param {Function} g
19 * @return {Function}
20 * @see R.compose, R.pipe
21 * @example
22 *
23 * const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last
24 * const yellGreeting = R.o(R.toUpper, classyGreeting);
25 * yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND"
26 *
27 * R.o(R.multiply(10), R.add(10))(-4) //=> 60
28 *
29 * @symb R.o(f, g, x) = f(g(x))
30 */
31
32
33var o =
34/*#__PURE__*/
35_curry3(function o(f, g, x) {
36 return f(g(x));
37});
38
39module.exports = o;
\No newline at end of file