-
Notifications
You must be signed in to change notification settings - Fork 1
range
Subhajit Sahu edited this page Dec 2, 2022
·
15 revisions
Find smallest and largest entries.
function range(x, fc, fm)
// x: a set
// fc: compare function (a, b)
// fm: map function (v, v, x)
const set = require('extra-set');
var x = new Set([1, 2, -3, -4]);
set.range(x);
// → [ -4, 2 ]
set.range(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ 1, -4 ]
set.range(x, null, v => Math.abs(v));
// → [ 1, -4 ]