Skip to content

Instantly share code, notes, and snippets.

@jaawerth
Last active October 21, 2015 20:08
Show Gist options
  • Save jaawerth/792ed35479185b4e51eb to your computer and use it in GitHub Desktop.
Save jaawerth/792ed35479185b4e51eb to your computer and use it in GitHub Desktop.
{
"name": "promise-map",
"version": "1.0.0",
"main": "./promise-map.js"
}
'use strict';
module.exports = function promiseMap(mapperFn, arrOrArrPromise) {
return Promise.resolve(arrOrArrPromise)
.then(Promise.all.bind(Promise))
.then(function(arr) {
return Promise.all(arr.map(mapperFn));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment