Skip to content

Find minimum number from Object or Array or number of arguments

License

Notifications You must be signed in to change notification settings

smondal/find-min

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find-min

Build status Coverage Status Downloads

Install

$ npm install find-min

Usage

const findMin = require('find-min');

var min = findMin(1, 2, 3, 4)  // 1

var min = findMin([1, 2, 3, 4]) //1

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

var min = findMin({1: 2, 2: 4, 4: 5})  //'1'

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

API

findMin(Arguments)

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

findMin(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 minimum value from array.

If you pass empty array it will return undefined.

findMin(Object)

Type: Object

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

Related

About

Find minimum number from Object or Array or number of arguments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published