This commit is contained in:
Stephen Franceschelli 2019-07-30 13:41:05 -04:00
parent 596a6da241
commit c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions

39
node_modules/p-try/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
declare const pTry: {
/**
Start a promise chain.
@param fn - The function to run to start the promise chain.
@param arguments - Arguments to pass to `fn`.
@returns The value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error.
@example
```
import pTry = require('p-try');
(async () => {
try {
const value = await pTry(() => {
return synchronousFunctionThatMightThrow();
});
console.log(value);
} catch (error) {
console.error(error);
}
})();
```
*/
<ValueType, ArgumentsType extends unknown[]>(
fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
...arguments: ArgumentsType
): Promise<ValueType>;
// TODO: remove this in the next major version, refactor the whole definition to:
// declare function pTry<ValueType, ArgumentsType extends unknown[]>(
// fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
// ...arguments: ArgumentsType
// ): Promise<ValueType>;
// export = pTry;
default: typeof pTry;
};
export = pTry;

9
node_modules/p-try/index.js generated vendored Normal file
View file

@ -0,0 +1,9 @@
'use strict';
const pTry = (fn, ...arguments_) => new Promise(resolve => {
resolve(fn(...arguments_));
});
module.exports = pTry;
// TODO: remove this in the next major version
module.exports.default = pTry;

9
node_modules/p-try/license generated vendored Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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/p-try/package.json generated vendored Normal file
View file

@ -0,0 +1,74 @@
{
"_from": "p-try@^2.0.0",
"_id": "p-try@2.2.0",
"_inBundle": false,
"_integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"_location": "/p-try",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "p-try@^2.0.0",
"name": "p-try",
"escapedName": "p-try",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/p-limit"
],
"_resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"_shasum": "cb2868540e313d61de58fafbe35ce9004d5540e6",
"_spec": "p-try@^2.0.0",
"_where": "E:\\github\\setup-java\\node_modules\\p-limit",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/p-try/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "`Start a promise chain",
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/p-try#readme",
"keywords": [
"promise",
"try",
"resolve",
"function",
"catch",
"async",
"await",
"promises",
"settled",
"ponyfill",
"polyfill",
"shim",
"bluebird"
],
"license": "MIT",
"name": "p-try",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/p-try.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "2.2.0"
}

58
node_modules/p-try/readme.md generated vendored Normal file
View file

@ -0,0 +1,58 @@
# p-try [![Build Status](https://travis-ci.org/sindresorhus/p-try.svg?branch=master)](https://travis-ci.org/sindresorhus/p-try)
> Start a promise chain
[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/)
## Install
```
$ npm install p-try
```
## Usage
```js
const pTry = require('p-try');
(async () => {
try {
const value = await pTry(() => {
return synchronousFunctionThatMightThrow();
});
console.log(value);
} catch (error) {
console.error(error);
}
})();
```
## API
### pTry(fn, ...arguments)
Returns a `Promise` resolved with the value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error.
Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions.
#### fn
The function to run to start the promise chain.
#### arguments
Arguments to pass to `fn`.
## Related
- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome
- [More…](https://github.com/sindresorhus/promise-fun)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)