Skip to main content

Variable: toMinWith

const toMinWith: ToMinOrMaxWith

Defined in: statistics.d.ts:720

Returns an optional reducer that finds the minimum value of the values it receives by comparing the numerical values of each value, as defined by fn.

Use when composing reducers. Prefer minWith for direct use on iterables.

Example

console.log(
pipe(
[`sloth`, `more sloth`, `sleep`, `some sloth`],
map(string => [string.length, string]),
reduce(toGrouped(toMinWith(string => string.codePointAt(0)), toMap())),
),
)
//=> Map(2) { 5 => 'sloth', 10 => 'more sloth' }

Since

v2.0.0