1.0.1 • Published 5 years ago
milesman34-summation v1.0.1
milesman34-summation
Sums the items of an array after applying a given function on each item.
Install
Install with npm:
$ npm install --save milesman34-summation
Usage
const summation = require("milesman34-summation");
const array = [3, 2, 7, 4];
summation(array, e => e ** 2);
//78
The first argument for summation
must be an array.
The second argument must be a function that operates on an element, similar to what map
would use.