arraymax

0.0.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i arraymax

    Weekly Downloads

    2

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • miguelmota