{"name":"@putout/plugin-simplify-logical-expressions","version":"1.1.0","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"putout plugin adds ability to simplify logical expressions","homepage":"http://github.com/coderaiser/putout","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":"^3.0.0","c8":"^7.5.0","eslint":"^7.0.0","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^8.0.0","madrun":"^8.0.1"},"peerDependencies":{"putout":">=7.2"},"license":"MIT","engines":{"node":">=8.3.0"},"publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-simplify-logical-expressions@1.1.0","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"integrity":"sha512-sJbr0w9aiNL4/XuNGXXeQdnDOsXGRUPLzKo271WGvY1RLuKqDD2G0Gq/zPkwgMvFHIhoHDsWNknTsZW9DnlvPg==","shasum":"fa238a516d04ef50865fd3efcf0b8fbb8a9cf7c8","tarball":"http://registry-npm.ywwl.com/@putout/plugin-simplify-logical-expressions/download/@putout/plugin-simplify-logical-expressions-1.1.0.tgz","fileCount":4,"unpackedSize":3730,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg8HnVCRA9TVsSAnZWagAAYx4P/i+Pv+5TA97z/4CziclR\ny2hbromv4vr4etiJU+JZRBkPsEOR/zdssIxVCSksfQdsyCpM7owCD8t849BU\nd86XwPlj60+u+AcMVLVuQqEmDS7S3xFmZHjQLEOMfLCZIuW1JoMIOw0Scs/A\nPMRZdip/EjQ76YwbK5L0Z1xMNHJLP+7ErHhr9NFwRnJ6UzmXHA7xTbA6er64\n1+qytMxlE0cBvErILKi5gS6K3+KxHZfVt+Le+9i+tlVPidiXNfaCb1BtcIg3\nNJpwTRs58DNvJ/2UzZqjxZ9285B/0+FbUSsXlYVAHAiGEX/g/AM0B2K2SCxQ\nAEe+n43EYfQ7gS+3mLbuxC+K5r0NUIlkk6A0FeIVA/UxKsIi1SasU1y5iNlg\npZY3F0BFJ+a3v+HWmYkYCxgGnYAqeZW/VX4jbwdpZSwUpKZB0XraKCVJUwGJ\nje3flnZZp2tBZ23Ei6OehVClQS+zAuZIkTLZVaK1/8c9DITNksqSiy18efZu\nCbHtjsI2VP7fhxIi+j+Nn+uSWp2vZ2LvO2r6nTdgQs1nufPNd5z/OsXidmv8\nBqWAeI2jA2/VAveF6abGVSBQVPfXeQQYl0Nagm45mnDrGRhP+7/DVwXMbUVR\n5F7cU5O4+RDAOUbyobnh01FcnMVPhv3DBji9XRyE+gvvgCArF33DEm4zei2c\nfDCA\r\n=cE0n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQUllvpQkiS1XCI9CyW7Wz2MZaXfKzf6UGKXKSLir5uQIhAJExtk7AWRLzHPO03BxYj+Lfm8PWmMmRlYKVLLWxtob4"}],"size":1787,"noattachment":false,"key":"/@putout/plugin-simplify-logical-expressions/-/@putout/plugin-simplify-logical-expressions-1.1.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-simplify-logical-expressions_1.1.0_1626372564866_0.72024409882365"},"_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":1626372565041,"_cnpm_publish_time":1626372565041,"dist-tags":{"latest":"4.0.2"}}