Variable: toMaxBy
const
toMaxBy:ToMinOrMaxBy
Defined in: statistics.d.ts:440
Returns an optional reducer that finds the maximum value of the values it
receives based on the fn
Compare function.
Use when composing reducers. Prefer maxBy for direct use on iterables.
Example
console.log(
pipe(
[`sloth`, `more sloth`, `sleep`, `some sloth`],
map(string => [string.length, string]),
reduce(toGrouped(toMaxBy((s1, s2) => s1.localeCompare(s2)), toMap())),
),
)
//=> Map(2) { 5 => 'sloth', 10 => 'some sloth' }
Since
v2.0.0