Files
30-seconds-of-code/test/maxBy/maxBy.js
2018-01-15 10:58:44 -05:00

1 line
107 B
JavaScript

module.exports = maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn]));