1.0.0 • Published 7 years ago

average-array v1.0.0

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

average-array

A JavaScript Package for calculating average from an array. Also it will work for non-number array and it will ignore the non-numbers.

npm license github-issues

nodei.co

travis-status stars forks

Features

npm Install

npm install --save average-array

Script Tag

For Development

<script src="https://rawgit.com/Prosen-Ghosh/average-array/master/average.js"></script>

For Production

<script src="https://cdn.rawgit.com/Prosen-Ghosh/average-array/6dac0302/average.js"></script>

Usage

const avg = require('average-array');

avg([]);
//=> null

avg([1]);
//=> 1

avg([1,[]]);
//=> 1

avg([1,[],2]);
//=> 1.5

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

avg(); // without parameter this function will throw a type error
//=> TypeError: average() expects an array parameter

Author

Prosen Ghosh prosenghosh25@gmail.com (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)

License

  • MIT