builderman verion 0.1.0, initial commit/release.
This commit is contained in:
64
node_modules/try-to-catch/ChangeLog
generated
vendored
Normal file
64
node_modules/try-to-catch/ChangeLog
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
2022.03.09, v3.0.1
|
||||
|
||||
feature:
|
||||
- (package) supertape v7.2.0
|
||||
- (package) eslint v8.10.0
|
||||
- (package) madrun v9.0.0
|
||||
- (package) eslint-plugin-putout v14.4.0
|
||||
- (package) putout v25.4.1
|
||||
|
||||
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:
|
||||
- (try-to-catch) wraptile -> noArg
|
||||
|
||||
|
||||
2018.11.08, v1.1.0
|
||||
|
||||
feature:
|
||||
- (try-to-catch) add support of a functions
|
||||
- (package) redrun v7.0.2
|
||||
- (package) nyc v13.0.1
|
||||
- (package) eslint v5.6.0
|
||||
- (package) babel v7.0.0
|
||||
- (package) redrun v6.0.0
|
||||
|
||||
|
||||
2018.02.13, v1.0.2
|
||||
|
||||
fix:
|
||||
- (package) legacy
|
||||
|
||||
|
||||
2018.02.12, v1.0.1
|
||||
|
||||
feature:
|
||||
- (package) keywords: then
|
||||
|
||||
21
node_modules/try-to-catch/LICENSE
generated
vendored
Normal file
21
node_modules/try-to-catch/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) coderaiser
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
74
node_modules/try-to-catch/README.md
generated
vendored
Normal file
74
node_modules/try-to-catch/README.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# Try to Catch [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
||||
|
||||
[NPMIMGURL]: https://img.shields.io/npm/v/try-to-catch.svg?style=flat&longCache=true
|
||||
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/try-to-catch/master.svg?style=flat&longCache=true
|
||||
[NPMURL]: https://npmjs.org/package/try-to-catch "npm"
|
||||
[BuildStatusURL]: https://travis-ci.org/coderaiser/try-to-catch "Build Status"
|
||||
[CoverageURL]: https://coveralls.io/github/coderaiser/try-to-catch?branch=master
|
||||
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/try-to-catch/badge.svg?branch=master&service=github
|
||||
|
||||
Functional `try-catch` wrapper for `promises`.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm i try-to-catch
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### tryToCatch(fn, [...args])
|
||||
|
||||
Wrap function to avoid `try-catch` block, resolves `[error, result]`;
|
||||
|
||||
### Example
|
||||
|
||||
Simplest example with `async-await`:
|
||||
|
||||
```js
|
||||
const tryToCatch = require('try-to-catch');
|
||||
const reject = Promise.reject.bind(Promise);
|
||||
await tryToCatch(reject, 'hi');
|
||||
// returns
|
||||
// [ Error: hi]
|
||||
```
|
||||
|
||||
Can be used with functions:
|
||||
|
||||
```js
|
||||
const tryToCatch = require('try-to-catch');
|
||||
await tryToCatch(() => 5);
|
||||
// returns
|
||||
[null, 5];
|
||||
```
|
||||
|
||||
Advanced example:
|
||||
|
||||
```js
|
||||
const {readFile, readdir} = require('fs/promises');
|
||||
const tryToCatch = require('try-to-catch');
|
||||
|
||||
read(process.argv[2])
|
||||
.then(console.log)
|
||||
.catch(console.error);
|
||||
|
||||
async function read(path) {
|
||||
const [error, data] = await tryToCatch(readFile, path, 'utf8');
|
||||
|
||||
if (!error)
|
||||
return data;
|
||||
|
||||
if (error.code !== 'EISDIR')
|
||||
return error;
|
||||
|
||||
return await readdir(path);
|
||||
}
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [try-catch](https://github.com/coderaiser/try-catch "try-catch") - functional try-catch wrapper.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
17
node_modules/try-to-catch/lib/try-to-catch.js
generated
vendored
Normal file
17
node_modules/try-to-catch/lib/try-to-catch.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = async (fn, ...args) => {
|
||||
check(fn);
|
||||
|
||||
try {
|
||||
return [null, await fn(...args)];
|
||||
} catch(e) {
|
||||
return [e];
|
||||
}
|
||||
};
|
||||
|
||||
function check(fn) {
|
||||
if (typeof fn !== 'function')
|
||||
throw Error('fn should be a function!');
|
||||
}
|
||||
|
||||
47
node_modules/try-to-catch/package.json
generated
vendored
Normal file
47
node_modules/try-to-catch/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "try-to-catch",
|
||||
"version": "3.0.1",
|
||||
"type": "commonjs",
|
||||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
||||
"description": "function try-catch wrapper for promises",
|
||||
"homepage": "http://github.com/coderaiser/try-to-catch",
|
||||
"main": "lib/try-to-catch.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/coderaiser/try-to-catch.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "madrun test",
|
||||
"watch:test": "madrun watch:test",
|
||||
"lint": "madrun lint",
|
||||
"fix:lint": "madrun fix:lint",
|
||||
"coverage": "madrun coverage",
|
||||
"report": "madrun report"
|
||||
},
|
||||
"dependencies": {},
|
||||
"keywords": [
|
||||
"try",
|
||||
"catch",
|
||||
"function",
|
||||
"promise",
|
||||
"async",
|
||||
"await",
|
||||
"try-catch",
|
||||
"then"
|
||||
],
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.0",
|
||||
"eslint": "^8.10.0",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"eslint-plugin-putout": "^14.4.0",
|
||||
"madrun": "^9.0.0",
|
||||
"nodemon": "^2.0.2",
|
||||
"nyc": "^15.0.0",
|
||||
"putout": "^25.4.1",
|
||||
"supertape": "^7.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user