1.10.1 • Published 2 years ago

@alu0101353647/constant-folding v1.10.1

Weekly downloads
-
License
Unlicense
Repository
github
Last release
2 years ago

Review Assignment Due Date Open in Codespaces

constant-folding

This is a small library made to fold the constants and similar expressions that can be folded before runtime. The bulk of the functionalities are bunched up within one function, constantFolding, which receives as parameter the code whose constants to fold.

This code goes the extra length with some of the functionalities, despite the author not having time to make the extras in the rubric.

Published in npm!

Installation

  npm install @alu0101353647/constant-folding

Usage as executable:

Within input.txt we have lines of code whose constants to fold. The code will dump the better code at output.txt.

  cf input.txt output.txt

Usage from code:

const constantFolding = require('constant-folding');
console.log(constantFolding(`a=[2*2].concat(3, [5,6], [[4]]);`));

The documentation of the function.

Examples

See the tests attached in the repository

Author

alu0101353647, the one and only. Also known as Guillermo Zafra.

Tests

Every test already within the rubric has been added. Additionally, tests with other binary expressions have been added, as well as a complex test.

1.9.3

2 years ago

1.10.1

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago