-
Notifications
You must be signed in to change notification settings - Fork 1
range
Subhajit Sahu edited this page Feb 3, 2021
·
27 revisions
Find smallest and largest values.
function range(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.range(x);
// → [-4, 2]
xiterable.range(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [1, -4]
xiterable.range(x, null, v => Math.abs(v));
// → [1, -4]