{"_id":"@alu0101056944/constant-folding","_rev":"1-0fa2c79d191852a3810eec28f2e1aefe","name":"@alu0101056944/constant-folding","dist-tags":{"latest":"1.2.2"},"versions":{"1.2.2":{"name":"@alu0101056944/constant-folding","author":{"name":"alu0101056944","email":"alu0101056944@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":"jsdoc2md src/constant-folding.js && documentation build src/ -f html -o docs"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX.git"},"keywords":["ULL","constant-folding","javascript"],"license":"Unlicense","dependencies":{"ast-types":"*","commander":"^7.1.0","escodegen":"^1.14.3","espree":"*"},"version":"1.2.2","main":"./src/constant-folding.js","bin":{"cf":"bin/constant-folding-cli.js"},"devDependencies":{"chai":"latest","jison":"latest","jsdoc-to-markdown":"^7.1.1","mocha":"latest","nyc":"latest"},"gitHead":"24dd482512fc543eea00b1e9ecdeb768a7eb3e15","bugs":{"url":"https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX/issues"},"homepage":"https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX#readme","_id":"@alu0101056944/constant-folding@1.2.2","_nodeVersion":"17.5.0","_npmVersion":"8.4.1","dist":{"integrity":"sha512-kpLmK8Qi92ItJ4fWWmfCO2oYVbsXpdERR3QiOf8JAfg8Ef9Xe6cA0WbK4vefs6vTzrthZ62rRkQDCVqn6y2yIw==","shasum":"c8074597a2a1a2420757fec76b0d59d63e533e21","tarball":"https://registry.npmjs.org/@alu0101056944/constant-folding/-/constant-folding-1.2.2.tgz","fileCount":33,"unpackedSize":1583351,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiKZK8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXrQ/+NjvQj4XpsFU9RZwDhTyOFafyNw4KxkqPrQk8J2V2sbgclDL2\r\nd/aEqczJhCvVy9+8rwzQoP/VLW1bmRfmSpPvynoM6iwWsKpqq9bcVPXdVQcp\r\noJFARf6Rc/esptJiAYGq6y9RABjR9bhkistZwa+LZ9m8JWols82nfqLEBZtZ\r\nxqNe6CqfL9tGMqYGCBXFi99J2CFz5zabuslDKZK/uT8U/KP8CKtAJlGM8JnB\r\nTOU9xuhYFSPP+eUTFItozw/v8myQfy19MCxInHlVPRFxPhd7oMjOnZ2DZN35\r\n8voSTH+NEGzbD4x1z6mLpURjIZt/EwgVH/nQ8BRfik67XHrbdaV4Mq+oizXb\r\nA0dFduk584YsSk/HILTKckszqvUQItlh4omyOI88b3Njnb1I07MyKt2XX+kS\r\n4jXjmRkKKFOGOPiLOgLfzkvQd1GGfMA2+p6st1Ry4mWi1DQGWZCGB48hx9XI\r\nXnPok1K507DjBoEBOyYzTHvA6mDpwynzcJpXKUKgsU3Dwk6QJUlfF/ZNtqDX\r\n/IJme/bEy+FV0ntMX9X4Yvcpk99gLWLknft/239tKiqKC7MGBnSbtMDnPKoJ\r\nme1Ign48cB7eitpD9gjT9EJKmAVg6ngF2BqWC9fVgq2RFPNAgtdHFZUwBpLj\r\nhixapzl2lTqysZ2SUEWXl4Dy23E7OED1DrU=\r\n=zwKM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFL7lhvHJ8x26Baf+TRJcc4BfQN78Hu3Z1gbHAongpAzAiB01NbuK+uA6VXmnq2jq5lr8U1bnzO9RYxPuG6P1ikoGQ=="}]},"_npmUser":{"name":"alu0101056944","email":"alu0101056944@ull.edu.es"},"directories":{},"maintainers":[{"name":"alu0101056944","email":"alu0101056944@ull.edu.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/constant-folding_1.2.2_1646891708049_0.49299575976310095"},"_hasShrinkwrap":false}},"time":{"created":"2022-03-10T05:55:07.961Z","1.2.2":"2022-03-10T05:55:08.303Z","modified":"2022-04-04T13:41:01.449Z"},"maintainers":[{"name":"alu0101056944","email":"alu0101056944@ull.edu.es"}],"description":"Constant Folding javascript code","homepage":"https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX#readme","keywords":["ULL","constant-folding","javascript"],"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX.git"},"author":{"name":"alu0101056944","email":"alu0101056944@ull.edu.es"},"bugs":{"url":"https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX/issues"},"license":"Unlicense","readme":"[![npm version](https://badge.fury.io/js/%40aluXXX%2Fconstant-folding.svg)](https://badge.fury.io/js/%40aluXXX%2Fconstant-folding)\n[![CI for constant-folding](https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX/actions/workflows/nodejs.yml/badge.svg)](https://github.com/ULL-ESIT-PL-2021/constant-folding-module-aluXXX/actions/workflows/nodejs.yml)\n\n## constant-folding\n\nTranspile a javascript source code file into a constant folded one. Will transpile the following expressions:\n\n - <code>[\"a\", \"b\", \"c\"].join();</code> array of only literals (number or string) into <code>\"a,b,c\";</code>\n - <code>[a, b, c].pop();</code> array of identifiers into <code>c;</code>\n - <code>[1, 2, 3].slice(0, 1+1);</code> any array into <code>[1, 2];</code>\n\n## Installation\n\nTo install execute the following command:\n\n```bash\nnpm i\n```\n\n## Usage as executable:\n\nExecute the program with the following command.\n\n```bash\nnpx cf <input.js> -o <output>\n```\n\nwhere:\n  - *input.js* is the path to the original javascript source code to transpile into another source code\n  - *output* is the path of the file where save the transpiled source code; the constant folded one.\n\n## Usage from code:\n\n```javascript\nconst constantFolding = require('constant-folding');\n//call the function\n```\n\n[The documentation of the function](https://ull-esit-pl-2021.github.io/constant-folding-module-aluXXX/).\n\n## Examples\n\n*src/examples/input_1.js*\n```js\n[a, b, c].slice(0, 2);\n```\n\nExecute:\n\n```bash\nnpx cf src/input_1.js -o src/output_1.js\n```\nTranspiled code:\n\n*src/examples/output_1.js*\n```js\n[\n    a,\n    b\n];\n```\n\n## Author\n\nalu0101056944\n\nmarcos.barrios.15@ull.edu.es\n\nMarcos Jesús Barrios Lorenzo\n\n## Tests\n\nTo run the tests execute the following command:\n\n```bash\nnpm test\n```\n\n## API\n\n## constantFolding(code) ⇒ <code>string</code>\n**Kind**: global function  \n**Returns**: <code>string</code> - ouput javascript source code after constant folding.  \n**Brief**: Transform code into an AST, apply constant folding and transform it\n back into the resultng code.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| code | <code>string</code> | input javascript source code. |\n\n","readmeFilename":"README.md"}