maxBy

Maps each value of an array to a numeric value and returns the value with the highest value.

Type

type maxBy = <E>(e: UnaryFunction<E, number>) => (array: Array<E>) => E

Example

import {maxBy} from 'fnxt/array';

const array = ['aa', 'bbb', 'c', 'dd'];
const maxBy = maxBy((x: string) => x.length);
maxBy(array) // -> 'bbb'