source: node_modules/ramda/es/o.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[d24f17c]1import _curry3 from "./internal/_curry3.js";
2/**
3 * `o` is a curried composition function that returns a unary function.
4 * Like [`compose`](#compose), `o` performs right-to-left function composition.
5 * Unlike [`compose`](#compose), the rightmost function passed to `o` will be
6 * invoked with only one argument. Also, unlike [`compose`](#compose), `o` is
7 * limited to accepting only 2 unary functions. The name o was chosen because
8 * of its similarity to the mathematical composition operator ∘.
9 *
10 * @func
11 * @memberOf R
12 * @since v0.24.0
13 * @category Function
14 * @sig (b -> c) -> (a -> b) -> a -> c
15 * @param {Function} f
16 * @param {Function} g
17 * @return {Function}
18 * @see R.compose, R.pipe
19 * @example
20 *
21 * const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last
22 * const yellGreeting = R.o(R.toUpper, classyGreeting);
23 * yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND"
24 *
25 * R.o(R.multiply(10), R.add(10))(-4) //=> 60
26 *
27 * @symb R.o(f, g, x) = f(g(x))
28 */
29
30var o =
31/*#__PURE__*/
32_curry3(function o(f, g, x) {
33 return f(g(x));
34});
35
36export default o;
Note: See TracBrowser for help on using the repository browser.