0.0.1 • Published 9 years ago

arraymax v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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