Last active
May 25, 2018 07:29
-
-
Save popovkos/a1c78fc016c0219c42ff2b28a0e8c734 to your computer and use it in GitHub Desktop.
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 characters
async function someFunction() { | |
const myArray = [1, 2, 3]; | |
const connection = mysql.createPool({ options }); | |
let resolvedFinalArray = await Promise.all(myArray.map(async(value) => { // map instead of forEach | |
const result = await asyncFunction(connection, value); | |
finalValue.asyncFunctionValue = result.asyncFunctionValue; | |
return finalValue; // important to return the value | |
})); | |
return functionThatUsesResolvedValues(resolvedFinalArray); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment