https://github.com/jonschlinkert/array-sum
Add up all of the numbers in an array of numbers. Works when non-numbers are present as well.
https://github.com/jonschlinkert/array-sum
add array math reduce sum
Last synced: about 1 year ago
JSON representation
Add up all of the numbers in an array of numbers. Works when non-numbers are present as well.
- Host: GitHub
- URL: https://github.com/jonschlinkert/array-sum
- Owner: jonschlinkert
- License: mit
- Created: 2014-06-15T07:58:21.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-01-15T03:06:39.000Z (over 11 years ago)
- Last Synced: 2025-04-20T04:34:21.567Z (about 1 year ago)
- Topics: add, array, math, reduce, sum
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 124 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# array-sum [](http://badge.fury.io/js/array-sum)
> Add up all of the numbers in an array of numbers. Works when non-numbers are present as well.
## Install
### Install with [npm](npmjs.org):
```bash
npm i array-sum --save-dev
```
## Usage
```js
var arraySum = require('array-sum');
arraySum([1, 2, 3, 4, 5]);
//=> 15
arraySum(['1', '2', 3, '4', 5]);
//=> 15
arraySum([1, 'foo', 2, 3, 4, {}, 5]);
//=> 15
```
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license
***
_This file was generated by [verb](https://github.com/assemble/verb) on January 14, 2015._