use directories for structure
This commit is contained in:
27
node_modules/try-to-catch/ChangeLog
generated
vendored
27
node_modules/try-to-catch/ChangeLog
generated
vendored
@@ -1,3 +1,30 @@
|
||||
2020.02.24, v3.0.0
|
||||
|
||||
feature:
|
||||
- (try-to-catch) promise -> async
|
||||
|
||||
|
||||
2019.12.30, v2.0.1
|
||||
|
||||
fix:
|
||||
- (try-to-catch) minimal node: v4 -> v6
|
||||
|
||||
feature:
|
||||
- (package) putout v7.3.4
|
||||
- (package) nyc v15.0.0
|
||||
- (package) nodemon v2.0.2
|
||||
|
||||
|
||||
2019.10.16, v2.0.0
|
||||
|
||||
feature:
|
||||
- (package) putout v6.15.1
|
||||
- (package) madrun v3.0.6
|
||||
- (try-to-catch) drop support of node < 4
|
||||
- (package) nyc v14.1.1
|
||||
- (package) eslint v6.1.0
|
||||
|
||||
|
||||
2018.11.08, v1.1.1
|
||||
|
||||
fix:
|
||||
|
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.
|
||||
|
16
node_modules/try-to-catch/lib/try-to-catch.js
generated
vendored
16
node_modules/try-to-catch/lib/try-to-catch.js
generated
vendored
@@ -1,17 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const success = (a) => [null, a];
|
||||
const fail = (a) => [a];
|
||||
|
||||
const noArg = (f, a) => () => f(...a);
|
||||
|
||||
module.exports = (fn, ...args) => {
|
||||
module.exports = async (fn, ...args) => {
|
||||
check(fn);
|
||||
|
||||
return Promise.resolve()
|
||||
.then(noArg(fn, args))
|
||||
.then(success)
|
||||
.catch(fail);
|
||||
try {
|
||||
return [null, await fn(...args)];
|
||||
} catch(e) {
|
||||
return [e];
|
||||
}
|
||||
};
|
||||
|
||||
function check(fn) {
|
||||
|
56
node_modules/try-to-catch/package.json
generated
vendored
56
node_modules/try-to-catch/package.json
generated
vendored
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"_from": "try-to-catch@^1.0.2",
|
||||
"_id": "try-to-catch@1.1.1",
|
||||
"_from": "try-to-catch@^3.0.0",
|
||||
"_id": "try-to-catch@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ikUlS+/BcImLhNYyIgZcEmq4byc31QpC+46/6Jm5ECWkVFhf8SM2Fp/0pMVXPX6vk45SMCwrP4Taxucne8I0VA==",
|
||||
"_integrity": "sha512-eIm6ZXwR35jVF8By/HdbbkcaCDTBI5PpCPkejRKrYp0jyf/DbCCcRhHD7/O9jtFI3ewsqo9WctFEiJTS6i+CQA==",
|
||||
"_location": "/try-to-catch",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "try-to-catch@^1.0.2",
|
||||
"raw": "try-to-catch@^3.0.0",
|
||||
"name": "try-to-catch",
|
||||
"escapedName": "try-to-catch",
|
||||
"rawSpec": "^1.0.2",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/minify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/try-to-catch/-/try-to-catch-1.1.1.tgz",
|
||||
"_shasum": "770162dd13b9a0e55da04db5b7f888956072038a",
|
||||
"_spec": "try-to-catch@^1.0.2",
|
||||
"_where": "F:\\projects\\vanillajs-seed\\node_modules\\minify",
|
||||
"_resolved": "https://registry.npmjs.org/try-to-catch/-/try-to-catch-3.0.0.tgz",
|
||||
"_shasum": "a1903b44d13d5124c54d14a461d22ec1f52ea14b",
|
||||
"_spec": "try-to-catch@^3.0.0",
|
||||
"_where": "D:\\Projects\\siag\\vanillajs-seed\\node_modules\\minify",
|
||||
"author": {
|
||||
"name": "coderaiser",
|
||||
"email": "mnemonic.enemy@gmail.com",
|
||||
@@ -35,16 +35,18 @@
|
||||
"deprecated": false,
|
||||
"description": "function try-catch wrapper for promises",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"coveralls": "^3.0.0",
|
||||
"eslint": "^5.6.0",
|
||||
"nodemon": "^1.14.12",
|
||||
"nyc": "^13.0.1",
|
||||
"redrun": "^7.0.2",
|
||||
"tape": "^4.8.0",
|
||||
"try-to-tape": "^1.0.0"
|
||||
"eslint": "^6.1.0",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"eslint-plugin-putout": "^3.0.0",
|
||||
"madrun": "^5.4.0",
|
||||
"nodemon": "^2.0.2",
|
||||
"nyc": "^15.0.0",
|
||||
"putout": "^7.3.4",
|
||||
"supertape": "^1.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"homepage": "http://github.com/coderaiser/try-to-catch",
|
||||
"keywords": [
|
||||
@@ -65,14 +67,12 @@
|
||||
"url": "git://github.com/coderaiser/try-to-catch.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel lib -d legacy",
|
||||
"coverage": "nyc npm test",
|
||||
"legacy": "echo \"module.exports = require('./try-to-catch')\" > legacy/index.js",
|
||||
"lint": "eslint lib test",
|
||||
"report": "nyc report --reporter=text-lcov | coveralls",
|
||||
"test": "tape 'test/*.js'",
|
||||
"watch:test": "nodemon -w lib -w test -x \"npm test\"",
|
||||
"wisdom": "redrun build legacy"
|
||||
"coverage": "madrun coverage",
|
||||
"fix:lint": "madrun fix:lint",
|
||||
"lint": "madrun lint",
|
||||
"report": "madrun report",
|
||||
"test": "madrun test",
|
||||
"watch:test": "madrun watch:test"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
"version": "3.0.0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user