@alu0101207957/constant-folding

1.3.4 • Public • Published

npm version Node.js CI

Constant-Folding

Installation

Using npm

npm install @alu0101207957/constant-folding

Put it in the package.json

"dependencies": {
    "@alu0101207957/constant-folding": "^1.3.3",
    ...
    }

Usage as executable:

node bin/constant-folding-cli.js <input> -o <output>

It does constant folding to the code and return it in other file

Usage from code:

const constantFolding = require('constant-folding');
//call the function

The documentation of the function.

Examples

console.log(constantFolding(`12+7`));
//19

Author

alu0101207957 Andrés Zeus Hernández Impini

Tests

    ✔ Test 12+7 = 19;
    ✔ Test 12-7 = 5;
    ✔ Test 12+7-3-4; = 12;
    ✔ Test 12+7+a; = 19 + a;
    ✔ Test 12+7+"a"; = '19a';
    ✔ Test [1,2,3].length = 3;
    ✔ Test [1,2,3][2-1] = 2;
    ✔ Test [1,2,3].pop() = 3;
    ✔ Test [1,2,3].slice(0,1+1) = [
    1,
    2
];```

Package Sidebar

Install

npm i @alu0101207957/constant-folding

Weekly Downloads

1

Version

1.3.4

License

Unlicense

Unpacked Size

1.04 MB

Total Files

36

Last publish

Collaborators

  • alu0101207957