Function: minMaxWithAsync()
Returns an async iterable containing a MinMax value of
asyncIterable
by comparing the numerical values of each value, as defined
by fn
, if asyncIterable
contains at least one value. Otherwise, returns
an empty async iterable.
Example
console.log(
await pipe(
asAsync([`eating`, `sleeping`, `yawning`]),
minMaxWithAsync(value => value.length),
getAsync,
),
)
//=> { min: 'eating', max: 'sleeping' }
minMaxWithAsync(fn, asyncIterable)
minMaxWithAsync<
Value
>(fn
,asyncIterable
):AsyncIterable
<MinMax
<Value
>,any
,any
>
Returns an async iterable containing a MinMax value of
asyncIterable
by comparing the numerical values of each value, as defined
by fn
, if asyncIterable
contains at least one value. Otherwise, returns
an empty async iterable.
Type Parameters
• Value
Parameters
• fn
• asyncIterable: AsyncIterable
<Value
, any
, any
>
Returns
AsyncIterable
<MinMax
<Value
>, any
, any
>
Example
console.log(
await pipe(
asAsync([`eating`, `sleeping`, `yawning`]),
minMaxWithAsync(value => value.length),
getAsync,
),
)
//=> { min: 'eating', max: 'sleeping' }
Defined in
minMaxWithAsync(fn)
minMaxWithAsync<
Value
>(fn
): (asyncIterable
) =>AsyncIterable
<MinMax
<Value
>,any
,any
>
Returns an async iterable containing a MinMax value of
asyncIterable
by comparing the numerical values of each value, as defined
by fn
, if asyncIterable
contains at least one value. Otherwise, returns
an empty async iterable.
Type Parameters
• Value
Parameters
• fn
Returns
Function
Parameters
• asyncIterable: AsyncIterable
<Value
, any
, any
>
Returns
AsyncIterable
<MinMax
<Value
>, any
, any
>
Example
console.log(
await pipe(
asAsync([`eating`, `sleeping`, `yawning`]),
minMaxWithAsync(value => value.length),
getAsync,
),
)
//=> { min: 'eating', max: 'sleeping' }