mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/o.js
|
|
|
|
|
|
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 = _curry3(function o(f, g, x) {
|
|
return f(g(x));
|
|
});
|
|
export default o;
|