{"_id":"p-try","_rev":"1111642","name":"p-try","description":"`Start a promise chain","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-10-04T16:41:52.000Z","created":"2016-10-21T06:16:43.459Z","3.0.0":"2021-10-04T16:19:43.327Z","2.2.0":"2019-03-31T12:34:35.198Z","2.1.0":"2019-03-18T17:30:47.159Z","2.0.0":"2018-06-14T17:10:59.660Z","1.0.0":"2016-10-21T06:16:43.459Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-try.git"},"versions":{"3.0.0":{"name":"p-try","version":"3.0.0","description":"`Start a promise chain","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-try.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","try","resolve","function","catch","async","await","promises","settled","ponyfill","polyfill","shim","bluebird"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","xo":"^0.45.0"},"gitHead":"8cb14e34e1031dbdfc385058c36b47f90910332e","bugs":{"url":"https://github.com/sindresorhus/p-try/issues"},"homepage":"https://github.com/sindresorhus/p-try#readme","_id":"p-try@3.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.20.3","dist":{"shasum":"9d56ac76f66a7396c6f0c81407cb39e3375be3c2","size":2175,"noattachment":false,"key":"/p-try/-/p-try-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-try/download/p-try-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-try_3.0.0_1633364383167_0.2080334787200102"},"_hasShrinkwrap":false,"publish_time":1633364383327,"_cnpm_publish_time":1633364383327},"2.2.0":{"name":"p-try","version":"2.2.0","description":"`Start a promise chain","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-try.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","try","resolve","function","catch","async","await","promises","settled","ponyfill","polyfill","shim","bluebird"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.1","xo":"^0.24.0"},"gitHead":"e80e2e130b2d16807345be02aa03541e6e085952","bugs":{"url":"https://github.com/sindresorhus/p-try/issues"},"homepage":"https://github.com/sindresorhus/p-try#readme","_id":"p-try@2.2.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"cb2868540e313d61de58fafbe35ce9004d5540e6","size":2194,"noattachment":false,"key":"/p-try/-/p-try-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-try/download/p-try-2.2.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-try_2.2.0_1554035674934_0.5387262637396022"},"_hasShrinkwrap":false,"publish_time":1554035675198,"_cnpm_publish_time":1554035675198},"2.1.0":{"name":"p-try","version":"2.1.0","description":"`Start a promise chain","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-try.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["promise","try","resolve","function","catch","async","await","promises","settled","ponyfill","polyfill","shim","bluebird"],"devDependencies":{"ava":"^1.3.1","tsd-check":"^0.5.0","xo":"^0.24.0"},"gitHead":"49fe9f6558307544a992f314132711b71445b901","bugs":{"url":"https://github.com/sindresorhus/p-try/issues"},"homepage":"https://github.com/sindresorhus/p-try#readme","_id":"p-try@2.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"c1a0f1030e97de018bb2c718929d2af59463e505","size":2067,"noattachment":false,"key":"/p-try/-/p-try-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-try/download/p-try-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-try_2.1.0_1552930246946_0.0368995873413136"},"_hasShrinkwrap":false,"publish_time":1552930247159,"_cnpm_publish_time":1552930247159},"2.0.0":{"name":"p-try","version":"2.0.0","description":"`Start a promise chain","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-try.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["promise","try","resolve","function","catch","async","await","promises","settled","ponyfill","polyfill","shim","bluebird"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"bba0e1dd227a64c91d16840e0985be9603c3ab62","bugs":{"url":"https://github.com/sindresorhus/p-try/issues"},"homepage":"https://github.com/sindresorhus/p-try#readme","_id":"p-try@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"85080bb87c64688fa47996fe8f7dfbe8211760b1","size":1810,"noattachment":false,"key":"/p-try/-/p-try-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-try/download/p-try-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-try_2.0.0_1528996259608_0.5084892289403542"},"_hasShrinkwrap":false,"publish_time":1528996259660,"_cnpm_publish_time":1528996259660},"1.0.0":{"name":"p-try","version":"1.0.0","description":"`Promise#try()` ponyfill - Starts a promise chain","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-try.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["promise","try","resolve","function","catch","async","await","promises","settled","ponyfill","polyfill","shim","bluebird"],"devDependencies":{"ava":"*","xo":"*"},"xo":{"esnext":true},"gitHead":"8a6f2c232b80e12c138714e553fc8dd6313604c2","bugs":{"url":"https://github.com/sindresorhus/p-try/issues"},"homepage":"https://github.com/sindresorhus/p-try#readme","_id":"p-try@1.0.0","_shasum":"cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3","size":1684,"noattachment":false,"key":"/p-try/-/p-try-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-try/download/p-try-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/p-try-1.0.0.tgz_1477030603238_0.5670752932783216"},"directories":{},"publish_time":1477030603459,"_cnpm_publish_time":1477030603459,"_hasShrinkwrap":false}},"readme":"# p-try\n\n> Start a promise chain\n\n[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/)\n\n## Install\n\n```sh\nnpm install p-try\n```\n\n## Usage\n\n```js\nimport pTry from 'p-try';\n\ntry {\n\tconst value = await pTry(() => {\n\t\treturn synchronousFunctionThatMightThrow();\n\t});\n\tconsole.log(value);\n} catch (error) {\n\tconsole.error(error);\n}\n```\n\n## API\n\n### pTry(fn, ...arguments)\n\nReturns 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.\n\nSupport 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.\n\n#### fn\n\nThe function to run to start the promise chain.\n\n#### arguments\n\nArguments to pass to `fn`.\n\n## Related\n\n- [More…](https://github.com/sindresorhus/promise-fun)\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-p-try?utm_source=npm-p-try&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n","_attachments":{},"homepage":"https://github.com/sindresorhus/p-try#readme","bugs":{"url":"https://github.com/sindresorhus/p-try/issues"},"license":"MIT"}