open-index/open-npm huggingface dataset:
npm package: @pablo-pg/constant-folding
Description: Constant Folding javascript code
Author: alu0101318318
Latest version: 1.4.0

[![npm version](https://badge.fury.io/js/%40pablo-pg%2Fconstant-folding.svg)](https://badge.fury.io/js/%40pablo-pg%2Fconstant-folding)
[![CI for constant-folding](https://github.com/ULL-ESIT-PL-2122/constant-folding-module-pablo-perez-gonzalez-alu0101318318/actions/workflows/nodejs.yml/badge.svg)](https://github.com/ULL-ESIT-PL-2122/constant-folding-module-pablo-perez-gonzalez-alu0101318318/actions/workflows/nodejs.yml)

## constant-folding

## Installation
Write on terminal:  
```
$ npm i @pablo-pg/constant-folding
```

The output will be similar to this:  

![Installing](./images/instalar_paquete.png)  


## Usage as executable:  

After install the package, can be executed with `cf`:  

```bash
$ cf input.js
```  
There is an example of using it inside a script in package.json:  

![Execution npm run](./images/ejecucion_comando.png)  

There is also an help message:  

![Help](./images/help.png)

## Usage from code:

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

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

[The documentation of the function](https://ull-esit-pl-2122.github.io/constant-folding-module-pablo-perez-gonzalez-alu0101318318/).

## Examples

The original code:

```javascript
let x = 2 + 3 - 5;
let len = [1,2,3].length;
let str = [3,2,1].join('-');
```

Will produce the next code:  

```javascript
let x = 0;
let len = 3;
let str = '3-2-1';
```

There is the comprobation:  
![Test 2](./images/ejecucion.png)

## Author

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

## Tests

Test from the production:  

![Tests](./images/test_produccion.png)  

Coverage:  

![Cov](./images/cov.png)