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' }

minMaxByConcur(fn, concurIterable)

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

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.

Type Parameters

Value

Parameters

fn

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<MinMax<Value>>

Example

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

Defined in

statistics.d.ts:615

minMaxByConcur(fn)

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

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.

Type Parameters

Value

Parameters

fn

Returns

Function

Parameters

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<MinMax<Value>>

Example

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

Defined in

statistics.d.ts:619