Skip to content
Subhajit Sahu edited this page Dec 8, 2022 · 12 revisions

Find largest value.

Similar: max, maxEntry.
Similar: min, max, range


function max(x, fc, fm)
// x:  an object
// fc: compare function (a, b)
// fm: map function (v, k, x)
const object = require('extra-object');

var x = {a: 1, b: 2, c: -3, d: -4};
object.max(x);
// → 2

object.max(x, (a, b) => Math.abs(a) - Math.abs(b));
// → -4

object.max(x, null, v => Math.abs(v));
// → -4


References

Clone this wiki locally