Skip to content

Latest commit

 

History

History
52 lines (28 loc) · 1.25 KB

README.md

File metadata and controls

52 lines (28 loc) · 1.25 KB

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