Skip to content

Instantly share code, notes, and snippets.

@ktilcu
Created January 7, 2018 15:44
Show Gist options
  • Select an option

  • Save ktilcu/4b227c2b2e3103aa3a73c284277ffd70 to your computer and use it in GitHub Desktop.

Select an option

Save ktilcu/4b227c2b2e3103aa3a73c284277ffd70 to your computer and use it in GitHub Desktop.
const getAvatars = async (userId) => {
const user = await getUser(userId);
const [avatar, friends] = await Promise.all([user.avatar(), user.friends()])
const avatars = [avatar];
return avatars.concat(
await Promise.all(
friends.map(friend => friend.avatar())
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment