mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
35 lines
805 B
TypeScript
35 lines
805 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/maxBy.js
|
|
|
|
|
|
import _curry3 from './internal/_curry3.js';
|
|
|
|
|
|
/**
|
|
* Takes a function and two values, and returns whichever value produces the
|
|
* larger result when passed to the provided function.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.8.0
|
|
* @category Relation
|
|
* @sig Ord b => (a -> b) -> a -> a -> a
|
|
* @param {Function} f
|
|
* @param {*} a
|
|
* @param {*} b
|
|
* @return {*}
|
|
* @see R.max, R.minBy
|
|
* @example
|
|
*
|
|
* // square :: Number -> Number
|
|
* const square = n => n * n;
|
|
*
|
|
* R.maxBy(square, -3, 2); //=> -3
|
|
*
|
|
* R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5
|
|
* R.reduce(R.maxBy(square), 0, []); //=> 0
|
|
*/
|
|
var maxBy = _curry3(function maxBy(f, a, b) {
|
|
return f(b) > f(a) ? b : a;
|
|
});
|
|
export default maxBy;
|