[![npm version](https://badge.fury.io/js/%40alu0101207957%2Fconstant-folding.svg)](https://badge.fury.io/js/%40aluXXX%2Fconstant-folding)
[![Node.js CI](https://github.com/ULL-ESIT-PL-2122/constant-folding-module-andres_z-hernandez-impini-alu0101207957/actions/workflows/node.js.yml/badge.svg)](https://github.com/ULL-ESIT-PL-2122/constant-folding-module-andres_z-hernandez-impini-alu0101207957/actions/workflows/node.js.yml)

## Constant-Folding

## Installation
### Using npm
```npm install @alu0101207957/constant-folding```
### Put it in the package.json
```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:

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

[The documentation of the function](https://ull-esit-pl-2122.github.io/constant-folding-module-andres_z-hernandez-impini-alu0101207957/).

## Examples
```js
console.log(constantFolding(`12+7`));
//19
```
## Author

alu0101207957 Andrés Zeus Hernández Impini

## Tests

```  constantFolding 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
];```

