mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-11 06:04:55 +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>
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import _curry1 from './internal/_curry1.js';
|
|
|
|
/**
|
|
* Makes a comparator function out of a function that reports whether the first
|
|
* element is less than the second.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.0
|
|
* @category Function
|
|
* @sig ((a, b) -> Boolean) -> ((a, b) -> Number)
|
|
* @param {Function} pred A predicate function of arity two which will return `true` if the first argument
|
|
* is less than the second, `false` otherwise
|
|
* @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0`
|
|
* @example
|
|
*
|
|
* const byAge = R.comparator((a, b) => a.age < b.age);
|
|
* const people = [
|
|
* { name: 'Emma', age: 70 },
|
|
* { name: 'Peter', age: 78 },
|
|
* { name: 'Mikhail', age: 62 },
|
|
* ];
|
|
* const peopleByIncreasingAge = R.sort(byAge, people);
|
|
* //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }]
|
|
*/
|
|
var comparator = /*#__PURE__*/_curry1(function comparator(pred) {
|
|
return function (a, b) {
|
|
return pred(a, b) ? -1 : pred(b, a) ? 1 : 0;
|
|
};
|
|
});
|
|
export default comparator; |