mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 04:10:04 +02:00
update minify
This commit is contained in:
18
node_modules/try-to-catch/README.md
generated
vendored
18
node_modules/try-to-catch/README.md
generated
vendored
@@ -30,7 +30,8 @@ Simplest example with `async-await`:
|
||||
|
||||
```js
|
||||
const tryToCatch = require('try-to-catch');
|
||||
await tryToCatch(Promise.reject('hi'));
|
||||
const reject = Promise.reject.bind(Promise);
|
||||
await tryToCatch(reject, 'hi');
|
||||
// returns
|
||||
[ Error: hi]
|
||||
```
|
||||
@@ -47,11 +48,8 @@ await tryToCatch(() => 5);
|
||||
Advanced example:
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const {readFile, readdir} = require('fs').promises;
|
||||
const tryToCatch = require('try-to-catch');
|
||||
const {promisify} = require('util');
|
||||
const readFile = promisify(fs.readFile);
|
||||
const readDir = promisify(fs.readdir);
|
||||
|
||||
read(process.argv[2])
|
||||
.then(console.log)
|
||||
@@ -66,18 +64,10 @@ async function read(path) {
|
||||
if (error.code !== 'EISDIR')
|
||||
return error;
|
||||
|
||||
return await readDir(path);
|
||||
return await readdir(path);
|
||||
}
|
||||
```
|
||||
|
||||
## Environments
|
||||
|
||||
In old `node.js` environments that not fully supports `es2015`, `try-to-catch` can be used with:
|
||||
|
||||
```js
|
||||
var tryToCatch = require('try-to-catch/legacy');
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [try-catch](https://github.com/coderaiser/try-catch "try-catch") - functional try-catch wrapper.
|
||||
|
Reference in New Issue
Block a user