-
Notifications
You must be signed in to change notification settings - Fork 3
range
Subhajit Sahu edited this page Dec 8, 2022
·
12 revisions
Find smallest and largest values.
Similar: range, rangeEntries.
Similar: min, max, range
function range(x, fc, fm)
// x: a map
// fc: compare function (a, b)
// fm: map function (v, k, x)
const object = require('extra-object');
var x = {a: 1, b: 2, c: -3, d: -4};
object.range(x);
// → [ -4, 2 ]
object.range(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ 1, -4 ]
object.range(x, null, v => Math.abs(v));
// → [ 1, -4 ]