diff options
Diffstat (limited to 'node_modules/p-try')
-rw-r--r-- | node_modules/p-try/index.js | 4 | ||||
-rw-r--r-- | node_modules/p-try/license | 21 | ||||
-rw-r--r-- | node_modules/p-try/package.json | 79 | ||||
-rw-r--r-- | node_modules/p-try/readme.md | 38 |
4 files changed, 142 insertions, 0 deletions
diff --git a/node_modules/p-try/index.js b/node_modules/p-try/index.js new file mode 100644 index 0000000..efa2f74 --- /dev/null +++ b/node_modules/p-try/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = cb => new Promise(resolve => { + resolve(cb()); +}); diff --git a/node_modules/p-try/license b/node_modules/p-try/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/p-try/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus <[email protected]> (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. diff --git a/node_modules/p-try/package.json b/node_modules/p-try/package.json new file mode 100644 index 0000000..cd4f8d4 --- /dev/null +++ b/node_modules/p-try/package.json @@ -0,0 +1,79 @@ +{ + "_args": [ + [ + "[email protected]", + "/home/dstaesse/git/website" + ] + ], + "_development": true, + "_from": "[email protected]", + "_id": "[email protected]", + "_inBundle": false, + "_integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "_location": "/p-try", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "[email protected]", + "name": "p-try", + "escapedName": "p-try", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/p-limit" + ], + "_resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "_spec": "1.0.0", + "_where": "/home/dstaesse/git/website", + "author": { + "name": "Sindre Sorhus", + "email": "[email protected]", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/p-try/issues" + }, + "description": "`Promise#try()` ponyfill - Starts a promise chain", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "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" + }, + "version": "1.0.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-try/readme.md b/node_modules/p-try/readme.md new file mode 100644 index 0000000..8e5fddd --- /dev/null +++ b/node_modules/p-try/readme.md @@ -0,0 +1,38 @@ +# p-try [![Build Status](https://travis-ci.org/sindresorhus/p-try.svg?branch=master)](https://travis-ci.org/sindresorhus/p-try) + +> [`Promise#try()`](https://github.com/ljharb/proposal-promise-try) [ponyfill](https://ponyfill.com) - Starts 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 --save p-try +``` + + +## Usage + +```js +const pTry = require('p-try'); + +pTry(() => { + return synchronousFunctionThatMightThrow(); +}).then(value => { + console.log(value); +}).catch(error => { + console.error(error); +}); +``` + + +## 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) |