https://github.com/timarney/async-patterns
collection of ways to use async await
https://github.com/timarney/async-patterns
Last synced: 5 months ago
JSON representation
collection of ways to use async await
- Host: GitHub
- URL: https://github.com/timarney/async-patterns
- Owner: timarney
- License: mit
- Created: 2018-02-26T13:36:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-26T13:38:31.000Z (over 8 years ago)
- Last Synced: 2025-02-15T10:30:28.994Z (over 1 year ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# async-patterns
# Async Await Promise All Array Destructuring
```javascript
const getBook = async bookName => {
const book = await fetchBook(bookName);
const [author, rating] = await Promise.all([
fetchAuthor(book.authorId),
fetchRating(book.id)
]);
return {
...book,
author,
rating
};
};
```
Reference: https://www.dalejefferson.com/blog/async-await-promise-all-array-destructuring/