Find smallest and largest entries.
Similar: min, max, range.
function rangeEntries(x, fc, fm) // x: lists // fc: compare function (a, b) // fm: map function (v, k, x)
const xlists = require('extra-lists'); var x = [['a', 'b', 'c', 'd'], [1, 2, -3, -4]]; xlists.rangeEntries(x); // → [ [ 'd', -4 ], [ 'b', 2 ] ] xlists.rangeEntries(x, (a, b) => Math.abs(a) - Math.abs(b)); // → [ [ 'a', 1 ], [ 'd', -4 ] ] xlists.rangeEntries(x, null, v => Math.abs(v)); // → [ [ 'a', 1 ], [ 'd', -4 ] ]
There was an error while loading. Please reload this page.