mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
DISABLE_THIRD_PARTY_CHECK=new npm module causes package-lock change We can get rid of a custom script and use ESLint for these rules. Additionally this means editors will highlight the issue in the editor. Change-Id: I552b52e7f07b4e7430b3f685dbc3b5fad36ffff2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2052167 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import pipe from './pipe.js';
|
|
import reverse from './reverse.js';
|
|
|
|
/**
|
|
* Performs right-to-left function composition. The rightmost function may have
|
|
* any arity; the remaining functions must be unary.
|
|
*
|
|
* **Note:** The result of compose is not automatically curried.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.0
|
|
* @category Function
|
|
* @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z)
|
|
* @param {...Function} ...functions The functions to compose
|
|
* @return {Function}
|
|
* @see R.pipe
|
|
* @example
|
|
*
|
|
* const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName
|
|
* const yellGreeting = R.compose(R.toUpper, classyGreeting);
|
|
* yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND"
|
|
*
|
|
* R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7
|
|
*
|
|
* @symb R.compose(f, g, h)(a, b) = f(g(h(a, b)))
|
|
*/
|
|
export default function compose() {
|
|
if (arguments.length === 0) {
|
|
throw new Error('compose requires at least one argument');
|
|
}
|
|
return pipe.apply(this, reverse(arguments));
|
|
} |