JSPM

@extra-array/max

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

Finds largest entry.

Package Exports

  • @extra-array/max

Readme

Finds largest entry. 🏃 📼 📦 🌔 📒

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)
// --> [index, value]
const array = require('extra-array');

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

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

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

references