https://github.com/nhsz/sumar
Sum all the values of an array, if they are all numeric
https://github.com/nhsz/sumar
Last synced: 5 months ago
JSON representation
Sum all the values of an array, if they are all numeric
- Host: GitHub
- URL: https://github.com/nhsz/sumar
- Owner: nhsz
- License: mit
- Created: 2017-06-03T16:53:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-03T19:30:20.000Z (over 8 years ago)
- Last Synced: 2025-06-09T07:57:00.484Z (7 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/sumar
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sumar
[](https://nodei.co/npm/sumar/)
> Sum all the values of an array, if they are all numeric
## Install
```
$ npm install --save sumar
```
## Usage
```js
const sum = require('sumar')
console.log(sum([]))
// => 0
console.log(sum([1]))
// => 1
console.log(sum([0, 1, 2, 3]))
// => 6
console.log(sum([27, 421, -8, 0, -154, 23, 11, 256]))
// => 576
```
## License
MIT © **[`Nicolás Quiroz`](https://nicolasquiroz.com)**