@pablo-pg/constant-folding

1.4.0 • Public • Published

npm version CI for constant-folding

constant-folding

Installation

Write on terminal:

$ npm i @pablo-pg/constant-folding

The output will be similar to this:

Installing

Usage as executable:

After install the package, can be executed with cf:

$ cf input.js

There is an example of using it inside a script in package.json:

Execution npm run

There is also an help message:

Help

Usage from code:

Just write the require and then use the function constantFolding(strCode).

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

The 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:
Test 2

Author

Name: Pablo Pérez González
email: alu0101318318@ull.edu.es

Tests

Test from the production:

Tests

Coverage:

Cov

Package Sidebar

Install

npm i @pablo-pg/constant-folding

Weekly Downloads

1

Version

1.4.0

License

Unlicense

Unpacked Size

767 kB

Total Files

17

Last publish

Collaborators

  • pablo-pg