Created
July 10, 2017 20:17
-
-
Save eschwartz/70a15f12e6ef90f377d5d51fba9c86d8 to your computer and use it in GitHub Desktop.
Async map
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
import * as _ from 'lodash'; | |
async function mapAsync<TVal, TRes>(items:TVal[], iter:(val:TVal, i:(number | string)) => Promise<TRes>):Promise<TRes[]> { | |
return Promise.all(_.map(items, iter)); | |
} | |
export default mapAsync; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment