Skip to content
Subhajit Sahu edited this page Dec 28, 2022 · 15 revisions

Find smallest and largest values.

Similar: min, max, range.


function range(x, fc, fm)
// x:  ilists
// fc: compare function (a, b)
// fm: map function (v, k, x)
const xilists = require('extra-ilists');

var x = [['a', 'b', 'c', 'd'], [1, 2, -3, -4]];
xilists.range(x);
// → [ -4, 2 ]

xilists.range(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ 1, -4 ]

xilists.range(x, null, v => Math.abs(v));
// → [ 1, -4 ]


References

Clone this wiki locally