Skip to content

maxEntry

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

Find largest entry.

Similar: min, max, range.


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

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

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

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


References

Clone this wiki locally