1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | function maxBy(arr, fn) {
|
4 | let max;
|
5 | for (let cur of arr) {
|
6 | let i = fn(cur);
|
7 | if (!max || i > max.i) {
|
8 | max = { i, element: cur };
|
9 | }
|
10 | }
|
11 | return max && max.element;
|
12 | }
|
13 | exports.maxBy = maxBy;
|