Skip to main content

Function: maxByConcur()

Returns a concur iterable containing a maximum 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`]),
maxByConcur((a, b) => a.length - b.length),
getConcur,
),
)
//=> sleeping

maxByConcur(fn, concurIterable)

maxByConcur<Value>(fn, concurIterable): ConcurIterable<Value>

Returns a concur iterable containing a maximum 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: AsyncCompare<Value>

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<Value>

Example

console.log(
await pipe(
asConcur([`eating`, `sleeping`, `yawning`]),
maxByConcur((a, b) => a.length - b.length),
getConcur,
),
)
//=> sleeping

Defined in

statistics.d.ts:492

maxByConcur(fn)

maxByConcur<Value>(fn): (concurIterable) => ConcurIterable<Value>

Returns a concur iterable containing a maximum 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: AsyncCompare<Value>

Returns

Function

Parameters

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<Value>

Example

console.log(
await pipe(
asConcur([`eating`, `sleeping`, `yawning`]),
maxByConcur((a, b) => a.length - b.length),
getConcur,
),
)
//=> sleeping

Defined in

statistics.d.ts:492