1.4.0 • Published 4 years ago
@pablo-pg/constant-folding v1.4.0
constant-folding
Installation
Write on terminal:
$ npm i @pablo-pg/constant-foldingThe output will be similar to this:
Usage as executable:
After install the package, can be executed with cf:
$ cf input.jsThere is an example of using it inside a script in package.json:
There is also an help message:

Usage from code:
Just write the require and then use the function constantFolding(strCode).
const constantFolding = require('@pablo-pg/constant-folding');
//call the functionThe documentation of the function.
Examples
The original code:
let x = 2 + 3 - 5;
let len = [1,2,3].length;
let str = [3,2,1].join('-');Will produce the next code:
let x = 0;
let len = 3;
let str = '3-2-1';There is the comprobation:
Author
Name: Pablo Pérez González
email: alu0101318318@ull.edu.es
Tests
Test from the production:
Coverage:
