Package Exports
- array-reduce
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (array-reduce) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
array-reduce
[].reduce()
for old browsers
example
var reduce = require('array-reduce');
var xs = [ 1, 2, 3, 4 ];
var sum = reduce(xs, function (acc, x) { return acc + x }, 0);
console.log(sum);
output:
10
methods
var reduce = require('array-reduce')
var res = reduce(xs, f, init)
Create a result res
by folding acc = f(acc, xs[i], i)
over each element in
the array xs
at element i
. If init
is given, the first acc
value is
init
, otherwise xs[0]
is used.
install
With npm do:
npm install array-reduce
license
MIT