Skip to main content

Function: minMaxByConcur()

Returns a concur iterable containing a MinMax value of concurIterable based on the fn AsyncCompare function if concurIterable contains at least one value. Otherwise, returns an empty concur iterable.

Example

console.log(
await pipe(
asConcur([`eating`, `sleeping`, `yawning`]),
minMaxByConcur((a, b) => a.length - b.length),
getConcur,
),
)
//=> { min: 'eating', max: 'sleeping' }

Since

v0.0.2

Call Signature

minMaxByConcur<Value>(fn, concurIterable): ConcurOptional<MinMax<Value>>

Type Parameters

Value

Parameters

fn

(left, right) => MaybePromiseLike<number>

concurIterable

ConcurIterable<Value>

Returns

ConcurOptional<MinMax<Value>>

Defined in

statistics.d.ts:646

Call Signature

minMaxByConcur<Value>(fn): (concurIterable) => ConcurOptional<MinMax<Value>>

Type Parameters

Value

Parameters

fn

(left, right) => MaybePromiseLike<number>

Returns

Function

Parameters

concurIterable

ConcurIterable<Value>

Returns

ConcurOptional<MinMax<Value>>

Defined in

statistics.d.ts:650