promise-map-object/index.js

11 lines
239 B
JavaScript
Raw Permalink Normal View History

2015-07-08 05:17:07 +00:00
var _ = require("lodash");
2015-07-08 04:42:25 +00:00
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;