Skip to content

Find maximum number from given Object or Array

License

Notifications You must be signed in to change notification settings

smondal/find-max

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find-max Build Status Coverage Status

Install

$ npm install @sandipmo/find-max

Usage

const findMax = require('find-max');

//Handle normal arguments
var max = findMax(1, 2, 3, 4)  // 4

var max = findMax([1, 2, 3, 4]) //4

//Handle array of array
var max = findMax([1, 2, 3, 4, [6, 12], [9, 10], [2], 8]) // 12

var max = findMax({1: 2, 2: 4, 4: 5})  //'4'

var max = findMax({a: 2, b: 4, c: 5}) //'c'

API

findMax(Arguments)

Arguments would be comma separated value. If you not pass any argument it will return you undefined

findMax(Array)

Type: Array

You can pass single array or array or array. If you pass array of array it will first apply flatten method to produce single array. Then return the maximum value from array.

If you pass empty array it will return undefined.

findMax(Object)

Type: Object

Compare the value of each key and return the maximum value from Object.

Related

About

Find maximum number from given Object or Array

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published