Skip to content

yoshuawuyts/promise-reduce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

promise-reduce

NPM version build status Test coverage Downloads

Reduce an array and return a Promise.

Installation

$ npm install promise-reduce

Usage

const reduce = require('promise-reduce')

Promise.resolve([1, 2, 3])
  .then(reduce((prev, next) => prev + next), 0))
// => 6

Why?

This module is basically equivalent to bluebird.reduce, but it's handy to have the one function you need instead of a kitchen sink. Modularity! Especially handy if you're serving to the browser and need to reduce your javascript bundle size.

Works great in the browser with browserify!

See Also

License

MIT

About

Reduce an array and return a Promise

Resources

License

Stars

Watchers

Forks

Packages