devsite/node_modules/promise-each
2024-07-07 18:49:38 -07:00
..
node_modules/any-promise more 2024-07-07 18:49:38 -07:00
index.js more 2024-07-07 18:49:38 -07:00
LICENSE more 2024-07-07 18:49:38 -07:00
package.json more 2024-07-07 18:49:38 -07:00
README.md more 2024-07-07 18:49:38 -07:00

promise-each

NPM version build status Test coverage Downloads

Call a function for each value in an array and return a Promise. Should only be used for side effects. Waits for promises to resolve before proceeding to the next value.

Installation

$ npm install promise-each

Usage

const each = require('promise-each')

Promise.resolve([1, 2, 3])
  .then(each((val) => console.log(val)))
// => 1
// => 2
// => 3

Why?

This module is basically equivalent to bluebird.each, 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