{"name":"@putout/plugin-simplify-logical-expressions","version":"4.0.1","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin adds ability to simplify logical expressions","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-simplify-logical-expressions#readme","main":"lib/simplify-logical-expressions.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","plugin","logical-expressions","simplify"],"devDependencies":{"@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-n":"^15.2.4","eslint-plugin-putout":"^16.0.0","madrun":"^9.0.0"},"peerDependencies":{"putout":">=27"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"6e9aa5db875b2c76d6f917727ccba609cdf615b5","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-simplify-logical-expressions@4.0.1","_nodeVersion":"16.15.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-3/jUlv29a/Yi1V9C3nekM54B8mFNVdLdkRAsmerNL5mhYezuwKa3RE91n8mFetdW9VmPUrN+p5J6P0+YvK6ZRA==","shasum":"4c398aeffbc600626b84c438ed0eaac07921d2a1","tarball":"http://registry-npm.ywwl.com/@putout/plugin-simplify-logical-expressions/download/@putout/plugin-simplify-logical-expressions-4.0.1.tgz","fileCount":4,"unpackedSize":5705,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCHzAt44KsDyefxBdvzJv8mpjWLToZvcXxK8hk8fLSXNECIQCBIAiLPjXoIrFnM+OX1PrAM6gp3W9GvZNEzwygC/83og=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjBencACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpGGg//VHX+x6PmDk3v+ELqBoHqhNuZYfH7J/YLsOfuctdK5h+3QzQI\r\nFqAu8EUScoywRAej/5hpVQmrd+X0ulUaDfD17UqgPQGNGYLbYgM7XCW8NFqq\r\nq1ztlISYSpok6tObWf8Hb71z3E0gjeeWHoZxPBDqKV+rHHUMLk7pE3sx9RS9\r\noBEO8PY7FnfKcnYnfBitiXYTzXL7epQcrjmngpR1OXde3nVRwBFdTvEtFAus\r\nc9DWIT4iUbK4a52ikjvwHFquv7jcVvESHxr4RM6fJH0Mk3czYAfZwG/hI03k\r\n+WWnhUyPv+ZLaFXLCK8uJiat4Cd5CaLxHzdPoOxBdZVhV9xuLPSQH9TgOYXT\r\nEl2yKO84ueYBVo0ZakRz3Fc0JoZv/L4k3j5LXCB9T8MLcUJ/iJuk5LO4WIEe\r\nlgqpAx0iF4hyRKlYJHru6fft13G9K8hhg6NTMhlDUpthZoPaz4NNfvKWj7Dt\r\noUgcvdInJSkcEURIXN8k0UJM7vssqbBxMVgsovQL+6CzFWg9d71Z+pPXJKOn\r\nginnlKKcyg7cbuooNqVXkBXpb3/pfb+Lz5/8gY9t4xhn6D3l0ZW0gjV0yE0X\r\n6YzVKgnUWuhWJCMk5mRfcOfaXhcaP58w7nXTaCLABseTl0j4M6EWuOah2bdq\r\nKUF3QdtjoOEHWvlMJRKWHg/QtIMGiT9aDtw=\r\n=vtyO\r\n-----END PGP SIGNATURE-----\r\n","size":2417,"noattachment":false,"key":"/@putout/plugin-simplify-logical-expressions/-/@putout/plugin-simplify-logical-expressions-4.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-simplify-logical-expressions_4.0.1_1661331932448_0.5233549518973057"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-simplify-logical-expressions [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-simplify-logical-expressions.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-simplify-logical-expressions \"npm\"\n\n> The logical NOT (`!`) operator takes truth to falsity and vice versa.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_NOT)\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to simplify **logical expressions** containing\ncomparisons which will always evaluate to `true` or `false` since it's  likely indications of programmer error.\nComplements [`@putout/plugin-apply-comparison-order`](https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-comparison-order#readme).\nMerged to [@putout/plugin-logical-expressions](https://www.npmjs.com/package/@putout/plugin-logical-expressions).\n\n## Install\n\n```\nnpm i @putout/plugin-simplify-logical-expressions -D\n```\n\n## Rule\n\n```json\n{\n    \"rules\": {\n        \"simplify-logical-expressions\": \"on\"\n    }\n}\n```\n\n## ❌ Example of incorrect code\n\n```js\nconst is = !(options && !options.bidirectional);\n\nif (!left.type === 'UnaryExpression');\n\nconst oneOf = a || a;\nconst same = a === a;\n```\n\n## ✅ Example of correct code\n\n```js\nconst is = !options || options.bidirectional;\n\nif (left.type !== 'UnaryExpression');\n\nconst oneOf = a;\nconst same = true;\n```\n\nThe rule also simplify duplication use:\n\n```diff\n-if (a && b || a && c) {\n+if (a && (b || c)) {\n}\n```\n\nWrong cases with `instanceof`:\n\n```diff\n-!a instanceof b;\n-a instanceof !b;\n-!a instanceof !b;\n+!(a instanceof b);\n```\n\nWrong cases with `in`:\n\n```diff\n-!a in b;\n-a in !b;\n+!(a in b);\n```\n\nIn case of duplicates:\n\n```diff\n-a && b && a\n+a && b\n```\n\n## Comparison\n\nLinter | Rule | Fix\n--------|-------|------------|\n🐊 **Putout**| [`simplify-logical-expressions`](https://github.com/coderaiser/putout/tree/master/packages/plugin-simplify-logical-expressions#readme)| ✅\n⏣ **ESLint** | [`no-constant-binary-expression`](https://eslint.org/docs/rules/no-constant-binary-expression) | ❌\n\n## License\n\nMIT\n","publish_time":1661331932654,"_cnpm_publish_time":1661331932654,"dist-tags":{"latest":"4.0.2"}}