JSPM

@extra-array/max

2.9.27
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q69124F
  • License MIT

Finds largest value.

Package Exports

  • @extra-array/max

Readme

Finds largest value. 🏃 📼 📦 🌔 📒

Alternatives: max, maxIndex.
Similar: min, max, range.
This is part of package extra-array.

array.max(x, [fc], [fm]);
// x:  an array
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require('extra-array');

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

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

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

references