{"_id":"@putout/plugin-apply-early-return","_rev":"4159089","name":"@putout/plugin-apply-early-return","description":"🐊Putout plugin adds ability use apply early return","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"time":{"modified":"2026-03-01T20:34:04.000Z","created":"2021-07-21T20:32:52.868Z","3.0.0":"2023-06-08T11:43:51.054Z","2.0.0":"2022-03-14T14:16:31.692Z","1.0.1":"2021-07-22T19:00:45.973Z","1.0.0":"2021-07-21T20:32:52.868Z"},"users":{},"author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"repository":{"type":"git","url":"git://github.com/coderaiser/putout.git"},"versions":{"3.0.0":{"name":"@putout/plugin-apply-early-return","version":"3.0.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin adds ability use apply early return","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-early-return#readme","main":"lib/apply-early-return.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","early-return"],"devDependencies":{"@putout/test":"^6.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-n":"^16.0.0","eslint-plugin-putout":"^17.0.0","lerna":"^6.0.1","madrun":"^9.0.0","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=29"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"ed849fe142aa695bc237276faf102405bf8a49e9","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-apply-early-return@3.0.0","_nodeVersion":"18.16.0","_npmVersion":"9.6.6","dist":{"shasum":"dc71de22becad7bec2872670899c970594235c5f","size":2095,"noattachment":false,"key":"/@putout/plugin-apply-early-return/-/@putout/plugin-apply-early-return-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-early-return/download/@putout/plugin-apply-early-return-3.0.0.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-early-return_3.0.0_1686224630865_0.432324544504467"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-06-08T11:43:51.054Z","publish_time":1686224631054,"_source_registry_name":"default","_cnpm_publish_time":1686224631054},"2.0.0":{"name":"@putout/plugin-apply-early-return","version":"2.0.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"putout plugin adds ability use apply early return","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-early-return#readme","main":"lib/apply-early-return.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","early-return"],"devDependencies":{"@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^14.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":"f33d102009f204b50b3b71983e68649318e6a44c","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-apply-early-return@2.0.0","_nodeVersion":"16.14.0","_npmVersion":"8.3.0","dist":{"shasum":"b455653ce8fce3bd213fe6f579d069c2c54f4b85","size":2049,"noattachment":false,"key":"/@putout/plugin-apply-early-return/-/@putout/plugin-apply-early-return-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-early-return/download/@putout/plugin-apply-early-return-2.0.0.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-early-return_2.0.0_1647267391486_0.3357728873146595"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-14T14:18:58.835Z","publish_time":1647267391692,"_cnpm_publish_time":1647267391692},"1.0.1":{"name":"@putout/plugin-apply-early-return","version":"1.0.1","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"putout plugin adds ability use apply early return","homepage":"http://github.com/coderaiser/putout","main":"lib/apply-early-return.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","early-return"],"devDependencies":{"@putout/test":"^3.0.0","c8":"^7.5.0","eslint":"^7.0.0","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^8.0.0","lerna":"^4.0.0","madrun":"^8.0.1","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=18"},"license":"MIT","engines":{"node":">=14"},"publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-apply-early-return@1.0.1","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"shasum":"a90f8fa571062102ef72a7c9017f47a4065bdae7","size":1878,"noattachment":false,"key":"/@putout/plugin-apply-early-return/-/@putout/plugin-apply-early-return-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-early-return/download/@putout/plugin-apply-early-return-1.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-early-return_1.0.1_1626980445853_0.4951787682111213"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T18:34:59.972Z","publish_time":1626980445973,"_cnpm_publish_time":1626980445973},"1.0.0":{"name":"@putout/plugin-apply-early-return","version":"1.0.0","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"putout plugin adds ability use apply early return","homepage":"http://github.com/coderaiser/putout","main":"lib/apply-early-return.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","early-return"],"devDependencies":{"@putout/test":"^3.0.0","c8":"^7.5.0","eslint":"^7.0.0","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^8.0.0","lerna":"^4.0.0","madrun":"^8.0.1","nodemon":"^2.0.1"},"peerDependencies":{"putout":">=18"},"license":"MIT","engines":{"node":">14"},"publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-apply-early-return@1.0.0","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"shasum":"60e78388b8c7ec2cbbf3879cb0bce28566f2c9e6","size":1870,"noattachment":false,"key":"/@putout/plugin-apply-early-return/-/@putout/plugin-apply-early-return-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@putout/plugin-apply-early-return/download/@putout/plugin-apply-early-return-1.0.0.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-early-return_1.0.0_1626899572743_0.9883538300441455"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T18:34:58.296Z","publish_time":1626899572868,"_cnpm_publish_time":1626899572868}},"readme":"# @putout/plugin-apply-early-return [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-early-return.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-early-return\"npm\"\n\n> In short, an **early return** provides functionality so the result of a conditional statement can be returned as soon as a result is available, rather than wait until the rest of the function is run.\n>\n> (c) [dev.to](https://dev.to/jenniferlynparsons/early-returns-in-javascript-5hfb)\n\n????[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to apply **early return**.\n\n## Install\n\n```\nnpm i @putout/plugin-apply-early-return\n```\n\n## Rule\n\n```json\n{\n    \"rules\": {\n        \"apply-early-return\": \"on\"\n    }\n}\n```\n\n## ❌ Example of incorrect code\n\n```js\nfunction get(a) {\n    let b = 0;\n    \n    if (a > 0)\n        b = 5;\n    else\n        b = 7;\n    \n    return b;\n}\n```\n\n## ✅ Example of correct code\n\n```js\nfunction get(a) {\n    if (a > 0)\n        return 5;\n    \n    return 7;\n}\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-early-return#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"license":"MIT"}