Skip to content

maxEntry

Subhajit Sahu edited this page Dec 22, 2022 · 1 revision

Find largest entry.

Similar: max, maxEntry.
Similar: min, max, range.


function maxEntry(x, fc, fm)
// x:  ientries
// fc: compare function (a, b)
// fm: map function (v, k, x)
const ientries = require('extra-ientries');

var x = [["a", 1], ["b", 2], ["c", -3], ["d", -4]];
ientries.maxEntry(x);
// → [ "b", 2 ]

ientries.maxEntry(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ "d", -4 ]

ientries.maxEntry(x, null, v => Math.abs(v));
// → [ "d", -4 ]


References

Clone this wiki locally