36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import _curry3 from "./internal/_curry3.js";
|
|
/**
|
|
* `o` is a curried composition function that returns a unary function.
|
|
* Like [`compose`](#compose), `o` performs right-to-left function composition.
|
|
* Unlike [`compose`](#compose), the rightmost function passed to `o` will be
|
|
* invoked with only one argument. Also, unlike [`compose`](#compose), `o` is
|
|
* limited to accepting only 2 unary functions. The name o was chosen because
|
|
* of its similarity to the mathematical composition operator ∘.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.24.0
|
|
* @category Function
|
|
* @sig (b -> c) -> (a -> b) -> a -> c
|
|
* @param {Function} f
|
|
* @param {Function} g
|
|
* @return {Function}
|
|
* @see R.compose, R.pipe
|
|
* @example
|
|
*
|
|
* const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last
|
|
* const yellGreeting = R.o(R.toUpper, classyGreeting);
|
|
* yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND"
|
|
*
|
|
* R.o(R.multiply(10), R.add(10))(-4) //=> 60
|
|
*
|
|
* @symb R.o(f, g, x) = f(g(x))
|
|
*/
|
|
|
|
var o =
|
|
/*#__PURE__*/
|
|
_curry3(function o(f, g, x) {
|
|
return f(g(x));
|
|
});
|
|
|
|
export default o; |