codetogo.io
codetogo.io copied to clipboard
Use Case Suggestion: resolve all promises
@Popesites What do you mean by resolve all promises ? or do you mean all promise should settle like this if the mdn link is as per the ask here, i can go ahead and implement it, or if that's not addressing the question here, I think we should still incorporate that as a separate use case ? What do you think @jadjoubran ?
@Darth-koder007 I meant resolving an array of promises asynchronously using await, something like this:
async () => {
const result = await Promise.all(data.map(async obj => {
const example = await Model.findOne({ someData: obj.someData });
return example;
}));
}
Nice 👍 would be cool to have a short example that doesn't depend on an external library.. maybe using fetch
?