Skip to content
Subhajit Sahu edited this page Dec 28, 2022 · 14 revisions

Find smallest value.

Similar: min, max, range.


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

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

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

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


References

Clone this wiki locally