Document async/await usage

This commit is contained in:
Adam Reis
2018-02-21 15:36:57 +13:00
parent 0113977df6
commit 33dfe50c97

View File

@@ -29,6 +29,18 @@ const options = {
};
```
### Asynchronous replacement with `async`/`await`
```js
try {
const changes = await replace(options)
console.log('Modified files:', changes.join(', '));
}
catch (error) {
console.error('Error occurred:', error);
}
```
### Asynchronous replacement with promises
```js