-
Notifications
You must be signed in to change notification settings - Fork 1
min
Subhajit Sahu edited this page Feb 3, 2021
·
27 revisions
Find smallest value.
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