UNPKG

437 BTypeScriptView Raw
1declare const _default: <T>(arr: T[], fn: string | ((v: T) => number)) => T;
2/**
3 * @param {Array} arr The array to iterate over.
4 * @param {Function} [fn] The iteratee invoked per element.
5 * @return {*} Returns the maximum value.
6 * @example
7 *
8 * var objects = [{ 'n': 1 }, { 'n': 2 }];
9 *
10 * maxBy(objects, function(o) { return o.n; });
11 * // => { 'n': 2 }
12 *
13 * maxBy(objects, 'n');
14 * // => { 'n': 2 }
15 */
16export default _default;