Variable: toMinMaxWith()
consttoMinMaxWith: <Value>(fn) =>OptionalReducer<MinMax<Value>>
Defined in: statistics.d.ts:934
Returns an optional reducer that finds the MinMax value of the values
it receives by comparing the numerical values of each value, as defined by
fn.
Use when composing reducers. Prefer minMaxWith for direct use on iterables.
Type Parameters
Value
Value
Parameters
fn
(value) => number
Returns
OptionalReducer<MinMax<Value>>
Example
console.log(
pipe(
[`sloth`, `more sloth`, `sleep`, `some sloth`],
map(string => [string.length, string]),
reduce(toGrouped(toMinMaxWith(string => string.codePointAt(0)), toMap())),
),
)
//=> Map(2) {
//=> 5 => { min: 'sloth', max: 'sloth' },
//=> 10 => { min: 'more sloth', max: 'some sloth' }
//=> }
Since
v2.0.0