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
|
Rev | Line | |
---|
[d24f17c] | 1 | var _curry3 =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_curry3.js");
|
---|
| 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 |
|
---|
| 33 | var o =
|
---|
| 34 | /*#__PURE__*/
|
---|
| 35 | _curry3(function o(f, g, x) {
|
---|
| 36 | return f(g(x));
|
---|
| 37 | });
|
---|
| 38 |
|
---|
| 39 | module.exports = o; |
---|
Note:
See
TracBrowser
for help on using the repository browser.