-
Notifications
You must be signed in to change notification settings - Fork 0
range
Subhajit Sahu edited this page Dec 22, 2022
·
13 revisions
Find smallest and largest values.
Similar: range, rangeEntries.
Similar: min, max, range.
function range(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.range(x);
// → [ -4, 2 ]
ientries.range(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ 1, -4 ]
ientries.range(x, null, v => Math.abs(v));
// → [ 1, -4 ]