Added tests for ConditionalCommentObfuscatingGuard #2

This commit is contained in:
sanex3339
2017-09-12 00:38:38 +03:00
parent 162ad0e9a6
commit 854c455f8d
6 changed files with 157 additions and 4 deletions
+23
View File
@@ -198,6 +198,29 @@ javascript-obfuscator samples/sample.js --output output/output.js --compact true
See [CLI options](#cli-options).
## Conditional comments
You can disable and enable obfuscation for specific parts of the code by adding following comments:
* disable: `// javascript-obfuscator:disable` or `/* javascript-obfuscator:disable */`;
* enable: `// javascript-obfuscator:enable` or `/* javascript-obfuscator:enable */`.
Example:
```javascript
// input
var foo = 1;
// javascript-obfuscator:disable
var bar = 2;
// output
var _0xabc123 = 0x1;
var bar = 2;
```
Conditional comments affect only direct transformations of AST-tree nodes. All child transformations still will be applied to the AST-tree nodes.
For example:
* Obfuscation of the variable's name at its declaration is called direct transformation;
* Obfuscation of the variable's name beyond its declaration is called child transformation.
## JavaScript Obfuscator Options
Following options are available for the JS Obfuscator: