1.0.1 • Published 10 years ago
co-reduce
Reduce an array (or object), using generators.
Install
Install the package with npm
:
$ npm install co-reduce
Usage
reduce(array, fn, init)
co(function* () {
var sum = yield* reduce([1, 2, 3, 4], function* (s, n) {
return yield* asyncAdd(s, n);
}, 0);
console.log(sum);
});
License
MIT