promise-map-object/index.js
2015-07-07 23:42:25 -05:00

11 lines
244 B
JavaScript

var lodash = require("lodash");
var Q = require("q");
function mapObjectPromises(input, func) {
return Q.all(_.map(input, func)).then(function(data) {
return _.zipObject(_.keys(input), data);
});
}
module.exports = mapObjectPromises;