Skip to content
Subhajit Sahu edited this page Feb 3, 2021 · 27 revisions

Find smallest value.

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


function min(x, fc, fm) // x: an iterable // fc: compare function (a, b) // fm: map function (v, i, x)
const xiterable = require('extra-iterable'); var x = [1, 2, -3, -4]; xiterable.min(x); // → -4 xiterable.min(x, (a, b) => Math.abs(a) - Math.abs(b)); // → 1 xiterable.min(x, null, v => Math.abs(v)); // → 1


References

Clone this wiki locally