# compute-nanrange

> Computes the arithmetic range of an array ignoring non-numeric values.

Latest version **1.0.0** (published 2015-02-28) · 0 weekly downloads

## Install

```sh
npm install compute-nanrange
pnpm add compute-nanrange
yarn add compute-nanrange
bun add compute-nanrange
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-02-28 |
| First published | 2015-02-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Philipp Burckhardt |
| Maintainers | planeshifter, kgryte |
| Keywords | compute.io, compute, computation, statistics, stats, mathematics, math, range, arithmetic, min, max, minimum, maximum, extremes |

## Links

- npm: https://www.npmjs.com/package/compute-nanrange
- Repository: https://github.com/compute-io/nanrange
- Issues: https://github.com/compute-io/nanrange/issues
- npm.io page: https://npm.io/package/compute-nanrange

## Dependencies (2)

- [validate.io-array](https://npm.io/package/validate.io-array.md) ^1.0.3
- [validate.io-number](https://npm.io/package/validate.io-number.md) ^1.0.3

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-02-28
- 0.9.0 — 2015-02-28

## README

nanrange
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]

> Computes the arithmetic range of an array ignoring non-numeric values.

## Installation

``` bash
$ npm install compute-nanrange
```

For use in the browser, use [browserify](https://github.com/substack/node-browserify).


## Usage

``` javascript
var nanrange = require( 'compute-nanrange' );
```

#### nanrange( arr[, accessor] )

Computes the arithmetic range of an `array` ignoring non-numeric values. For primitive `arrays`,

``` javascript
var arr = [ 2, null, 3, 4, null, 1 ];

var r = range( arr );
// returns [1,4]
```

For object `arrays`, provide an accessor `function` for accessing `array` values

``` javascript
var arr = [
	[1,2],
	[2,null],
	[3,3],
	[4,4],
	[5,null],
	[6,1]
];

function getValue( d ) {
	return d[ 1 ];
}

var r = range( arr, getValue );
// returns [1,4]
```

__Note__: if an input `array` does not contain any `numeric` values, the function returns `null`.



## Examples

``` javascript
var nanrange = require( 'compute-nanrange' );

var data = new Array( 100 );
for ( var i = 0; i < data.length; i++ ) {
	if ( i % 2 === 0 ){
		data[ i ] = null;
	} else {
		data[ i ] = Math.random()*100;
	}
}
console.log( nanrange( data ) );
```

To run the example code from the top-level application directory,

``` bash
$ node ./examples/index.js
```



## Tests

### Unit

Unit tests use the [Mocha](http://mochajs.org/) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:

``` bash
$ make test
```

All new feature development should have corresponding unit tests to validate correct functionality.


### Test Coverage

This repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

``` bash
$ make test-cov
```

Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,

``` bash
$ make view-cov
```


---
## License

[MIT license](http://opensource.org/licenses/MIT).


## Copyright

Copyright &copy; 2015. Philipp Burckhardt.


[npm-image]: http://img.shields.io/npm/v/compute-nanrange.svg
[npm-url]: https://npmjs.org/package/compute-nanrange

[travis-image]: http://img.shields.io/travis/compute-io/nanrange/master.svg
[travis-url]: https://travis-ci.org/compute-io/nanrange

[coveralls-image]: https://img.shields.io/coveralls/compute-io/nanrange/master.svg
[coveralls-url]: https://coveralls.io/r/compute-io/nanrange?branch=master

[dependencies-image]: http://img.shields.io/david/compute-io/nanrange.svg
[dependencies-url]: https://david-dm.org/compute-io/nanrange

[dev-dependencies-image]: http://img.shields.io/david/dev/compute-io/nanrange.svg
[dev-dependencies-url]: https://david-dm.org/dev/compute-io/nanrange

[github-issues-image]: http://img.shields.io/github/issues/compute-io/nanrange.svg
[github-issues-url]: https://github.com/compute-io/nanrange/issues

---
_Source: https://npm.io/package/compute-nanrange · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
