{"_id":"@alu0100987522/constant-folding","_rev":"8-ebc5a5d71dc987c17df50075301cedf5","time":{"created":"2022-03-09T23:36:23.655Z","1.1.0":"2022-03-09T21:25:05.802Z","modified":"2022-04-04T13:40:57.260Z","1.1.1":"2022-03-09T22:06:12.614Z","1.1.2":"2022-03-09T23:36:23.932Z","1.2.2":"2022-03-10T09:08:52.981Z","1.2.3":"2022-03-10T09:26:41.618Z"},"name":"@alu0100987522/constant-folding","dist-tags":{"latest":"1.2.3"},"versions":{"1.1.2":{"name":"@alu0100987522/constant-folding","author":{"name":"Aitor Hernández Sánchez alu0100987522","email":"alu0100987522@ull.edu.es"},"description":"Constant Folding javascript code","scripts":{"test":"mocha","prod-test":"cd ../constant-folding-production-test-aluXXX && npm test","cov":"nyc npm run test","full-cov":"npm run clean && npm i && npm run cov","clean":"rm -rf node_modules package-lock.json","doc":"documentation build bin/constant-folding-cli.js src/constant-folding.js -f html -o docs"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522.git"},"keywords":["ULL","constant-folding","javascript"],"license":"Unlicense","dependencies":{"commander":"^7.1.0","escodegen":"^1.14.3","espree":"^9.3.1","estraverse":"^5.3.0"},"version":"1.1.2","main":"src/constant-folding.js","bin":{"cf":"bin/constant-folding-cli.js"},"devDependencies":{"documentation":"latest","mocha":"latest","chai":"latest","nyc":"latest"},"gitHead":"204bbef3bfcc1dbb3e27526289e29d5ed4796a2d","bugs":{"url":"https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522/issues"},"homepage":"https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522#readme","_id":"@alu0100987522/constant-folding@1.1.2","_nodeVersion":"17.5.0","_npmVersion":"8.4.1","dist":{"integrity":"sha512-tk9iYsnGTkhFSpJnOvhd57vJf2heUYjDGxcf3laYK96VDwMs7vsOcMJc1eXQ0i+21qp6OeKpHlNhtZltDasEwA==","shasum":"35895397bfdf388d4073d203c73d08bcf7301f1c","tarball":"https://registry.npmjs.org/@alu0100987522/constant-folding/-/constant-folding-1.1.2.tgz","fileCount":34,"unpackedSize":1576382,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiKTn3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr8fxAAkp/U6XRCcCb1QMWdxVUx9ieELIl1n9soZjr4eGctUxwGI8fg\r\nftrPeSdiBX6MR2ZEVEnhgkNsHF6BUepO+BVyc/GmLCAvVI4giVveYgqXqH2U\r\nnvFmH0L5JZql8rR3T5MXE68cCYYm+r8SuJeusmQJDAng4pRHnzFRLLLeNKXE\r\nV+cwxzql/sfElUKR8PSm0MtTHhMLFXBk0ShzOVzPH22EZZgtIxCfMAjZqhxn\r\neBe6qnAM/pbFJoTuRTH04+gSRJhZfCMSfvWKVADB1/n4MIOQvyi+fTKWhxrA\r\npfHg5zGQBR9VbSfDjwscLkgCu4IGiXWN/t09oXT52B02jZ60R/9TIplEWW+M\r\nh0UBf9B+B+aYQZahbprmrTXqF3mpAoj1m3GVioov06Os8hRr9eXiBoJx85u2\r\nPFvde3BnLLhVIc94+TXARtcHW1kUhafsvrFlZZX3Fw1y5RKlKv6LwYIvzI28\r\njnT04zynGf9cRW4fHmLCU6rAqc15dAjjpoKTqghivIdnvhy4ec/+OcQhiO64\r\nCEzDCgzJrJKfwURzswZBfACVJ/eGiEBwKjd/d97YeFg7OG2kSB68Gg8tD6uD\r\nDPBvChAKejKCKH4+eFOzPJvUHkrKieW+GnAu2AvFya0frLFHy2DA2YkR05LS\r\nlhxyvHTdq6juJzhWksDF4Yi05VIbiczcC5k=\r\n=1Wu7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFaT3qgG07RyhxEAJB31qE4vilE4KniPzULf4+AtCUxiAiAfJLUIHVQOrPOYj/rT+fHPXb98jXgm1HCyI2ykJeQjqQ=="}]},"_npmUser":{"name":"alu0100987522","email":"alu0100987522@ull.edu.es"},"directories":{},"maintainers":[{"name":"alu0100987522","email":"alu0100987522@ull.edu.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/constant-folding_1.1.2_1646868983701_0.9518595355732085"},"_hasShrinkwrap":false},"1.2.3":{"name":"@alu0100987522/constant-folding","author":{"name":"Aitor Hernández Sánchez alu0100987522","email":"alu0100987522@ull.edu.es"},"description":"Constant Folding javascript code","scripts":{"test":"mocha","prod-test":"cd ../production-test-repo && npm run test","cov":"nyc npm run test","full-cov":"npm run clean && npm i && npm run cov","clean":"rm -rf node_modules package-lock.json","doc":"documentation build bin/constant-folding-cli.js src/constant-folding.js -f html -o docs"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522.git"},"keywords":["ULL","constant-folding","javascript"],"license":"Unlicense","dependencies":{"commander":"^7.1.0","escodegen":"^1.14.3","espree":"^9.3.1","estraverse":"^5.3.0"},"version":"1.2.3","main":"src/constant-folding.js","bin":{"cf":"bin/constant-folding-cli.js"},"devDependencies":{"documentation":"latest","mocha":"latest","chai":"latest","nyc":"latest"},"gitHead":"36f8b2d16ab85065a989192d63ac666aad50bb99","bugs":{"url":"https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522/issues"},"homepage":"https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522#readme","_id":"@alu0100987522/constant-folding@1.2.3","_nodeVersion":"17.5.0","_npmVersion":"8.4.1","dist":{"integrity":"sha512-LEN4ox76JExQnAuKH9NOOaIrdiAoPu39os12JOJ6Uhy8c+AGcnAvu4ad77XdrkF5dR+EiQAWjESNExILQiDNkA==","shasum":"5fbe6634c3a03eae3f34810ff527e8c0886e8491","tarball":"https://registry.npmjs.org/@alu0100987522/constant-folding/-/constant-folding-1.2.3.tgz","fileCount":35,"unpackedSize":1578536,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiKcRRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVGBAAlaUdnQkXIhUBfKZslL6CRGTWiuuL++lC57Sk6bxx0Jm9jDwn\r\nWfNdsO7CIU0L7msNe0hzF2+B7W2QcFhm4DysRT+VbAf0UB7qa+78PkGUGY5X\r\nlldmwaSqyssq5KNkz+PAxiFPBFBgaKYj6hP4KsJQ27MHcop7E+MUpO1LTIy1\r\n/5tNgzsQny50fYVeNjahgvRht/0/8K5RnTLi83hh7xrF/nWV3wepqskBZuvD\r\npIPflTbpQfiMDj0Ei2jyAowQ5aDy45LCfYAXA6otoDAMBGbbfNag5W2+RGUi\r\ni51pUtKERYv72VJwMlh9LWj4/Q52w5JDtPQa7kCP5aZD5zisV59oqgGKWtfc\r\nj5lutKFDYbwGz6oYVnSKpy+nQuWr5fYq+8ESTxiXdxgkVHyTJesXwFmVnl5Q\r\n9upoAcM5enijOJGGJGxJhrO2BLRSY+feAnh1NH/BGZL2l+stDSc1k+1dbLtO\r\noRBEmb+iywq4oB0lejVjrVT/ohWD7LW4bLAilqeqfpN6J/XVUosRx0kGyed5\r\ne5V3swuH7q4PuXqI63pzenTux+SPvN66vItNq1+DhWjsyFfhMoUKky4JwRqn\r\nC9hXOVgutgi6EmJg2PrBiqnOQKVm9kJ6nFwadxUR+jdqlaC0IXsX51dfT4P6\r\nlqZ+VbECDauVk5+Q96cTj6QjYohSl0z372M=\r\n=rbCo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpsOs7+Xzk1KGYH91euTw4E3BXbKdsZIwPjmecZF2zjAIhAMLJ9gKwNjEkVu+e/SFiLS/kx6dOm1/EEV11pPlc3jg1"}]},"_npmUser":{"name":"alu0100987522","email":"alu0100987522@ull.edu.es"},"directories":{},"maintainers":[{"name":"alu0100987522","email":"alu0100987522@ull.edu.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/constant-folding_1.2.3_1646904401369_0.3455553502717956"},"_hasShrinkwrap":false}},"maintainers":[{"name":"alu0100987522","email":"alu0100987522@ull.edu.es"}],"description":"Constant Folding javascript code","homepage":"https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522#readme","keywords":["ULL","constant-folding","javascript"],"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522.git"},"author":{"name":"Aitor Hernández Sánchez alu0100987522","email":"alu0100987522@ull.edu.es"},"bugs":{"url":"https://github.com/ULL-ESIT-PL-2122/constant-folding-module-aitor-hernandez-sanchez-alu0100987522/issues"},"license":"Unlicense","readme":"[![npm version](https://badge.fury.io/js/%40alu0100987522%2Fconstant-folding.svg)](https://badge.fury.io/js/%40alu0100987522%2Fconstant-folding)\n\n\n# constant-folding\n\nCI for constant folding transformations.\n\n## Installation\n\n**Install globally**\n\n```console\n$ npm i -g @alu0100987522/constant-folding\n```\n\n**Install as a dependency project**\n\n```console\n$ npm i -D @alu0100987522/constant-folding\n```\n\n## Usage\n\n- ### Usage from CI:\n\n**General use**\n```console\n$ npx cf inputFile.js -o outputFile.js\n```\n\n**--help**\n```console\n$ npx cf --help\n\nUsage: cf [options] <filename>\n\nConstant Folding javascript code\n\nArguments:\n  filename                 file with the original code\n\nOptions:\n  -V, --version            output the version number\n  -o, --output <filename>  specify a file to save the output (default: \"output.js\")\n  -h, --help               display help for command\n```\n\n- ### Usage from code:\n\n```javascript\nconst constantFolding = require('@alu0100987522/constant-folding');\n```\n\nYou can finde more information about the functions that implement the constant folding [here](https://ull-esit-pl-2021.github.io/espree-logging-module-alu0100987522/).\n\n## Examples\n\n- **code example:** \n```javascript\nconst constantFolding = require('@alu0100987522/constant-folding');\n\nconsole.log(constantFolding(`[\"a\", \"b\", \"c\"][1*1];`));  // Output: 'b';\n```\n\n- **CI example:**\n\nFor this *input.js*:\n\n![image](https://user-images.githubusercontent.com/43880997/157553906-226cfaee-a7b7-43b6-b738-aa3a32915120.png)\n\nWe use:\n```console\nnpx cf input.js -o output.js\n```\n\n![image](https://user-images.githubusercontent.com/43880997/157554218-637f2851-f087-4a35-900b-506bfe363688.png)\n\n\nAnd we get the output in the *output.js*:\n\n![image](https://user-images.githubusercontent.com/43880997/157553971-2fe69706-3289-4401-b2d7-07b08dd95d4f.png)\n\n\n## About the author and the package\n\nThis package was built and published by Aitor Hernández, alu0100987522@ull.edu.es, as a part of a lab from Procesadores de Lenguajes subject, in Universidad de La Laguna.\n\n\n## Tests\nTested in node **16x.** version for *Ubuntu*, *MacOs* and *Windows*.\n\n![image](https://user-images.githubusercontent.com/43880997/157554511-f2b683cc-131f-4017-9607-5ce88677c4d9.png)\n\n\nTested with the javascript code that follows:\n\n```javasript\n  --- constantFolding tests ---\n\n    Works correctly for literals\n      ✔ var f = 3+null; ==> var f = 3;\n      ✔ var e = 4 | 3; ==> var e = 7;\n      ✔ var d = 3+\"c\"; ==> var d = '3c';\n      ✔ var b = 9 +1; ==> var b = 10;\n      ✔ var a = 2+3*5+b; ==> var a = 17 + b;\n    Works correctly for operator []\n      ✔ [1, 2, 3][0]; ==> 1;\n      ✔ [1, 2, 3][2-1]; ==> 2;\n      ✔ [\"a\", \"b\", \"c\"][2]; ==> 'c';\n      ✔ [\"a\", \"b\", \"c\"][1*1]; ==> 'b';\n      ✔ [\"a\", 1, 2][1+1]; ==> 2;\n    Works correctly for pop()\n      ✔ [1, 2, 3].pop(); ==> 3;\n      ✔ [\"a\",\"b\",\"c\"].pop(); ==> 'c';\n```\n","readmeFilename":"README.md"}