Skip to content
Subhajit Sahu edited this page Dec 22, 2022 · 13 revisions

Find smallest value.

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


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

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

entries.min(x, (a, b) => Math.abs(a) - Math.abs(b));
// → 1

entries.min(x, null, v => Math.abs(v));
// → 1


References

Clone this wiki locally