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>
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
import _curry2 from './internal/_curry2.js';
|
|
import _isFunction from './internal/_isFunction.js';
|
|
import lift from './lift.js';
|
|
import or from './or.js';
|
|
|
|
/**
|
|
* A function wrapping calls to the two functions in an `||` operation,
|
|
* returning the result of the first function if it is truth-y and the result
|
|
* of the second function otherwise. Note that this is short-circuited,
|
|
* meaning that the second function will not be invoked if the first returns a
|
|
* truth-y value.
|
|
*
|
|
* In addition to functions, `R.either` also accepts any fantasy-land compatible
|
|
* applicative functor.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.12.0
|
|
* @category Logic
|
|
* @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
|
|
* @param {Function} f a predicate
|
|
* @param {Function} g another predicate
|
|
* @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together.
|
|
* @see R.or
|
|
* @example
|
|
*
|
|
* const gt10 = x => x > 10;
|
|
* const even = x => x % 2 === 0;
|
|
* const f = R.either(gt10, even);
|
|
* f(101); //=> true
|
|
* f(8); //=> true
|
|
*
|
|
* R.either(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(55)
|
|
* R.either([false, false, 'a'], [11]) // => [11, 11, "a"]
|
|
*/
|
|
var either = /*#__PURE__*/_curry2(function either(f, g) {
|
|
return _isFunction(f) ? function _either() {
|
|
return f.apply(this, arguments) || g.apply(this, arguments);
|
|
} : lift(or)(f, g);
|
|
});
|
|
export default either; |