1 | var _curry3 =
|
2 | /*#__PURE__*/
|
3 | require("./internal/_curry3");
|
4 | /**
|
5 | * Takes a function and two values, and returns whichever value produces the
|
6 | * larger result when passed to the provided function.
|
7 | *
|
8 | * @func
|
9 | * @memberOf R
|
10 | * @since v0.8.0
|
11 | * @category Relation
|
12 | * @sig Ord b => (a -> b) -> a -> a -> a
|
13 | * @param {Function} f
|
14 | * @param {*} a
|
15 | * @param {*} b
|
16 | * @return {*}
|
17 | * @see R.max, R.minBy
|
18 | * @example
|
19 | *
|
20 | * // square :: Number -> Number
|
21 | * const square = n => n * n;
|
22 | *
|
23 | * R.maxBy(square, -3, 2); //=> -3
|
24 | *
|
25 | * R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5
|
26 | * R.reduce(R.maxBy(square), 0, []); //=> 0
|
27 | */
|
28 |
|
29 |
|
30 | var maxBy =
|
31 | /*#__PURE__*/
|
32 | _curry3(function maxBy(f, a, b) {
|
33 | return f(b) > f(a) ? b : a;
|
34 | });
|
35 |
|
36 | module.exports = maxBy; |
\ | No newline at end of file |