arraymax

Get maximum value of collection.

Usage no npm install needed!

<script type="module">
  import arraymax from 'https://cdn.skypack.dev/arraymax';
</script>

README

array-max

Get maximum value of collection.

NPM

Install

npm install arraymax
bower install array-max

Usage

var max = require('arraymax');

console.log(max([])); // -Infinity
console.log(max([2,3,1])); //  3

var col = [{n:2}, {n:3}, {n:1}];

var result = max(col, function(x) {
  return x.n;
});

console.log(result); // {n:3}

console.log(max(col, 'n')); // {n:3}

License

MIT