-
Notifications
You must be signed in to change notification settings - Fork 5
range
Subhajit Sahu edited this page May 3, 2023
·
26 revisions
Find smallest and largest values.
Alternatives: range, rangeEntries.
Similar: minimum, maximum, range.
function range(x, fc, fm)
// x: an array
// fc: compare function (a, b)
// fm: map function (v, i, x)
const xarray = require('extra-array');
var x = [1, 2, -3, -4];
xarray.range(x);
// → [ -4, 2 ]
xarray.range(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ 1, -4 ]
xarray.range(x, null, v => Math.abs(v));
// → [ 1, -4 ]