Improved rename of deadCodeInjection dead code identifiers. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/708

This commit is contained in:
sanex
2020-08-18 13:57:53 +03:00
parent dce365079c
commit 0f2f0c2c34
22 changed files with 378 additions and 112 deletions
+27 -6
View File
@@ -7,17 +7,38 @@ import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNo
let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
`
const foo = {
bar: {
baz: 1
function foo () {
function bar () {
const a = [];
const b = [];
while (true) {
for (const a of b) {}
}
return a;
}
};
console.log(foo.bar.baz);
function baz () {
const a = 1;
}
function bark () {
const a = 1;
if (true) {
console.log(a);
}
}
function hawk () {
const a = 1;
}
}
`,
{
...NO_ADDITIONAL_NODES_PRESET,
compact: false
compact: false,
deadCodeInjection: true,
deadCodeInjectionThreshold: 1
}
).getObfuscatedCode();