Created
January 14, 2019 19:00
-
-
Save zbarnes757/eeaaecae4b3817750132af9ace1c5893 to your computer and use it in GitHub Desktop.
How to chunk Promises with Bluebird
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Promise = require('bluebird'); | |
const stocks = ['aapl', 'googl', 'f', 'gm']; | |
function getThings(things) { | |
// DOCS: http://bluebirdjs.com/docs/api/promise.map.html | |
return Promise.map(things, thing => Promise.resolve(thing), { concurrency: 2 }); | |
} | |
getThings(stocks); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment