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