sum.js
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 install wilmoore/sum.js
$ bower install sum.js
$ volo add wilmoore/sum.js
-
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
-
use
<script src="sum.min.js"></script> or <script src="sum.js"></script>