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' }
minMaxWith(fn, iterable)
minMaxWith<
Value
>(fn
,iterable
):Iterable
<MinMax
<Value
>,any
,any
>
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.
Type Parameters
• Value
Parameters
• fn
• iterable: Iterable
<Value
, any
, any
>
Returns
Iterable
<MinMax
<Value
>, any
, any
>
Example
console.log(
pipe(
[`eating`, `sleeping`, `yawning`],
minMaxWith(value => value.length),
get,
),
)
//=> { min: 'eating', max: 'sleeping' }
Defined in
minMaxWith(fn)
minMaxWith<
Value
>(fn
): (iterable
) =>Iterable
<MinMax
<Value
>,any
,any
>
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.
Type Parameters
• Value
Parameters
• fn
Returns
Function
Parameters
• iterable: Iterable
<Value
, any
, any
>
Returns
Iterable
<MinMax
<Value
>, any
, any
>
Example
console.log(
pipe(
[`eating`, `sleeping`, `yawning`],
minMaxWith(value => value.length),
get,
),
)
//=> { min: 'eating', max: 'sleeping' }