Function: maxBy()
Returns an iterable containing a maximum value of iterable
based on the
fn
Compare function if iterable
contains at least one value.
Otherwise, returns an empty iterable.
Example
console.log(
pipe(
[`eating`, `sleeping`, `yawning`],
maxBy((a, b) => a.length - b.length),
get,
),
)
//=> sleeping
maxBy(fn, iterable)
maxBy<
Value
>(fn
,iterable
):Iterable
<Value
,any
,any
>
Returns an iterable containing a maximum value of iterable
based on the
fn
Compare function if iterable
contains at least one value.
Otherwise, returns an empty iterable.
Type Parameters
• Value
Parameters
• fn: Compare
<Value
>
• iterable: Iterable
<Value
, any
, any
>
Returns
Iterable
<Value
, any
, any
>
Example
console.log(
pipe(
[`eating`, `sleeping`, `yawning`],
maxBy((a, b) => a.length - b.length),
get,
),
)
//=> sleeping
Defined in
maxBy(fn)
maxBy<
Value
>(fn
): (iterable
) =>Iterable
<Value
,any
,any
>
Returns an iterable containing a maximum value of iterable
based on the
fn
Compare function if iterable
contains at least one value.
Otherwise, returns an empty iterable.
Type Parameters
• Value
Parameters
• fn: Compare
<Value
>
Returns
Function
Parameters
• iterable: Iterable
<Value
, any
, any
>
Returns
Iterable
<Value
, any
, any
>