Skip to content

minEntry

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

Find smallest entry.

Similar: min, minEntry.
Similar: min, max, range.


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

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

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


References

Clone this wiki locally