We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Find largest entry.
Alternatives: max, maxEntry. Similar: min, max, range.
function maxEntry(x, fc, fm) // x: a map // fc: compare function (a, b) // fm: map function (v, k, x)
const map = require('extra-map'); var x = new Map([['a', 1], ['b', 2], ['c', -3], ['d', -4]]); map.maxEntry(x); // → [ 'b', 2 ] map.maxEntry(x, (a, b) => Math.abs(a) - Math.abs(b)); // → [ 'd', -4 ] map.maxEntry(x, null, v => Math.abs(v)); // → [ 'd', -4 ]