An open API service indexing awesome lists of open source software.

https://github.com/doowb/array-avg

Calculate the average of an array of numbers.
https://github.com/doowb/array-avg

Last synced: about 1 month ago
JSON representation

Calculate the average of an array of numbers.

Awesome Lists containing this project

README

        

# array-avg [![NPM version](https://badge.fury.io/js/array-avg.svg)](http://badge.fury.io/js/array-avg) [![Build Status](https://travis-ci.org/doowb/array-avg.svg)](https://travis-ci.org/doowb/array-avg)

> Calculate the average of an array of numbers.

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i array-avg --save
```

## Usage

```js
var avg = require('array-avg');

avg([1, 2, 3, 4, 5]);
//=> 3

avg(['1', '2', 3, '4', 5]);
//=> 3

avg([1, 'foo', 2, 4, {}, 5]);
//=> 2
```

## Related projects

[array-sum](https://www.npmjs.com/package/array-sum): Add up all of the numbers in an array of numbers. Works when non-numbers are… [more](https://www.npmjs.com/package/array-sum) | [homepage](https://github.com/jonschlinkert/array-sum)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/array-avg/issues/new).

## Author

**Brian Woodward**

+ [github/doowb](https://github.com/doowb)
+ [twitter/doowb](http://twitter.com/doowb)

## License

Copyright © 2015 Brian Woodward
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 23, 2015._