Created
April 27, 2015 15:46
-
-
Save chinmay185/30d6b7d70868f99d610b to your computer and use it in GitHub Desktop.
Revisions
-
chinmay185 created this gist
Apr 27, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ var Promise = require("bluebird"); var productIds = ["productId1", "productId2", "productId3"]; var getProductsFromDb = function(productId) { // returns a promise of product } var productPromises = productIds.map(getProductFromDb); Promise.all(productPromises).then(function(products) { // calculate total price here });