Skip to content

minEntry

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

Find smallest entry.

Similar: min, max, range.


function minEntry(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.minEntry(x);
// → [ 'd', -4 ]

xilists.minEntry(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ 'a', 1 ]

xilists.minEntry(x, null, v => Math.abs(v));
// → [ 'a', 1 ]


References