Skip to content

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

License

Notifications You must be signed in to change notification settings

jonschlinkert/array-sum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

array-sum NPM version

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

Install

Install with npm:

npm i array-sum --save-dev

Usage

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

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on January 14, 2015.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published