{"name":"@putout/plugin-apply-try-catch","version":"2.0.1","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"putout plugin adds ability apply try-catch","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-try-catch#readme","main":"lib/index.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","watch:test":"madrun watch:test","lint":"madrun lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","fix:lint":"madrun fix:lint","coverage":"madrun coverage","report":"madrun report"},"dependencies":{},"keywords":["putout","putout-plugin","putout-plugin-apply","plugin","try-catch"],"devDependencies":{"@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^13.0.0","lerna":"^4.0.0","madrun":"^9.0.0","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=25"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"cd89d014aaf400624f25f2090f50fbbbd1dd714c","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-apply-try-catch@2.0.1","_nodeVersion":"16.14.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-/g2BeWyZMAnKqJl/f2NDJ9QOVgGxlDrKF/9NZKuhUYm2LkzNaTIf4QJhG9ngekYM/zoi0ESIcBdKQZycJG7RNg==","shasum":"a861545ccd17d9157b1796f69371f15a46d2282e","tarball":"http://registry-npm.ywwl.com/@putout/plugin-apply-try-catch/download/@putout/plugin-apply-try-catch-2.0.1.tgz","fileCount":8,"unpackedSize":6874,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiFg9RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9mQ//YFDS8ElBGyoTpY3vnqz1/2BsP/fvZ8/1jxSKhnOgFPKOjXGX\r\nIlRNY5bYcjiZMvlY9LnVhPfXGZVfO0tFdUgZ18Bu79Q6xZ3Vs1XgkYUG+aEv\r\nCQGBBbbLRfQS45EpC9v5O/oa4xgEWHa+AfXMk8/Ami4FD6qzPZWW+xKfpBO1\r\nMOeC3MklKTguX9HTV0aN5E2h1uAqzaR7qRLimGnRPA4rpcM9WXQoSSK+Kvgb\r\n6C2GeXlkkkzybYywAWWyt43BciOy0Q6vJuoh2V0Ld80ejfeZBBIuC/uxNrNd\r\nRj7UX+A79oLK0VzvUlG3fBCzAaKcmfCXocwtkVK4ptLi84R8IINdrfft+P3p\r\nfeJhJBghktEb21Z5deZuZuL/6Rd3udIS71J4cNV7Itv1aUJW4vcep0V6ML35\r\nQz4coOGvxLzl1hE6FurytYQBz9xtsquCQJxpqFuCL0weMsO7d/rnaapeJd/T\r\nq7lF8/vJbLfYQbusBQzGFBGPMh2UkClok3OOJZwXSpi2QOaaXBpiy8unNSZl\r\ncgy0dQOohyGc3CWVA1tiKi4euUtjYOEou05LSq86Lwid+DYyaes8jkKk7Sux\r\nWwMmSv6aHiYMfJA1mbdgU1xYNTB3QS/3+TB11qW07YvClk6xc0kJKnExacN/\r\nmdqvo0XYFh07gpdeg7ymOsrci0S/Km+1hUk=\r\n=B0pF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIATzCcNsHNMWqnHRGLXCbo19RfYuXqJIAbfJc00Q/lTeAiEAsOL+VORGHvH2T1V4kNaqoEc/v6ik52LkKTbbo1dG6+o="}],"size":2655,"noattachment":false,"key":"/@putout/plugin-apply-try-catch/-/@putout/plugin-apply-try-catch-2.0.1.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-apply-try-catch_2.0.1_1645612881021_0.7470576647691729"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-apply-try-catch [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-try-catch.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-try-catch \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply [tryCatch](https://github.com/coderaiser/try-catch) and [tryToCatch](https://github.com/coderaiser/try-to-catch). Renamed to [`@putout/plugin-try-catch`](https://www.npmjs.com/package/@putout/plugin-try-catch).\n\n## Install\n\n```\nnpm i @putout/plugin-apply-try-catch\n```\n\n## Rule\n\n```json\n{\n    \"rules\": {\n        \"apply-try-catch/await\": \"on\",\n        \"apply-try-catch/args\": \"on\",\n        \"apply-try-catch/declare\": \"on\",\n        \"apply-try-catch/expand-arguments\": \"on\",\n        \"apply-try-catch/try-catch\": \"on\",\n        \"apply-try-catch/try-to-catch\": \"on\"\n    }\n}\n```\n\n## try-catch\n\n### ❌ Example of incorrect code\n\n```js\ntry {\n    log('hello');\n} catch(error) {\n}\n```\n\n### ✅ Example of correct code\n\n```js\nimport tryCatch from 'try-catch';\nconst [error] = tryCatch(log, 'hello');\n```\n\n## try-to-catch\n\n### ❌ Example of incorrect code\n\n```js\ntry {\n    await send('hello');\n} catch(error) {\n}\n```\n\n### ✅ Example of correct code\n\n```js\nimport tryToCatch from 'try-catch';\nconst [error] = await tryToCatch(send, 'hello');\n```\n\n## await\n\n### ❌ Example of incorrect code\n\n```js\nawait tryCatch(a, b);\ntryToCatch(a, b);\n```\n\n### ✅ Example of correct code\n\n```js\nawait tryToCatch(a, b);\n```\n\n## args\n\n### ❌ Example of incorrect code\n\n```js\ntryCatch(send('hello'));\n```\n\n### ✅ Example of correct code\n\n```js\ntryCatch(send, 'hello');\n```\n\n## declare\n\n### ❌ Example of incorrect code\n\n```js\nconst [error] = tryCatch(fs.readFileSync, 'hello.txt');\n```\n\n### ✅ Example of correct code\n\n```js\nimport tryCatch from 'try-catch';\nconst [error] = tryCatch(fs.readFileSync, 'hello.txt');\n```\n\n## expand-arguments\n\n### ❌ Example of incorrect code\n\n```js\nimport tryCatch from 'try-catch';\n\ntest('some message', (t) => {\n    const fn = () => copymitter('/hello');\n    const [error] = tryCatch(fn);\n    \n    t.equal(error.message, 'to should be a string!');\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nimport tryCatch from 'try-catch';\n\ntest('some message', (t) => {\n    const [error] = tryCatch(copymitter, '/hello');\n    \n    t.equal(error.message, 'to should be a string!');\n    t.end();\n});\n```\n\n## License\n\nMIT\n","publish_time":1645612881150,"_cnpm_publish_time":1645612881150,"dist-tags":{"latest":"2.8.1"}}