Skip to content

Commit 6774f75

Browse files
fix async/await example
There's no need to `await` a call to `require`, and they might sooner be written in single lines to mimic the style used for the previous examples.
1 parent cd50889 commit 6774f75

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,11 +1726,8 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
17261726
```javascript
17271727
async function getCleanCodeArticle() {
17281728
try {
1729-
const request = await require('request-promise');
1730-
const response = await request.get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin');
1731-
const fileHandle = await require('fs-promise');
1732-
1733-
await fileHandle.writeFile('article.html', response);
1729+
const response = await require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin');
1730+
await require('fs-promise').writeFile('article.html', response);
17341731
console.log('File written');
17351732
} catch(err) {
17361733
console.error(err);

0 commit comments

Comments
 (0)