Skip to main content

Function: minMaxWith()

Returns an iterable containing a MinMax value of iterable by comparing the numerical values of each value, as defined by fn, if iterable contains at least one value. Otherwise, returns an empty iterable.

Example

console.log(
pipe(
[`eating`, `sleeping`, `yawning`],
minMaxWith(value => value.length),
get,
),
)
//=> { min: 'eating', max: 'sleeping' }

Since

v0.0.2

Call Signature

minMaxWith<Value>(fn, iterable): Optional<MinMax<Value>>

Type Parameters

Value

Parameters

fn

(value) => number

iterable

Iterable<Value, any, any>

Returns

Optional<MinMax<Value>>

Defined in

statistics.d.ts:959

Call Signature

minMaxWith<Value>(fn): (iterable) => Optional<MinMax<Value>>

Type Parameters

Value

Parameters

fn

(value) => number

Returns

Function

Parameters

iterable

Iterable<Value, any, any>

Returns

Optional<MinMax<Value>>

Defined in

statistics.d.ts:963