{"_id":"@dylanarmstrong/babel-plugin-transform-chain-comparisons","_rev":"1-74320fc8b49dee110557ca7a3fec7304","name":"@dylanarmstrong/babel-plugin-transform-chain-comparisons","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"version":"0.0.1","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"name":"@dylanarmstrong/babel-plugin-transform-chain-comparisons","description":"Transform chained comparisons into && statements","license":"ISC","author":{"name":"Dylan Armstrong","email":"dylan@dylan.is"},"main":"./lib/index.js","scripts":{"test":"jest"},"repository":{"type":"git","url":"git+https://github.com/dylanarmstrong/babel-plugin-transform-chain-comparisons.git"},"keywords":["babel-plugin","chain","comparison","comparator","python"],"bugs":{"url":"https://github.com/dylanarmstrong/babel-plugin-transform-chain-comparisons/issues"},"homepage":"https://github.com/dylanarmstrong/babel-plugin-transform-chain-comparisons","dependencies":{"@babel/core":"^7.16.5","@babel/helper-plugin-utils":"^7.16.5"},"devDependencies":{"@babel/helper-plugin-test-runner":"^7.16.5","jest":"^27.4.5"},"exports":{".":"./lib/index.js","./package.json":"./package.json"},"gitHead":"3718dce9b4c21c2bd93423a0282a34ffdb259886","_id":"@dylanarmstrong/babel-plugin-transform-chain-comparisons@0.0.1","_nodeVersion":"16.13.1","_npmVersion":"8.3.0","dist":{"integrity":"sha512-o3W5N0WGtoOts2g52mbRnCKvqScFz2THoD2T+ErmwuXQO/3S1hxkwx4KUwp2+cW4tLJv9QPurWOzkZqVX6lnHQ==","shasum":"dac4ac7c77740f8f754beffe712bedc90f8cd891","tarball":"https://registry.npmjs.org/@dylanarmstrong/babel-plugin-transform-chain-comparisons/-/babel-plugin-transform-chain-comparisons-0.0.1.tgz","fileCount":4,"unpackedSize":4977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzJe2CRA9TVsSAnZWagAAWmYP/iedRpfcyLyvOHvmFjvv\n+RWCWIByOcWSHII0t647LvqVoEz+Yjo36PQeoTImu8/hlT/vhBC3tAoB/GTZ\nRGw1tY1lq7yoUlfc1zQv4GmwDHZwBto/dGIaRwOC4/IdFMHtqUY1A0+AE4ZM\ngagR168kcJeSZzM7nJOZDfuWzRIpHJhpWuIZd6QaLZdC9yHv5N921gpN1bQM\nh1/JaSIHOrhpiD4neeUCEOktdzVXhb8XpyH1+B6xy096j0rD8HyZVMXD6LkW\nyS380u5VDDyIeAB/8ZgjzHs18hK3RM/GKNTRoqkKnaO1lpMAexeg9lqpsTTK\ngpzwqbZ29gyNcs6HRQgU7mpSspWfmGoGnTLH+xsgvx7Tx/Lx4JEAyJmdRavM\nfyse9ZAiPgLiD61bOvx2Ay6eR2QFWRPAmS4wbh8vBEW9u1PUJ4A4xNlNBANN\nmrg8I5gOSRviXvkSkKq7rwDZ1ABaQRbyQ0dXw1oGXeQ91bv7sM2yHOM5C7lf\n54if/2jR6JXwjBhu2B9I6yp7mIUQLo7TNLXLodShdE+lzXrpy1JgXHx9x5rK\n3iAtgTAnjEbLTwyB4TdJvXmI38iWSkuNZ4Vo/v2y5hGztGmLW9uLTpD7tHZT\nWxwrBUalSDd/Zr5yiy7uRgoWMW6m4JviOD5VtTeNY2xPHVXlAnT+Kobg2rEO\nEREl\r\n=zELA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGuX2jnxHDnjJJ2c01fvcdpSNwt2TjazssgNa+P6wBHwIhAM0FV2b6E6FHygTgw1T12xfhQVSiSP/lmys0QB0HtmxW"}]},"_npmUser":{"name":"dylanarmstrong","email":"dylan@dylan.is"},"directories":{},"maintainers":[{"name":"dylanarmstrong","email":"dylan@dylan.is"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-chain-comparisons_0.0.1_1640798134038_0.9517213829185438"},"_hasShrinkwrap":false}},"time":{"created":"2021-12-29T17:15:33.979Z","0.0.1":"2021-12-29T17:15:34.186Z","modified":"2022-04-05T06:17:21.222Z"},"maintainers":[{"name":"dylanarmstrong","email":"dylan@dylan.is"}],"description":"Transform chained comparisons into && statements","homepage":"https://github.com/dylanarmstrong/babel-plugin-transform-chain-comparisons","keywords":["babel-plugin","chain","comparison","comparator","python"],"repository":{"type":"git","url":"git+https://github.com/dylanarmstrong/babel-plugin-transform-chain-comparisons.git"},"author":{"name":"Dylan Armstrong","email":"dylan@dylan.is"},"bugs":{"url":"https://github.com/dylanarmstrong/babel-plugin-transform-chain-comparisons/issues"},"license":"ISC","readme":"# babel-plugin-transform-chain-operators\n\nAdd chained comparison operators like\n[Python](https://docs.python.org/c/reference/expressions.html#comparisons)\n\n## Setup\n\nIn your `babel.config.json`, place the following:\n\n```\n  \"plugins\": [\n    \"@dylanarmstrong/babel-plugin-transform-chain-comparisons\"\n  ]\n```\n\n## Examples:\n```\n// Original\nif (a < b < c) {}\n// Transform\nif (a < b && b < c) {}\n\n// Original\nif (a != b != c) {}\n// Transform\nif (a != b && b != c) {}\n\n// Original\nif (a < f() < g()) {}\n// Transform\nconst ref1 = f();\nif (a < ref1 && ref1 < g()) {}\n\n// Original\nif (f() < g() < h()) {}\n// Transform\nconst ref1 = g();\nif (f() < ref1 && ref1 < h()) {}\n```\n\n## Caveats:\n1. `a != b != c` does not imply `a != c`\n2. await operators are finicky, `a < await f() < b` will call `await f()` twice\n   at the moment. This is intended to be fixed.\n3. Functions cannot change a value that is relied on in a subsequent statement\n  `f(10) < g() < c` with `c = 2`, `b = 1; g = () => b;`, and\n  `f = (n) => { b = n; return 0; }`.\n   This is because the expression `g()` is cached before any BinaryExpression\n   is called. This is done intentionally to avoid double calling the `g()`\n   method.\n","readmeFilename":"README.md"}