mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
Major update breaking changes: - ESLint 7.0.0 (https://eslint.org/docs/user-guide/migrating-to-7.0.0) now includes .eslint.rc.js in its list, which is fine for us. Other changes are not applicable for us. - eslint-plugin-mocha (https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md#700-may-13-2020) drops support for ESLint <7, but this CL updates to 7+. Other changes are not applicable for us. DISABLE_THIRD_PARTY_CHECK=Updating ESLint R=petermarshall@chromium.org Change-Id: I7760e084ef87f73a92f9ea4e075fb4c065047f5a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2534873 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org>
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import _curry2 from "./internal/_curry2.js";
|
|
import _isFunction from "./internal/_isFunction.js";
|
|
import and from "./and.js";
|
|
import lift from "./lift.js";
|
|
/**
|
|
* A function which calls the two provided functions and returns the `&&`
|
|
* of the results.
|
|
* It returns the result of the first function if it is false-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
|
|
* false-y value.
|
|
*
|
|
* In addition to functions, `R.both` 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.and
|
|
* @example
|
|
*
|
|
* const gt10 = R.gt(R.__, 10)
|
|
* const lt20 = R.lt(R.__, 20)
|
|
* const f = R.both(gt10, lt20);
|
|
* f(15); //=> true
|
|
* f(30); //=> false
|
|
*
|
|
* R.both(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(false)
|
|
* R.both([false, false, 'a'], [11]); //=> [false, false, 11]
|
|
*/
|
|
|
|
var both =
|
|
/*#__PURE__*/
|
|
_curry2(function both(f, g) {
|
|
return _isFunction(f) ? function _both() {
|
|
return f.apply(this, arguments) && g.apply(this, arguments);
|
|
} : lift(and)(f, g);
|
|
});
|
|
|
|
export default both; |