Skip to main content

Function: maxWithAsync()

Returns an async iterable containing a maximum 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`]),
maxWithAsync(value => value.length),
getAsync,
),
)
//=> sleeping

Since

v0.0.1

Call Signature

maxWithAsync<Value>(fn, asyncIterable): AsyncOptional<Value>

Type Parameters

Value

Parameters

fn

(value) => MaybePromiseLike<number>

asyncIterable

AsyncIterable<Value, any, any>

Returns

AsyncOptional<Value>

Defined in

statistics.d.ts:883

Call Signature

maxWithAsync<Value>(fn): (asyncIterable) => AsyncOptional<Value>

Type Parameters

Value

Parameters

fn

(value) => MaybePromiseLike<number>

Returns

Function

Parameters

asyncIterable

AsyncIterable<Value, any, any>

Returns

AsyncOptional<Value>

Defined in

statistics.d.ts:883