1.0.0 • Published 7 years ago

sum-list v1.0.0

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

sum-list

Add up all of the numbers in an array of numbers. Also works when non-numbers are present as well.

npm license github-issues

nodei.co

travis-status stars forks

Features

npm Install

npm install --save sum-list

Script Tag

For Development

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

For Production

<script src="https://cdn.rawgit.com/Prosen-Ghosh/sum-list/ed0e191c/sum.js"></script>

Usage

var sum = require('sum-list')

sum([1,2,3,4]);
//=> 10
sum([1,2,3,4,10]);
//=> 20

sum([1,2,3,"as",{},[],9]);
//=> 15
sum([1,2,3,"as",{},[]]);
//=> 6

//TypeError

sum(); // Without parameter function call will throw an type error
//=> TypeError: sum() expects an array parameter

Author

Prosen Ghosh prosenghosh25@gmail.com

License

  • MIT