luhn-generator
Version:
A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm
91 lines (70 loc) • 1.13 kB
Markdown
Tries to evaluate expressions and inline the result.
**In**
```javascript
"a" + "b"
2 * 3;
4 | 3;
"b" + a + "c" + "d" + g + z + "f" + "h" + "i"
[].concat([d, e], f, g, [h]);
["a", "b", "c"].join();
["a", "b", "c"].join('@');
[].length;
[][1];
[].shift();
[].slice(0, 2);
[].pop();
[].reverse();
"a,b,c".split(",");
"abc"[0];
"abc".charAt();
"abc".charAt(1);
"abc".length;
```
**Out**
```javascript
"ab";
6;
7;
"b" + a + "cd" + g + z + "fhi";
[];
"a,b,c";
"a@b@c";
3;
2;
2;
[];
c;
[];
["a", "b", "c"];
"a";
"a";
"a";
"b";
3;
```
```sh
npm install babel-plugin-minify-constant-folding --save-dev
```
**.babelrc**
```json
{
"plugins": ["minify-constant-folding"]
}
```
```sh
babel --plugins minify-constant-folding script.js
```
```javascript
require("@babel/core").transform("code", {
plugins: ["minify-constant-folding"]
});
```
+ `tdz` - Account for TDZ (Temporal Dead Zone)