use directories for structure

This commit is contained in:
s2
2020-05-26 10:37:57 +02:00
parent 66580d4847
commit ae4aaf2668
1287 changed files with 92093 additions and 13113 deletions

18
node_modules/try-to-catch/README.md generated vendored
View File

@@ -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.