Skip to content

Instantly share code, notes, and snippets.

@llcoollasa
Created October 29, 2019 09:27
Show Gist options
  • Save llcoollasa/c50ab2b3aa2167d424d113a7862e9cfb to your computer and use it in GitHub Desktop.
Save llcoollasa/c50ab2b3aa2167d424d113a7862e9cfb to your computer and use it in GitHub Desktop.
Resolving Promise inside map in Type Script
const A = await Promise.all(accountUsers.map(async (user) => {
const { state, csrfSecret } = await oauth.generateState();
return {
accountId: user.accountId,
firstName: user.firstName,
lastName: user.lastName,
email: user.email,
csrfSecret,
state,
};
}));
const B = A.map((user) => {
return {
user.accountId,
user.firstName,
user.lastName,
user.email,
user.csrfSecret,
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment