Skip to content
wolfram77 edited this page Apr 1, 2020 · 27 revisions

Finds smallest and largest values.

Alternatives: compare, map.

iterable.range(x, [fn]);
// x:  an iterable
// fn: compare function (a, b)
// --> [min, max]
const iterable = require('extra-iterable');

var x = [1, 2, -3, -4];
iterable.range(x);
// [-4, 2]

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

references

Clone this wiki locally