arrayrange

A simple helper which finds the minimum and maximum values, and the range, from an array

Usage no npm install needed!

<script type="module">
  import arrayrange from 'https://cdn.skypack.dev/arrayrange';
</script>

README

arrayrange

Build Status Coverage Status Inline docs

A simple, lightweight utility which calculates the minimum and maximum values in an array, and the range between the values.

Installation

npm install arrayrange

Usage

A full guide to the API can be found here.

Minimum value

arrayrange.min

var arrayRange = require('arrayrange');
var min = arrayRange.min(someArray);

Maximum value

arrayrange.max

var arrayRange = require('arrayrange');
var max = arrayRange.max(someArray);

Range

arrayrange.range

var arrayRange = require('arrayrange');
var range = arrayRange.range(someArray);

Improvements

I'm planning to add the following functionality:

  • Handling string arrays (min, max and range)
  • Handling arrays with mixed types (in a sensible and/or customisable way)

Contributions and Issues

If you notice any issues please log them, and contributions are always welcome.