{"name":"@putout/plugin-simplify-logical-expressions","version":"4.0.0","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":"e9ef68c73e32dd18ce31232b6ce231a82db10525","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-simplify-logical-expressions@4.0.0","_nodeVersion":"18.7.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-9VUfXSPO90X4f0JryITIxRtcWlaSwFQK7i/PldMb/ky21+Bo5ND5Ol7mrbHcyVMsK8DBZlk9SF89rFMbbOLb0A==","shasum":"1b2a19ff0cbe82fb94dbc67e4bfce1afbf261df3","tarball":"http://registry-npm.ywwl.com/@putout/plugin-simplify-logical-expressions/download/@putout/plugin-simplify-logical-expressions-4.0.0.tgz","fileCount":4,"unpackedSize":5591,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICM2hJ5HDeOSpXU0fhvwnAusDkcYzrI/Z4Pt5sUPqXrWAiAdTUm2XsFVvlLBpPHT+Qs8Ntyt4kCmgj9uAhugtBrRLQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjBUReACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrT0w//VPmMPtETy2Sr2SWP6y0oi6iBcXeIsNYmP2Q0R5A3nvTq9x7X\r\nX3QFP3Y72xlOrfWUXqt+NBibh7gBknq+wxOnnfpFFZuN/FhrL32C7Ja0Z9e/\r\nJVLGg2dhcChQafStoIL5onWdWMdc8MDn8x2iIGGZ6T1U7+D7nOmf7paVz3Gc\r\nTxisGwSPmljkZrNG6QOZll+W0EF1STgl1me/9VzLD8Jxqa8Rn0VYvagooq8K\r\nud1i1VVZAAiqGuh+5GPlu5H3Fq1d5p71VNulRWU69JtLgf/C6Z7dqk9KR+Yj\r\nJ8q2JBmJVp0+Pz55gaLuPk5KOiywcZplZwFfgJikiVKFftNLkpsL6ZY/cVz5\r\nMMGZrx4kO7i3ME3/8ajK7ezARShW8WykuxAZza42n7aPZtKcgKlxlhysc+pi\r\nrznHx1u7lUup7vqcShgjngj3VJBgP8LkE3KMv9zA/6FM3EaEN8/pqYWlo7RN\r\nYJmw4R/To+4WB1bulaeltMwKrDt4VjzPaaq/6UIzewSrxvaiab3BovK5ppme\r\n1XzC6Hgv7MqNeE4NWipgtMAVNa/tKnv/TxXZgbgkRMWAbuZCCA9B5mNybNBY\r\nSe3LEQvjVbzH/wZKXECGsNVwuxauue4TQHM2qFhCZ2a+VTynB4399JK10a04\r\nUGnj0y/JmhhdhjK2nCeV/ZXFhwSPYEaOp2I=\r\n=6ZvX\r\n-----END PGP SIGNATURE-----\r\n","size":2385,"noattachment":false,"key":"/@putout/plugin-simplify-logical-expressions/-/@putout/plugin-simplify-logical-expressions-4.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-simplify-logical-expressions_4.0.0_1661289566238_0.9160008777362796"},"_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":1661289566443,"_cnpm_publish_time":1661289566443,"dist-tags":{"latest":"4.0.2"}}