recursive-min

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i recursive-min

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • tyxla