0.1.0 • Published 8 years ago

recursive-min v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

recursive-min

Returns the smallest number from a multidimensional array or object.

npm install recursive-min

Build Status

About

An easy to use solution for finding the smallest number from a multidimensional array or object.

Arrays and objects are traversed recursively, number values are compared, the rest are skipped.

Returns false on failure

Syntax

recursiveMin(objOrArray)

objOrArray

Object or array to fetch the minimum number from.

min

Optional. Use it to specify a temporary minimum value.

Usage

Call recursiveMin() by passing the array or object you wish to find the smallest number from. If you specify min, it will be the maximum possible result.

var input = [0, 12, [4, -5]];
var min = recursiveMin(input);

console.log(min); // -5

License

MIT