mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 05:35:05 +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>
34 lines
1.4 KiB
JavaScript
34 lines
1.4 KiB
JavaScript
import _curry3 from './internal/_curry3.js';
|
|
import curryN from './curryN.js';
|
|
|
|
/**
|
|
* Creates a function that will process either the `onTrue` or the `onFalse`
|
|
* function depending upon the result of the `condition` predicate.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.8.0
|
|
* @category Logic
|
|
* @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *)
|
|
* @param {Function} condition A predicate function
|
|
* @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value.
|
|
* @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value.
|
|
* @return {Function} A new function that will process either the `onTrue` or the `onFalse`
|
|
* function depending upon the result of the `condition` predicate.
|
|
* @see R.unless, R.when, R.cond
|
|
* @example
|
|
*
|
|
* const incCount = R.ifElse(
|
|
* R.has('count'),
|
|
* R.over(R.lensProp('count'), R.inc),
|
|
* R.assoc('count', 1)
|
|
* );
|
|
* incCount({}); //=> { count: 1 }
|
|
* incCount({ count: 1 }); //=> { count: 2 }
|
|
*/
|
|
var ifElse = /*#__PURE__*/_curry3(function ifElse(condition, onTrue, onFalse) {
|
|
return curryN(Math.max(condition.length, onTrue.length, onFalse.length), function _ifElse() {
|
|
return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments);
|
|
});
|
|
});
|
|
export default ifElse; |