sum.js

0.6.0 • Public • Published

sum.js

Build Status NPM version NPM downloads LICENSE

Sum a list of number literals, nested object property values, or values returned from a custom function for Node.js and the browser.

Examples

Number literals

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

Nested object properties

var strings = ['literal', 'constructor'];
sum(strings, 'length');
//=> 18

Custom function

sum([1, 2, 3, 4], function (n) { n * 60 });
//=> 600

Installation

component

$ component install wilmoore/sum.js

bower

$ bower install sum.js

npm

NPM

volo

$ volo add wilmoore/sum.js

manual

  1. download

     % curl -#O https://raw.github.com/wilmoore/sum.js/master/sum.min.js
     or
     % curl -#O https://raw.github.com/wilmoore/sum.js/master/sum.js
    
  2. use

     <script src="sum.min.js"></script>
     or
     <script src="sum.js"></script>
    

License

MIT

Package Sidebar

Install

npm i sum.js

Weekly Downloads

6

Version

0.6.0

License

MIT

Last publish

Collaborators

  • wilmoore