Ver Fonte

Object keys obfuscation - first working realisation

sanex3339 há 7 anos atrás
pai
commit
d3bd595142
86 ficheiros alterados com 963 adições e 532 exclusões
  1. 42 0
      README.md
  2. 0 0
      dist/index.js
  3. 3 3
      package.json
  4. 13 5
      src/JavaScriptObfuscator.ts
  5. 5 0
      src/cli/JavaScriptObfuscatorCLI.ts
  6. 3 3
      src/container/InversifyContainerFacade.ts
  7. 1 0
      src/container/ServiceIdentifiers.ts
  8. 18 1
      src/container/modules/custom-nodes/CustomNodesModule.ts
  9. 5 0
      src/container/modules/node-transformers/ConvertingTransformersModule.ts
  10. 3 3
      src/custom-nodes/AbstractCustomNodeGroup.ts
  11. 4 4
      src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts
  12. 89 0
      src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts
  13. 4 4
      src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts
  14. 4 4
      src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts
  15. 2 2
      src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts
  16. 2 2
      src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts
  17. 4 4
      src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts
  18. 2 2
      src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts
  19. 2 2
      src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts
  20. 3 3
      src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts
  21. 3 3
      src/enums/analyzers/stack-trace-analyzer/CalleeDataExtractor.ts
  22. 9 9
      src/enums/custom-nodes/ControlFlowCustomNode.ts
  23. 10 10
      src/enums/custom-nodes/CustomNode.ts
  24. 5 5
      src/enums/custom-nodes/CustomNodeGroup.ts
  25. 3 0
      src/enums/custom-nodes/DeadCodeInjectionCustomNode.ts
  26. 1 0
      src/enums/logger/LoggingMessage.ts
  27. 18 17
      src/enums/node-transformers/NodeTransformer.ts
  28. 4 4
      src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer.ts
  29. 1 1
      src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts
  30. 3 3
      src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer.ts
  31. 2 2
      src/enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard.ts
  32. 2 0
      src/enums/node/NodeType.ts
  33. 2 2
      src/interfaces/custom-nodes/ICustomNodeGroup.d.ts
  34. 1 0
      src/interfaces/options/IOptions.d.ts
  35. 7 1
      src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts
  36. 9 9
      src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts
  37. 235 0
      src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts
  38. 36 32
      src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts
  39. 6 6
      src/node-transformers/obfuscating-transformers/ClassDeclarationTransformer.ts
  40. 6 6
      src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts
  41. 2 2
      src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts
  42. 15 15
      src/node/NodeAppender.ts
  43. 57 3
      src/node/NodeGuards.ts
  44. 14 54
      src/node/NodeUtils.ts
  45. 6 0
      src/options/Options.ts
  46. 1 0
      src/options/presets/Default.ts
  47. 2 1
      src/options/presets/NoCustomNodes.ts
  48. 5 0
      src/types/container/custom-nodes/TDeadNodeInjectionCustomNodeFactory.d.ts
  49. 3 0
      src/types/node/TNodeWithBlockScope.d.ts
  50. 0 3
      src/types/node/TNodeWithBlockStatement.d.ts
  51. 3 0
      src/types/node/TNodeWithScope.d.ts
  52. 11 25
      test/dev/dev.ts
  53. 11 11
      test/functional-tests/analyzers/stack-trace-analyzer/StackTraceAnalyzer.spec.ts
  54. 3 3
      test/functional-tests/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.spec.ts
  55. 3 3
      test/functional-tests/custom-nodes/domain-lock-nodes/DomainLockNode.spec.ts
  56. 3 3
      test/functional-tests/custom-nodes/string-array-nodes/StringArrayCallsWrapper.spec.ts
  57. 3 3
      test/functional-tests/custom-nodes/string-array-nodes/StringArrayNode.spec.ts
  58. 3 3
      test/functional-tests/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.spec.ts
  59. 10 9
      test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts
  60. 16 15
      test/functional-tests/node-transformers/control-flow-transformers/block-statement-control-flow-transformer/BlockStatementControlFlowTransformer.spec.ts
  61. 3 3
      test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/binary-expression-control-flow-replacer/BinaryExpressionControlFlowReplacer.spec.ts
  62. 4 4
      test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/call-expression-control-flow-replacer/CallExpressionControlFlowReplacer.spec.ts
  63. 5 5
      test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/logical-expression-control-flow-replacer/LogicalExpressionControlFlowReplacer.spec.ts
  64. 2 2
      test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/string-litertal-control-flow-replacer/StringLiteralControlFlowReplacer.spec.ts
  65. 9 9
      test/functional-tests/node-transformers/control-flow-transformers/function-control-flow-transformer/FunctionControlFlowTransformer.spec.ts
  66. 5 5
      test/functional-tests/node-transformers/converting-transformers/member-expression-transformer/MemberExpressionTransformer.spec.ts
  67. 4 4
      test/functional-tests/node-transformers/converting-transformers/method-definition-transformer/MethodDefinitionTransformer.spec.ts
  68. 5 5
      test/functional-tests/node-transformers/converting-transformers/template-literal-transformer/TemplateLiteralTransformer.spec.ts
  69. 10 10
      test/functional-tests/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.spec.ts
  70. 3 3
      test/functional-tests/node-transformers/obfuscating-transformers/catch-clause-transformer/CatchClauseTransformer.spec.ts
  71. 4 4
      test/functional-tests/node-transformers/obfuscating-transformers/class-declaration-transformer/ClassDeclarationTransformer.spec.ts
  72. 6 6
      test/functional-tests/node-transformers/obfuscating-transformers/function-declaration-transformer/FunctionDeclarationTransformer.spec.ts
  73. 8 8
      test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/FunctionTransformer.spec.ts
  74. 2 2
      test/functional-tests/node-transformers/obfuscating-transformers/labeled-statement-transformer/LabeledStatementTransformer.spec.ts
  75. 14 14
      test/functional-tests/node-transformers/obfuscating-transformers/literal-transformer/LiteralTransformer.spec.ts
  76. 4 4
      test/functional-tests/node-transformers/obfuscating-transformers/object-expression-transformer/ObjectExpressionTransformer.spec.ts
  77. 15 15
      test/functional-tests/node-transformers/obfuscating-transformers/variable-declaration-transformer/VariableDeclarationTransformer.spec.ts
  78. 7 7
      test/functional-tests/node-transformers/preparing-transformers/comments-transformer/CommentsTransformer.spec.ts
  79. 2 2
      test/functional-tests/node-transformers/preparing-transformers/obfuscating-guards/black-list-obfuscating-guard/BlackListObfuscatingGuard.spec.ts
  80. 6 6
      test/functional-tests/node-transformers/preparing-transformers/obfuscating-guards/conditional-comment-obfuscating-guard/ConditionalCommentObfuscatingGuard.spec.ts
  81. 5 5
      test/functional-tests/templates/custom-nodes/debug-protection-nodes/DebufProtectionFunctionCallTemplate.spec.ts
  82. 2 1
      test/runtime-tests/JavaScriptObfuscatorRuntime.spec.ts
  83. 3 3
      test/unit-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts
  84. 4 4
      test/unit-tests/node/node-appender/NodeAppender.spec.ts
  85. 79 87
      test/unit-tests/node/node-utils/NodeUtils.spec.ts
  86. 9 9
      yarn.lock

+ 42 - 0
README.md

@@ -290,6 +290,7 @@ Following options are available for the JS Obfuscator:
     stringArrayEncoding: false,
     stringArrayEncoding: false,
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
     target: 'browser',
     target: 'browser',
+    transformObjectKeys: false,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
 }
 }
 ```
 ```
@@ -326,6 +327,7 @@ Following options are available for the JS Obfuscator:
     --string-array-encoding <boolean|string> [true, false, base64, rc4]
     --string-array-encoding <boolean|string> [true, false, base64, rc4]
     --string-array-threshold <number>
     --string-array-threshold <number>
     --target <string> [browser, extension, node]
     --target <string> [browser, extension, node]
+    --transform-object-keys <boolean>
     --unicode-escape-sequence <boolean>
     --unicode-escape-sequence <boolean>
 ```
 ```
 
 
@@ -706,6 +708,44 @@ Available values:
 Currently output code for `browser` and `node` targets is identical.
 Currently output code for `browser` and `node` targets is identical.
 Output code for `extension` target is not using `eval`.
 Output code for `extension` target is not using `eval`.
 
 
+### `transformObjectKeys`
+Type: `boolean` Default: `false`
+
+Enables transformation of object keys.
+
+Example:
+```ts
+// input
+(function(){
+    var object = {
+        foo: 'test1',
+        bar: {
+            baz: 'test2'
+        }
+    };
+})();
+
+// output
+var _0x5a21 = [
+    'foo',
+    'test1',
+    'bar',
+    'baz',
+    'test2'
+];
+var _0x223f = function (_0x474dc0, _0x10db96) {
+    _0x474dc0 = _0x474dc0 - 0x0;
+    var _0x4c8bf7 = _0x5a21[_0x474dc0];
+    return _0x4c8bf7;
+};
+(function () {
+    var _0x2e1a8e = {};
+    _0x2e1a8e[_0x223f('0x0')] = _0x223f('0x1');
+    _0x2e1a8e[_0x223f('0x2')] = {};
+    _0x2e1a8e[_0x223f('0x2')][_0x223f('0x3')] = _0x223f('0x4');
+}());
+```
+
 ### `unicodeEscapeSequence`
 ### `unicodeEscapeSequence`
 Type: `boolean` Default: `false`
 Type: `boolean` Default: `false`
 
 
@@ -736,6 +776,7 @@ Performance will 50-100% slower than without obfuscation
     stringArray: true,
     stringArray: true,
     stringArrayEncoding: 'rc4',
     stringArrayEncoding: 'rc4',
     stringArrayThreshold: 1,
     stringArrayThreshold: 1,
+    transformObjectKeys: true,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
 }
 }
 ```
 ```
@@ -762,6 +803,7 @@ Performance will 30-35% slower than without obfuscation
     stringArray: true,
     stringArray: true,
     stringArrayEncoding: 'base64',
     stringArrayEncoding: 'base64',
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
+    transformObjectKeys: true,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
 }
 }
 ```
 ```

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
dist/index.js


+ 3 - 3
package.json

@@ -23,7 +23,7 @@
     "chance": "1.0.13",
     "chance": "1.0.13",
     "class-validator": "0.7.3",
     "class-validator": "0.7.3",
     "commander": "2.12.2",
     "commander": "2.12.2",
-    "escodegen-wallaby": "1.6.15",
+    "escodegen-wallaby": "1.6.16",
     "esprima": "4.0.0",
     "esprima": "4.0.0",
     "estraverse": "4.2.0",
     "estraverse": "4.2.0",
     "inversify": "4.9.0",
     "inversify": "4.9.0",
@@ -38,7 +38,7 @@
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@types/chai": "4.0.10",
     "@types/chai": "4.0.10",
-    "@types/chance": "0.7.35",
+    "@types/chance": "0.7.36",
     "@types/commander": "2.12.2",
     "@types/commander": "2.12.2",
     "@types/escodegen": "0.0.6",
     "@types/escodegen": "0.0.6",
     "@types/esprima": "4.0.1",
     "@types/esprima": "4.0.1",
@@ -47,7 +47,7 @@
     "@types/md5": "2.1.32",
     "@types/md5": "2.1.32",
     "@types/mkdirp": "0.5.2",
     "@types/mkdirp": "0.5.2",
     "@types/mocha": "2.2.45",
     "@types/mocha": "2.2.45",
-    "@types/node": "8.5.2",
+    "@types/node": "8.5.5",
     "@types/rimraf": "^2.0.2",
     "@types/rimraf": "^2.0.2",
     "@types/sinon": "4.1.2",
     "@types/sinon": "4.1.2",
     "@types/string-template": "1.0.2",
     "@types/string-template": "1.0.2",

+ 13 - 5
src/JavaScriptObfuscator.ts

@@ -51,6 +51,7 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
     private static readonly convertingTransformersList: NodeTransformer[] = [
     private static readonly convertingTransformersList: NodeTransformer[] = [
         NodeTransformer.MemberExpressionTransformer,
         NodeTransformer.MemberExpressionTransformer,
         NodeTransformer.MethodDefinitionTransformer,
         NodeTransformer.MethodDefinitionTransformer,
+        NodeTransformer.ObjectExpressionKeysTransformer,
         NodeTransformer.TemplateLiteralTransformer
         NodeTransformer.TemplateLiteralTransformer
     ];
     ];
 
 
@@ -250,12 +251,19 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
             );
             );
         }
         }
 
 
-        // fifth pass: converting and obfuscating transformers
+        // fifth pass: converting transformers
+        this.logger.info(LoggingMessage.StagePreObfuscation);
+        astTree = this.transformersRunner.transform(
+            astTree,
+            JavaScriptObfuscator.convertingTransformersList
+        );
+
+        // sixth pass: obfuscating transformers
         this.logger.info(LoggingMessage.StageObfuscation);
         this.logger.info(LoggingMessage.StageObfuscation);
-        astTree = this.transformersRunner.transform(astTree, [
-            ...JavaScriptObfuscator.convertingTransformersList,
-            ...JavaScriptObfuscator.obfuscatingTransformersList
-        ]);
+        astTree = this.transformersRunner.transform(
+            astTree,
+            JavaScriptObfuscator.obfuscatingTransformersList
+        );
 
 
         this.obfuscationEventEmitter.emit(ObfuscationEvent.AfterObfuscation, astTree, stackTraceData);
         this.obfuscationEventEmitter.emit(ObfuscationEvent.AfterObfuscation, astTree, stackTraceData);
 
 

+ 5 - 0
src/cli/JavaScriptObfuscatorCLI.ts

@@ -309,6 +309,11 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
                 'Allows to set target environment for obfuscated code.',
                 'Allows to set target environment for obfuscated code.',
                 ObfuscationTargetSanitizer
                 ObfuscationTargetSanitizer
             )
             )
+            .option(
+                '--transform-object-keys <boolean>',
+                'Enables transformation of object keys',
+                BooleanSanitizer
+            )
             .option(
             .option(
                 '--unicode-escape-sequence <boolean>',
                 '--unicode-escape-sequence <boolean>',
                 'Allows to enable/disable string conversion to unicode escape sequence',
                 'Allows to enable/disable string conversion to unicode escape sequence',

+ 3 - 3
src/container/InversifyContainerFacade.ts

@@ -47,7 +47,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade {
      * @param {interfaces.ServiceIdentifier<U>} serviceIdentifier
      * @param {interfaces.ServiceIdentifier<U>} serviceIdentifier
      * @returns {U}
      * @returns {U}
      */
      */
-    public static getFactory <T extends number, U> (
+    public static getFactory <T extends string, U> (
         serviceIdentifier: interfaces.ServiceIdentifier<U>
         serviceIdentifier: interfaces.ServiceIdentifier<U>
     ): (context: interfaces.Context) => (bindingName: T) => U {
     ): (context: interfaces.Context) => (bindingName: T) => U {
         return (context: interfaces.Context): (bindingName: T) => U => {
         return (context: interfaces.Context): (bindingName: T) => U => {
@@ -61,7 +61,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade {
      * @param {interfaces.ServiceIdentifier<U>} serviceIdentifier
      * @param {interfaces.ServiceIdentifier<U>} serviceIdentifier
      * @returns {U}
      * @returns {U}
      */
      */
-    public static getCacheFactory <T extends number, U> (
+    public static getCacheFactory <T extends string, U> (
         serviceIdentifier: interfaces.ServiceIdentifier<U>
         serviceIdentifier: interfaces.ServiceIdentifier<U>
     ): (context: interfaces.Context) => (bindingName: T) => U {
     ): (context: interfaces.Context) => (bindingName: T) => U {
         return (context: interfaces.Context): (bindingName: T) => U => {
         return (context: interfaces.Context): (bindingName: T) => U => {
@@ -86,7 +86,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade {
      * @param {any[]} dependencies
      * @param {any[]} dependencies
      * @returns {U}
      * @returns {U}
      */
      */
-    public static getConstructorFactory <T extends number, U> (
+    public static getConstructorFactory <T extends string, U> (
         serviceIdentifier: interfaces.ServiceIdentifier<interfaces.Newable<U>>,
         serviceIdentifier: interfaces.ServiceIdentifier<interfaces.Newable<U>>,
         ...dependencies: any[]
         ...dependencies: any[]
     ): (context: interfaces.Context) => (bindingName: T) => U {
     ): (context: interfaces.Context) => (bindingName: T) => U {

+ 1 - 0
src/container/ServiceIdentifiers.ts

@@ -4,6 +4,7 @@ export enum ServiceIdentifiers {
     Factory__IControlFlowReplacer = 'Factory<IControlFlowReplacer>',
     Factory__IControlFlowReplacer = 'Factory<IControlFlowReplacer>',
     Factory__ICustomNode = 'Factory<ICustomNode>',
     Factory__ICustomNode = 'Factory<ICustomNode>',
     Factory__ICustomNodeGroup = 'Factory<ICustomNodeGroup>',
     Factory__ICustomNodeGroup = 'Factory<ICustomNodeGroup>',
+    Factory__IDeadCodeInjectionCustomNode = 'Factory<IDeadCodeInjectionCustomNode>',
     Factory__IIdentifierNamesGenerator = 'Factory<IIdentifierNamesGenerator>',
     Factory__IIdentifierNamesGenerator = 'Factory<IIdentifierNamesGenerator>',
     Factory__IIdentifierObfuscatingReplacer = 'Factory<IIdentifierObfuscatingReplacer>',
     Factory__IIdentifierObfuscatingReplacer = 'Factory<IIdentifierObfuscatingReplacer>',
     Factory__INodeGuard = 'Factory<INodeGuard>',
     Factory__INodeGuard = 'Factory<INodeGuard>',

+ 18 - 1
src/container/modules/custom-nodes/CustomNodesModule.ts

@@ -8,6 +8,7 @@ import { ICustomNodeGroup } from '../../../interfaces/custom-nodes/ICustomNodeGr
 import { ControlFlowCustomNode } from "../../../enums/custom-nodes/ControlFlowCustomNode";
 import { ControlFlowCustomNode } from "../../../enums/custom-nodes/ControlFlowCustomNode";
 import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
 import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
 import { CustomNodeGroup } from '../../../enums/custom-nodes/CustomNodeGroup';
 import { CustomNodeGroup } from '../../../enums/custom-nodes/CustomNodeGroup';
+import { DeadCodeInjectionCustomNode } from '../../../enums/custom-nodes/DeadCodeInjectionCustomNode';
 
 
 import { ConsoleOutputCustomNodeGroup } from '../../../custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup';
 import { ConsoleOutputCustomNodeGroup } from '../../../custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup';
 import { DebugProtectionCustomNodeGroup } from '../../../custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup';
 import { DebugProtectionCustomNodeGroup } from '../../../custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup';
@@ -17,6 +18,7 @@ import { StringArrayCustomNodeGroup } from '../../../custom-nodes/string-array-n
 
 
 import { BinaryExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode';
 import { BinaryExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode';
 import { BlockStatementControlFlowFlatteningNode } from '../../../custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode';
 import { BlockStatementControlFlowFlatteningNode } from '../../../custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode';
+import { BlockStatementDeadCodeInjectionNode } from '../../../custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode';
 import { CallExpressionControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode';
 import { CallExpressionControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode';
 import { CallExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode';
 import { CallExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode';
 import { ControlFlowStorageNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode';
 import { ControlFlowStorageNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode';
@@ -114,6 +116,11 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
         .toConstructor(StringLiteralControlFlowStorageCallNode)
         .toConstructor(StringLiteralControlFlowStorageCallNode)
         .whenTargetNamed(ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
         .whenTargetNamed(ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
 
 
+    // dead code injection custom nodes
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
+        .toConstructor(BlockStatementDeadCodeInjectionNode)
+        .whenTargetNamed(DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);
+
     // node groups
     // node groups
     bind<ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup)
     bind<ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup)
         .to(ConsoleOutputCustomNodeGroup)
         .to(ConsoleOutputCustomNodeGroup)
@@ -140,7 +147,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
         .toFactory<ICustomNode>(InversifyContainerFacade
         .toFactory<ICustomNode>(InversifyContainerFacade
             .getFactory<CustomNode, ICustomNode>(ServiceIdentifiers.ICustomNode));
             .getFactory<CustomNode, ICustomNode>(ServiceIdentifiers.ICustomNode));
 
 
-    // control flow storage customNode constructor factory
+    // control flow customNode constructor factory
     bind<ICustomNode>(ServiceIdentifiers.Factory__IControlFlowCustomNode)
     bind<ICustomNode>(ServiceIdentifiers.Factory__IControlFlowCustomNode)
         .toFactory<ICustomNode>(InversifyContainerFacade
         .toFactory<ICustomNode>(InversifyContainerFacade
             .getConstructorFactory<ControlFlowCustomNode, ICustomNode>(
             .getConstructorFactory<ControlFlowCustomNode, ICustomNode>(
@@ -150,6 +157,16 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
                 ServiceIdentifiers.IOptions
                 ServiceIdentifiers.IOptions
             ));
             ));
 
 
+    // dead code injection customNode constructor factory
+    bind<ICustomNode>(ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode)
+        .toFactory<ICustomNode>(InversifyContainerFacade
+            .getConstructorFactory<DeadCodeInjectionCustomNode, ICustomNode>(
+                ServiceIdentifiers.Newable__ICustomNode,
+                ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
+                ServiceIdentifiers.IRandomGenerator,
+                ServiceIdentifiers.IOptions
+            ));
+
     // customNodeGroup factory
     // customNodeGroup factory
     bind<ICustomNodeGroup>(ServiceIdentifiers.Factory__ICustomNodeGroup)
     bind<ICustomNodeGroup>(ServiceIdentifiers.Factory__ICustomNodeGroup)
         .toFactory<ICustomNodeGroup>(InversifyContainerFacade
         .toFactory<ICustomNodeGroup>(InversifyContainerFacade

+ 5 - 0
src/container/modules/node-transformers/ConvertingTransformersModule.ts

@@ -7,6 +7,7 @@ import { NodeTransformer } from '../../../enums/node-transformers/NodeTransforme
 
 
 import { MemberExpressionTransformer } from '../../../node-transformers/converting-transformers/MemberExpressionTransformer';
 import { MemberExpressionTransformer } from '../../../node-transformers/converting-transformers/MemberExpressionTransformer';
 import { MethodDefinitionTransformer } from '../../../node-transformers/converting-transformers/MethodDefinitionTransformer';
 import { MethodDefinitionTransformer } from '../../../node-transformers/converting-transformers/MethodDefinitionTransformer';
+import { ObjectExpressionKeysTransformer } from '../../../node-transformers/converting-transformers/ObjectExpressionKeysTransformer';
 import { TemplateLiteralTransformer } from '../../../node-transformers/converting-transformers/TemplateLiteralTransformer';
 import { TemplateLiteralTransformer } from '../../../node-transformers/converting-transformers/TemplateLiteralTransformer';
 
 
 export const convertingTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
 export const convertingTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
@@ -19,6 +20,10 @@ export const convertingTransformersModule: interfaces.ContainerModule = new Cont
         .to(MethodDefinitionTransformer)
         .to(MethodDefinitionTransformer)
         .whenTargetNamed(NodeTransformer.MethodDefinitionTransformer);
         .whenTargetNamed(NodeTransformer.MethodDefinitionTransformer);
 
 
+    bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
+        .to(ObjectExpressionKeysTransformer)
+        .whenTargetNamed(NodeTransformer.ObjectExpressionKeysTransformer);
+
     bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
     bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
         .to(TemplateLiteralTransformer)
         .to(TemplateLiteralTransformer)
         .whenTargetNamed(NodeTransformer.TemplateLiteralTransformer);
         .whenTargetNamed(NodeTransformer.TemplateLiteralTransformer);

+ 3 - 3
src/custom-nodes/AbstractCustomNodeGroup.ts

@@ -2,7 +2,7 @@ import { inject, injectable } from 'inversify';
 import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
 import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
 
 
 import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TNodeWithBlockStatement } from '../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
 import { ICustomNodeGroup } from '../interfaces/custom-nodes/ICustomNodeGroup';
 import { ICustomNodeGroup } from '../interfaces/custom-nodes/ICustomNodeGroup';
@@ -63,10 +63,10 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {IStackTraceData[]} stackTraceData
      * @param {IStackTraceData[]} stackTraceData
      */
      */
-    public abstract appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void;
+    public abstract appendCustomNodes (blockScopeNode: TNodeWithBlockScope, stackTraceData: IStackTraceData[]): void;
 
 
     /**
     /**
      * @returns {ObfuscationEvent}
      * @returns {ObfuscationEvent}

+ 4 - 4
src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
@@ -55,10 +55,10 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {IStackTraceData[]} stackTraceData
      * @param {IStackTraceData[]} stackTraceData
      */
      */
-    public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void {
+    public appendCustomNodes (blockScopeNode: TNodeWithBlockScope, stackTraceData: IStackTraceData[]): void {
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
 
 
         // consoleOutputDisableExpressionNode append
         // consoleOutputDisableExpressionNode append
@@ -73,7 +73,7 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
 
 
         // nodeCallsControllerFunctionNode append
         // nodeCallsControllerFunctionNode append
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
-            let targetBlockScope: TNodeWithBlockStatement;
+            let targetBlockScope: TNodeWithBlockScope;
 
 
             if (stackTraceData.length) {
             if (stackTraceData.length) {
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);

+ 89 - 0
src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts

@@ -0,0 +1,89 @@
+import { inject, injectable, } from 'inversify';
+import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
+
+import { BinaryOperator, BlockStatement } from 'estree';
+
+import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
+import { TStatement } from '../../types/node/TStatement';
+
+import { IOptions } from '../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
+
+import { initializable } from '../../decorators/Initializable';
+
+import { AbstractCustomNode } from '../AbstractCustomNode';
+import { Nodes } from '../../node/Nodes';
+import { NodeUtils } from '../../node/NodeUtils';
+
+@injectable()
+export class BlockStatementDeadCodeInjectionNode extends AbstractCustomNode {
+    /**
+     * @type {BlockStatement}
+     */
+    @initializable()
+    private blockStatementNode: BlockStatement;
+
+    /**
+     * @type {BlockStatement}
+     */
+    @initializable()
+    private randomBlockStatementNode: BlockStatement;
+
+    /**
+     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    constructor (
+        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
+            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(identifierNamesGeneratorFactory, randomGenerator, options);
+    }
+
+    /**
+     * @param {BlockStatement} blockStatementNode
+     * @param {BlockStatement} randomBlockStatementNode
+     */
+    public initialize (
+        blockStatementNode: BlockStatement,
+        randomBlockStatementNode: BlockStatement
+    ): void {
+        this.blockStatementNode = blockStatementNode;
+        this.randomBlockStatementNode = randomBlockStatementNode;
+    }
+
+    /**
+     * @returns {TStatement[]}
+     */
+    protected getNodeStructure (): TStatement[] {
+        const random1: boolean = this.randomGenerator.getMathRandom() > 0.5;
+        const random2: boolean = this.randomGenerator.getMathRandom() > 0.5;
+
+        const operator: BinaryOperator = random1 ? '===' : '!==';
+        const leftString: string = this.randomGenerator.getRandomString(3);
+        const rightString: string = random2 ? leftString : this.randomGenerator.getRandomString(3);
+
+        const [consequent, alternate]: [BlockStatement, BlockStatement] = random1 === random2
+            ? [this.blockStatementNode, this.randomBlockStatementNode]
+            : [this.randomBlockStatementNode, this.blockStatementNode];
+
+        const structure: BlockStatement = Nodes.getBlockStatementNode([
+            Nodes.getIfStatementNode(
+                Nodes.getBinaryExpressionNode(
+                    operator,
+                    Nodes.getLiteralNode(leftString),
+                    Nodes.getLiteralNode(rightString)
+                ),
+                consequent,
+                alternate
+            )
+        ]);
+
+        NodeUtils.parentize(structure);
+
+        return [structure];
+    }
+}

+ 4 - 4
src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
@@ -55,10 +55,10 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {IStackTraceData[]} stackTraceData
      * @param {IStackTraceData[]} stackTraceData
      */
      */
-    public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void {
+    public appendCustomNodes (blockScopeNode: TNodeWithBlockScope, stackTraceData: IStackTraceData[]): void {
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
 
 
         // debugProtectionFunctionCallNode append
         // debugProtectionFunctionCallNode append
@@ -86,7 +86,7 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
 
 
         // nodeCallsControllerFunctionNode append
         // nodeCallsControllerFunctionNode append
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
-            let targetBlockScope: TNodeWithBlockStatement;
+            let targetBlockScope: TNodeWithBlockScope;
 
 
             if (stackTraceData.length) {
             if (stackTraceData.length) {
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);

+ 4 - 4
src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
@@ -55,10 +55,10 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {IStackTraceData[]} stackTraceData
      * @param {IStackTraceData[]} stackTraceData
      */
      */
-    public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void {
+    public appendCustomNodes (blockScopeNode: TNodeWithBlockScope, stackTraceData: IStackTraceData[]): void {
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
 
 
         // domainLockNode append
         // domainLockNode append
@@ -73,7 +73,7 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
 
 
         // nodeCallsControllerFunctionNode append
         // nodeCallsControllerFunctionNode append
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
-            let targetBlockScope: TNodeWithBlockStatement;
+            let targetBlockScope: TNodeWithBlockScope;
 
 
             if (stackTraceData.length) {
             if (stackTraceData.length) {
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);

+ 2 - 2
src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts

@@ -15,7 +15,7 @@ import { initializable } from '../../decorators/Initializable';
 
 
 import { SingleNodeCallControllerTemplate } from '../../templates/SingleNodeCallControllerTemplate';
 import { SingleNodeCallControllerTemplate } from '../../templates/SingleNodeCallControllerTemplate';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../options/presets/NoCustomNodes';
 
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { JavaScriptObfuscator } from '../../JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../JavaScriptObfuscatorFacade';
@@ -75,7 +75,7 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
                     singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                     singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                 }),
                 }),
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     identifierNamesGenerator: this.options.identifierNamesGenerator,
                     identifierNamesGenerator: this.options.identifierNamesGenerator,
                     seed: this.options.seed
                     seed: this.options.seed
                 }
                 }

+ 2 - 2
src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts

@@ -12,7 +12,7 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../options/presets/NoCustomNodes';
 
 
 import { SelfDefendingTemplate } from '../../templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate';
 import { SelfDefendingTemplate } from '../../templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate';
 
 
@@ -75,7 +75,7 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
                 singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                 singleNodeCallControllerFunctionName: this.callsControllerFunctionName
             }),
             }),
             {
             {
-                ...NO_CUSTOM_NODES_PRESET,
+                ...NO_ADDITIONAL_NODES_PRESET,
                 identifierNamesGenerator: this.options.identifierNamesGenerator,
                 identifierNamesGenerator: this.options.identifierNamesGenerator,
                 seed: this.options.seed,
                 seed: this.options.seed,
                 unicodeEscapeSequence: true
                 unicodeEscapeSequence: true

+ 4 - 4
src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
@@ -55,10 +55,10 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {IStackTraceData[]} stackTraceData
      * @param {IStackTraceData[]} stackTraceData
      */
      */
-    public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void {
+    public appendCustomNodes (blockScopeNode: TNodeWithBlockScope, stackTraceData: IStackTraceData[]): void {
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
         const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length);
 
 
         // selfDefendingUnicodeNode append
         // selfDefendingUnicodeNode append
@@ -73,7 +73,7 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
 
 
         // nodeCallsControllerFunctionNode append
         // nodeCallsControllerFunctionNode append
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
         this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
-            let targetBlockScope: TNodeWithBlockStatement;
+            let targetBlockScope: TNodeWithBlockScope;
 
 
             if (stackTraceData.length) {
             if (stackTraceData.length) {
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
                 targetBlockScope = NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);

+ 2 - 2
src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts

@@ -15,7 +15,7 @@ import { StringArrayEncoding } from '../../enums/StringArrayEncoding';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../options/presets/NoCustomNodes';
 
 
 import { AtobTemplate } from '../../templates/AtobTemplate';
 import { AtobTemplate } from '../../templates/AtobTemplate';
 import { GlobalVariableNoEvalTemplate } from '../../templates/GlobalVariableNoEvalTemplate';
 import { GlobalVariableNoEvalTemplate } from '../../templates/GlobalVariableNoEvalTemplate';
@@ -98,7 +98,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
                 stringArrayName: this.stringArrayName
                 stringArrayName: this.stringArrayName
             }),
             }),
             {
             {
-                ...NO_CUSTOM_NODES_PRESET,
+                ...NO_ADDITIONAL_NODES_PRESET,
                 identifierNamesGenerator: this.options.identifierNamesGenerator,
                 identifierNamesGenerator: this.options.identifierNamesGenerator,
                 seed: this.options.seed
                 seed: this.options.seed
             }
             }

+ 2 - 2
src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts

@@ -12,7 +12,7 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../options/presets/NoCustomNodes';
 
 
 import { SelfDefendingTemplate } from '../../templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate';
 import { SelfDefendingTemplate } from '../../templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate';
 import { StringArrayRotateFunctionTemplate } from '../../templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate';
 import { StringArrayRotateFunctionTemplate } from '../../templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate';
@@ -105,7 +105,7 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
                 whileFunctionName
                 whileFunctionName
             }),
             }),
             {
             {
-                ...NO_CUSTOM_NODES_PRESET,
+                ...NO_ADDITIONAL_NODES_PRESET,
                 identifierNamesGenerator: this.options.identifierNamesGenerator,
                 identifierNamesGenerator: this.options.identifierNamesGenerator,
                 seed: this.options.seed
                 seed: this.options.seed
             }
             }

+ 3 - 3
src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
@@ -65,10 +65,10 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {IStackTraceData[]} stackTraceData
      * @param {IStackTraceData[]} stackTraceData
      */
      */
-    public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void {
+    public appendCustomNodes (blockScopeNode: TNodeWithBlockScope, stackTraceData: IStackTraceData[]): void {
         if (!this.stringArrayStorage.getLength()) {
         if (!this.stringArrayStorage.getLength()) {
             return;
             return;
         }
         }

+ 3 - 3
src/enums/analyzers/stack-trace-analyzer/CalleeDataExtractor.ts

@@ -1,5 +1,5 @@
 export enum CalleeDataExtractor {
 export enum CalleeDataExtractor {
-    FunctionDeclarationCalleeDataExtractor,
-    FunctionExpressionCalleeDataExtractor,
-    ObjectExpressionCalleeDataExtractor,
+    FunctionDeclarationCalleeDataExtractor = 'FunctionDeclarationCalleeDataExtractor',
+    FunctionExpressionCalleeDataExtractor = 'FunctionExpressionCalleeDataExtractor',
+    ObjectExpressionCalleeDataExtractor = 'ObjectExpressionCalleeDataExtractor',
 }
 }

+ 9 - 9
src/enums/custom-nodes/ControlFlowCustomNode.ts

@@ -1,11 +1,11 @@
 export enum ControlFlowCustomNode {
 export enum ControlFlowCustomNode {
-    BinaryExpressionFunctionNode,
-    BlockStatementControlFlowFlatteningNode,
-    CallExpressionControlFlowStorageCallNode,
-    CallExpressionFunctionNode,
-    ControlFlowStorageNode,
-    ExpressionWithOperatorControlFlowStorageCallNode,
-    LogicalExpressionFunctionNode,
-    StringLiteralControlFlowStorageCallNode,
-    StringLiteralNode,
+    BinaryExpressionFunctionNode = 'BinaryExpressionFunctionNode',
+    BlockStatementControlFlowFlatteningNode = 'BlockStatementControlFlowFlatteningNode',
+    CallExpressionControlFlowStorageCallNode = 'CallExpressionControlFlowStorageCallNode',
+    CallExpressionFunctionNode = 'CallExpressionFunctionNode',
+    ControlFlowStorageNode = 'ControlFlowStorageNode',
+    ExpressionWithOperatorControlFlowStorageCallNode = 'ExpressionWithOperatorControlFlowStorageCallNode',
+    LogicalExpressionFunctionNode = 'LogicalExpressionFunctionNode',
+    StringLiteralControlFlowStorageCallNode = 'StringLiteralControlFlowStorageCallNode',
+    StringLiteralNode = 'StringLiteralNode'
 }
 }

+ 10 - 10
src/enums/custom-nodes/CustomNode.ts

@@ -1,12 +1,12 @@
 export enum CustomNode {
 export enum CustomNode {
-    ConsoleOutputDisableExpressionNode,
-    DebugProtectionFunctionCallNode,
-    DebugProtectionFunctionIntervalNode,
-    DebugProtectionFunctionNode,
-    DomainLockNode,
-    NodeCallsControllerFunctionNode,
-    SelfDefendingUnicodeNode,
-    StringArrayCallsWrapper,
-    StringArrayNode,
-    StringArrayRotateFunctionNode
+    ConsoleOutputDisableExpressionNode = 'ConsoleOutputDisableExpressionNode',
+    DebugProtectionFunctionCallNode = 'DebugProtectionFunctionCallNode',
+    DebugProtectionFunctionIntervalNode = 'DebugProtectionFunctionIntervalNode',
+    DebugProtectionFunctionNode = 'DebugProtectionFunctionNode',
+    DomainLockNode = 'DomainLockNode',
+    NodeCallsControllerFunctionNode = 'NodeCallsControllerFunctionNode',
+    SelfDefendingUnicodeNode = 'SelfDefendingUnicodeNode',
+    StringArrayCallsWrapper = 'StringArrayCallsWrapper',
+    StringArrayNode = 'StringArrayNode',
+    StringArrayRotateFunctionNode = 'StringArrayRotateFunctionNode'
 }
 }

+ 5 - 5
src/enums/custom-nodes/CustomNodeGroup.ts

@@ -1,7 +1,7 @@
 export enum CustomNodeGroup {
 export enum CustomNodeGroup {
-    ConsoleOutputCustomNodeGroup,
-    DebugProtectionCustomNodeGroup,
-    DomainLockCustomNodeGroup,
-    SelfDefendingCustomNodeGroup,
-    StringArrayCustomNodeGroup
+    ConsoleOutputCustomNodeGroup = 'ConsoleOutputCustomNodeGroup',
+    DebugProtectionCustomNodeGroup = 'DebugProtectionCustomNodeGroup',
+    DomainLockCustomNodeGroup = 'DomainLockCustomNodeGroup',
+    SelfDefendingCustomNodeGroup = 'SelfDefendingCustomNodeGroup',
+    StringArrayCustomNodeGroup = 'StringArrayCustomNodeGroup'
 }
 }

+ 3 - 0
src/enums/custom-nodes/DeadCodeInjectionCustomNode.ts

@@ -0,0 +1,3 @@
+export enum DeadCodeInjectionCustomNode {
+    BlockStatementDeadCodeInjectionNode = 'BlockStatementDeadCodeInjectionNode'
+}

+ 1 - 0
src/enums/logger/LoggingMessage.ts

@@ -7,6 +7,7 @@ export enum LoggingMessage {
     StageAnalyzingASTTree = 'Stage: analyzing AST-tree...',
     StageAnalyzingASTTree = 'Stage: analyzing AST-tree...',
     StageControlFlowFlattening = 'Stage: control flow flattening...',
     StageControlFlowFlattening = 'Stage: control flow flattening...',
     StageDeadCodeInjection = 'Stage: dead code injection...',
     StageDeadCodeInjection = 'Stage: dead code injection...',
+    StagePreObfuscation = 'Stage: pre-obfuscation...',
     StageObfuscation = 'Stage: obfuscation...',
     StageObfuscation = 'Stage: obfuscation...',
     Version = 'Version: %s'
     Version = 'Version: %s'
 }
 }

+ 18 - 17
src/enums/node-transformers/NodeTransformer.ts

@@ -1,19 +1,20 @@
 export enum NodeTransformer {
 export enum NodeTransformer {
-    BlockStatementControlFlowTransformer,
-    ClassDeclarationTransformer,
-    CommentsTransformer,
-    DeadCodeInjectionTransformer,
-    FunctionControlFlowTransformer,
-    CatchClauseTransformer,
-    FunctionDeclarationTransformer,
-    FunctionTransformer,
-    LabeledStatementTransformer,
-    LiteralTransformer,
-    MemberExpressionTransformer,
-    MethodDefinitionTransformer,
-    ObfuscatingGuardsTransformer,
-    ObjectExpressionTransformer,
-    ParentificationTransformer,
-    TemplateLiteralTransformer,
-    VariableDeclarationTransformer
+    BlockStatementControlFlowTransformer = 'BlockStatementControlFlowTransformer',
+    ClassDeclarationTransformer = 'ClassDeclarationTransformer',
+    CommentsTransformer = 'CommentsTransformer',
+    DeadCodeInjectionTransformer = 'DeadCodeInjectionTransformer',
+    FunctionControlFlowTransformer = 'FunctionControlFlowTransformer',
+    CatchClauseTransformer = 'CatchClauseTransformer',
+    FunctionDeclarationTransformer = 'FunctionDeclarationTransformer',
+    FunctionTransformer = 'FunctionTransformer',
+    LabeledStatementTransformer = 'LabeledStatementTransformer',
+    LiteralTransformer = 'LiteralTransformer',
+    MemberExpressionTransformer = 'MemberExpressionTransformer',
+    MethodDefinitionTransformer = 'MethodDefinitionTransformer',
+    ObfuscatingGuardsTransformer = 'ObfuscatingGuardsTransformer',
+    ObjectExpressionKeysTransformer = 'ObjectExpressionKeysTransformer',
+    ObjectExpressionTransformer = 'ObjectExpressionTransformer',
+    ParentificationTransformer = 'ParentificationTransformer',
+    TemplateLiteralTransformer = 'TemplateLiteralTransformer',
+    VariableDeclarationTransformer = 'VariableDeclarationTransformer'
 }
 }

+ 4 - 4
src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer.ts

@@ -1,6 +1,6 @@
 export enum ControlFlowReplacer {
 export enum ControlFlowReplacer {
-    BinaryExpressionControlFlowReplacer,
-    CallExpressionControlFlowReplacer,
-    LogicalExpressionControlFlowReplacer,
-    StringLiteralControlFlowReplacer,
+    BinaryExpressionControlFlowReplacer = 'BinaryExpressionControlFlowReplacer',
+    CallExpressionControlFlowReplacer = 'CallExpressionControlFlowReplacer',
+    LogicalExpressionControlFlowReplacer = 'LogicalExpressionControlFlowReplacer',
+    StringLiteralControlFlowReplacer = 'StringLiteralControlFlowReplacer'
 }
 }

+ 1 - 1
src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts

@@ -1,3 +1,3 @@
 export enum IdentifierObfuscatingReplacer {
 export enum IdentifierObfuscatingReplacer {
-    BaseIdentifierObfuscatingReplacer
+    BaseIdentifierObfuscatingReplacer = 'BaseIdentifierObfuscatingReplacer'
 }
 }

+ 3 - 3
src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer.ts

@@ -1,5 +1,5 @@
 export enum LiteralObfuscatingReplacer {
 export enum LiteralObfuscatingReplacer {
-    BooleanLiteralObfuscatingReplacer,
-    NumberLiteralObfuscatingReplacer,
-    StringLiteralObfuscatingReplacer
+    BooleanLiteralObfuscatingReplacer = 'BooleanLiteralObfuscatingReplacer',
+    NumberLiteralObfuscatingReplacer = 'NumberLiteralObfuscatingReplacer',
+    StringLiteralObfuscatingReplacer = 'StringLiteralObfuscatingReplacer'
 }
 }

+ 2 - 2
src/enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard.ts

@@ -1,4 +1,4 @@
 export enum ObfuscatingGuard {
 export enum ObfuscatingGuard {
-    BlackListNodeGuard,
-    ConditionalCommentNodeGuard
+    BlackListNodeGuard = 'BlackListNodeGuard',
+    ConditionalCommentNodeGuard = 'ConditionalCommentNodeGuard'
 }
 }

+ 2 - 0
src/enums/node/NodeType.ts

@@ -1,5 +1,6 @@
 export enum NodeType {
 export enum NodeType {
     ArrayExpression = 'ArrayExpression',
     ArrayExpression = 'ArrayExpression',
+    ArrayPattern = 'ArrayPattern',
     ArrowFunctionExpression = 'ArrowFunctionExpression',
     ArrowFunctionExpression = 'ArrowFunctionExpression',
     AssignmentExpression = 'AssignmentExpression',
     AssignmentExpression = 'AssignmentExpression',
     AssignmentPattern = 'AssignmentPattern',
     AssignmentPattern = 'AssignmentPattern',
@@ -25,6 +26,7 @@ export enum NodeType {
     ObjectPattern = 'ObjectPattern',
     ObjectPattern = 'ObjectPattern',
     Program = 'Program',
     Program = 'Program',
     Property = 'Property',
     Property = 'Property',
+    RestElement = 'RestElement',
     ReturnStatement = 'ReturnStatement',
     ReturnStatement = 'ReturnStatement',
     Super = 'Super',
     Super = 'Super',
     SwitchCase = 'SwitchCase',
     SwitchCase = 'SwitchCase',

+ 2 - 2
src/interfaces/custom-nodes/ICustomNodeGroup.d.ts

@@ -1,4 +1,4 @@
-import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from './ICustomNode';
 import { ICustomNode } from './ICustomNode';
 import { IInitializable } from '../IInitializable';
 import { IInitializable } from '../IInitializable';
@@ -12,7 +12,7 @@ export interface ICustomNodeGroup extends IInitializable {
      * @param blockScopeNode
      * @param blockScopeNode
      * @param stackTraceData
      * @param stackTraceData
      */
      */
-    appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void;
+    appendCustomNodes (blockScopeNode: TNodeWithBlockScope, stackTraceData: IStackTraceData[]): void;
 
 
     /**
     /**
      * @returns {ObfuscationEvent}
      * @returns {ObfuscationEvent}

+ 1 - 0
src/interfaces/options/IOptions.d.ts

@@ -29,5 +29,6 @@ export interface IOptions {
     readonly stringArrayEncoding: TStringArrayEncoding;
     readonly stringArrayEncoding: TStringArrayEncoding;
     readonly stringArrayThreshold: number;
     readonly stringArrayThreshold: number;
     readonly target: ObfuscationTarget;
     readonly target: ObfuscationTarget;
+    readonly transformObjectKeys: boolean;
     readonly unicodeEscapeSequence: boolean;
     readonly unicodeEscapeSequence: boolean;
 }
 }

+ 7 - 1
src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts

@@ -5,6 +5,7 @@ import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
 import { TControlFlowCustomNodeFactory } from '../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
 import { TControlFlowCustomNodeFactory } from '../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
+import { TStatement } from '../../types/node/TStatement';
 
 
 import { IArrayUtils } from '../../interfaces/utils/IArrayUtils';
 import { IArrayUtils } from '../../interfaces/utils/IArrayUtils';
 import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
@@ -16,6 +17,7 @@ import { ControlFlowCustomNode } from '../../enums/custom-nodes/ControlFlowCusto
 
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { NodeGuards } from '../../node/NodeGuards';
 import { NodeGuards } from '../../node/NodeGuards';
+import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
 export class BlockStatementControlFlowTransformer extends AbstractNodeTransformer {
 export class BlockStatementControlFlowTransformer extends AbstractNodeTransformer {
@@ -134,6 +136,10 @@ export class BlockStatementControlFlowTransformer extends AbstractNodeTransforme
             originalKeysIndexesInShuffledArray
             originalKeysIndexesInShuffledArray
         );
         );
 
 
-        return blockStatementControlFlowFlatteningCustomNode.getNode()[0];
+        const newBlockStatementNode: TStatement = blockStatementControlFlowFlatteningCustomNode.getNode()[0];
+
+        NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
+
+        return newBlockStatementNode;
     }
     }
 }
 }

+ 9 - 9
src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts

@@ -7,7 +7,7 @@ import * as ESTree from 'estree';
 import { TControlFlowCustomNodeFactory } from '../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
 import { TControlFlowCustomNodeFactory } from '../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
 import { TControlFlowReplacerFactory } from '../../types/container/node-transformers/TControlFlowReplacerFactory';
 import { TControlFlowReplacerFactory } from '../../types/container/node-transformers/TControlFlowReplacerFactory';
 import { TControlFlowStorageFactory } from '../../types/container/node-transformers/TControlFlowStorageFactory';
 import { TControlFlowStorageFactory } from '../../types/container/node-transformers/TControlFlowStorageFactory';
-import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../types/node/TNodeWithBlockScope';
 
 
 import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
@@ -57,9 +57,9 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
     private readonly visitedFunctionNodes: Set<ESTree.Function> = new Set();
     private readonly visitedFunctionNodes: Set<ESTree.Function> = new Set();
 
 
     /**
     /**
-     * @type {Set<TNodeWithBlockStatement>}
+     * @type {Set<TNodeWithBlockScope>}
      */
      */
-    private readonly hostNodesWithControlFlowNode: Set<TNodeWithBlockStatement> = new Set();
+    private readonly hostNodesWithControlFlowNode: Set<TNodeWithBlockScope> = new Set();
 
 
     /**
     /**
      * @type {TControlFlowReplacerFactory}
      * @type {TControlFlowReplacerFactory}
@@ -131,7 +131,7 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
             return functionNode;
             return functionNode;
         }
         }
 
 
-        const hostNode: TNodeWithBlockStatement = this.getHostNode(functionNode.body);
+        const hostNode: TNodeWithBlockScope = this.getHostNode(functionNode.body);
         const controlFlowStorage: IStorage<ICustomNode> = this.getControlFlowStorage(hostNode);
         const controlFlowStorage: IStorage<ICustomNode> = this.getControlFlowStorage(hostNode);
 
 
         this.controlFlowData.set(hostNode, controlFlowStorage);
         this.controlFlowData.set(hostNode, controlFlowStorage);
@@ -153,10 +153,10 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} hostNode
+     * @param {TNodeWithBlockScope} hostNode
      * @returns {IStorage<ICustomNode>}
      * @returns {IStorage<ICustomNode>}
      */
      */
-    private getControlFlowStorage (hostNode: TNodeWithBlockStatement): IStorage<ICustomNode> {
+    private getControlFlowStorage (hostNode: TNodeWithBlockScope): IStorage<ICustomNode> {
         const controlFlowStorage: IStorage <ICustomNode> = this.controlFlowStorageFactory();
         const controlFlowStorage: IStorage <ICustomNode> = this.controlFlowStorageFactory();
 
 
         if (this.controlFlowData.has(hostNode)) {
         if (this.controlFlowData.has(hostNode)) {
@@ -174,10 +174,10 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
 
 
     /**
     /**
      * @param {BlockStatement} functionNodeBody
      * @param {BlockStatement} functionNodeBody
-     * @returns {TNodeWithBlockStatement}
+     * @returns {TNodeWithBlockScope}
      */
      */
-    private getHostNode (functionNodeBody: ESTree.BlockStatement): TNodeWithBlockStatement {
-        const blockScopesOfNode: TNodeWithBlockStatement[] = NodeUtils.getBlockScopesOfNode(functionNodeBody);
+    private getHostNode (functionNodeBody: ESTree.BlockStatement): TNodeWithBlockScope {
+        const blockScopesOfNode: TNodeWithBlockScope[] = NodeUtils.getBlockScopesOfNode(functionNodeBody);
 
 
         if (blockScopesOfNode.length === 1) {
         if (blockScopesOfNode.length === 1) {
             return functionNodeBody;
             return functionNodeBody;

+ 235 - 0
src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts

@@ -0,0 +1,235 @@
+import { inject, injectable } from 'inversify';
+import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
+
+import * as ESTree from 'estree';
+
+import { TNodeWithScope } from '../../types/node/TNodeWithScope';
+
+import { IOptions } from '../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
+import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
+
+import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
+import { NodeAppender } from '../../node/NodeAppender';
+import { NodeGuards } from '../../node/NodeGuards';
+import { Nodes } from '../../node/Nodes';
+import { NodeUtils } from '../../node/NodeUtils';
+
+@injectable()
+export class ObjectExpressionKeysTransformer extends AbstractNodeTransformer {
+    /**
+     * @type {Map<VariableDeclarator, BlockStatement>}
+     */
+    private cachedScopeNodesMap: Map <ESTree.VariableDeclarator, ESTree.BlockStatement> = new Map();
+
+    /**
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    constructor (
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(randomGenerator, options);
+    }
+
+    /**
+     * @param {BlockStatement} scopeNode
+     * @param {ExpressionStatement[]} expressionStatements
+     * @param {Node} variableDeclarator
+     */
+    private static appendExpressionStatements (
+        scopeNode: ESTree.BlockStatement,
+        expressionStatements: ESTree.ExpressionStatement[],
+        variableDeclarator: ESTree.Node
+    ): void {
+        const variableDeclaration: ESTree.Node | undefined = variableDeclarator.parentNode;
+
+        if (
+            !variableDeclaration
+            || !NodeGuards.isVariableDeclarationNode(variableDeclaration)
+        ) {
+            throw new Error('Cannot find variable declaration for variable declarator');
+        }
+
+        const indexInBlockStatement: number = scopeNode.body.indexOf(variableDeclaration);
+
+        NodeAppender.insertNodeAtIndex(scopeNode, expressionStatements, indexInBlockStatement + 1);
+    }
+
+    /**
+     * @param {Property[]} properties
+     * @param {number[]} removablePropertyIds
+     * @returns {Property[]}
+     */
+    private static filterObjectExpressionProperties (properties: ESTree.Property[], removablePropertyIds: number[]): ESTree.Property[] {
+        return properties.filter((property: ESTree.Property, index: number) => !removablePropertyIds.includes(index));
+    }
+
+    /**
+     * @return {IVisitor}
+     */
+    public getVisitor (): IVisitor {
+        return {
+            enter: (node: ESTree.Node, parentNode: ESTree.Node | null) => {
+                if (
+                    this.options.transformObjectKeys
+                    && parentNode
+                    && NodeGuards.isObjectExpressionNode(node)
+                    && NodeGuards.isVariableDeclaratorNode(parentNode)
+                ) {
+                    return this.transformNode(node, parentNode);
+                }
+            }
+        };
+    }
+
+    /**
+     * replaces:
+     *     var object = {
+     *          foo: 1,
+     *          bar: 2
+     *     };
+     *
+     * on:
+     *     var object = {};
+     *     object['foo'] = 1;
+     *     object['bar'] = 2;
+     *
+     * @param {MemberExpression} objectExpressionNode
+     * @param {NodeGuards} variableDeclarator
+     * @returns {NodeGuards}
+     */
+    public transformNode (objectExpressionNode: ESTree.ObjectExpression, variableDeclarator: ESTree.VariableDeclarator): ESTree.Node {
+        // should pass only Expression nodes as MemberExpression.object value
+        if (!NodeGuards.isIdentifierNode(variableDeclarator.id)) {
+            return objectExpressionNode;
+        }
+
+        const scopeNode: TNodeWithScope | null = NodeUtils.getScopeOfNode(variableDeclarator);
+
+        if (!scopeNode || !NodeGuards.isBlockStatementNode(scopeNode)) {
+            return objectExpressionNode;
+        }
+
+        this.cachedScopeNodesMap.set(variableDeclarator, scopeNode);
+
+        return this.transformObjectExpressionNode(
+            objectExpressionNode,
+            variableDeclarator.id,
+            variableDeclarator
+        );
+    }
+
+    /**
+     * @param {Property[]} properties
+     * @param {Expression} memberExpressionObject
+     * @param {VariableDeclarator} variableDeclarator
+     * @returns {[ExpressionStatement[] , number[]]}
+     */
+    private extractPropertiesToExpressionStatements (
+        properties: ESTree.Property[],
+        memberExpressionObject: ESTree.Expression,
+        variableDeclarator: ESTree.VariableDeclarator
+    ): [ESTree.ExpressionStatement[], number[]] {
+        const propertiesLength: number = properties.length;
+        const expressionStatements: ESTree.ExpressionStatement[] = [];
+        const removablePropertyIds: number[] = [];
+
+        for (let i: number = 0; i < propertiesLength; i++) {
+            const property: ESTree.Property = properties[i];
+            const propertyKey: ESTree.Expression = property.key;
+
+            // invalid property nodes
+            if (
+                NodeGuards.isObjectPatternNode(property.value)
+                || NodeGuards.isArrayPatternNode(property.value)
+                || NodeGuards.isAssignmentPatternNode(property.value)
+                || NodeGuards.isRestElementNode(property.value)
+            ) {
+                continue;
+            }
+
+            /**
+             * Stage 1: collecting property node key names
+             */
+            let propertyKeyName: string;
+
+            if (NodeGuards.isLiteralNode(propertyKey) && typeof propertyKey.value === 'string') {
+                propertyKeyName = propertyKey.value;
+            } else if (NodeGuards.isIdentifierNode(propertyKey)) {
+                propertyKeyName = propertyKey.name;
+            } else {
+                continue;
+            }
+
+            /**
+             * Stage 2: creating new expression statement node with member expression based on removed property
+             */
+            const shouldCreateLiteralNode: boolean = !property.computed
+                || (property.computed && NodeGuards.isLiteralNode(property.key));
+            const memberExpressionProperty: ESTree.Expression = shouldCreateLiteralNode
+                ? Nodes.getLiteralNode(propertyKeyName)
+                : Nodes.getIdentifierNode(propertyKeyName);
+            const memberExpressionNode: ESTree.MemberExpression = Nodes
+                .getMemberExpressionNode(memberExpressionObject, memberExpressionProperty, true);
+            const rightExpression: ESTree.Expression = property.value;
+            const expressionStatementNode: ESTree.ExpressionStatement = Nodes.getExpressionStatementNode(
+                Nodes.getAssignmentExpressionNode('=', memberExpressionNode, rightExpression)
+            );
+
+            /**
+             * Stage 3: recursively processing nested object expressions
+             */
+            if (NodeGuards.isObjectExpressionNode(property.value)) {
+                this.transformObjectExpressionNode(
+                    property.value,
+                    memberExpressionNode,
+                    variableDeclarator
+                );
+            }
+
+            /**
+             * Stage 4: filling arrays
+             */
+            expressionStatements.push(expressionStatementNode);
+            removablePropertyIds.push(i);
+        }
+
+        return [expressionStatements, removablePropertyIds];
+    }
+
+    /**
+     * @param {ObjectExpression} objectExpressionNode
+     * @param {Expression} memberExpressionObjectNode
+     * @param {VariableDeclarator} variableDeclarator
+     * @returns {Node}
+     */
+    private transformObjectExpressionNode (
+        objectExpressionNode: ESTree.ObjectExpression,
+        memberExpressionObjectNode: ESTree.Expression,
+        variableDeclarator: ESTree.VariableDeclarator
+    ): ESTree.Node {
+        const properties: ESTree.Property[] = objectExpressionNode.properties;
+
+        if (!properties.length) {
+            return objectExpressionNode;
+        }
+
+        const scopeNode: ESTree.BlockStatement | undefined = this.cachedScopeNodesMap.get(variableDeclarator);
+
+        if (!scopeNode) {
+            return objectExpressionNode;
+        }
+
+        const [expressionStatements, removablePropertyIds]: [ESTree.ExpressionStatement[], number[]] = this
+            .extractPropertiesToExpressionStatements(properties, memberExpressionObjectNode, variableDeclarator);
+
+        objectExpressionNode.properties = ObjectExpressionKeysTransformer
+            .filterObjectExpressionProperties(properties, removablePropertyIds);
+        ObjectExpressionKeysTransformer
+            .appendExpressionStatements(scopeNode, expressionStatements, variableDeclarator);
+
+        return objectExpressionNode;
+    }
+}

+ 36 - 32
src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts

@@ -4,19 +4,21 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import * as estraverse from 'estraverse';
 import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
-import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
+import { TDeadNodeInjectionCustomNodeFactory } from '../../types/container/custom-nodes/TDeadNodeInjectionCustomNodeFactory';
+import { TNodeWithBlockScope } from '../../types/node/TNodeWithBlockScope';
 
 
+import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { ITransformersRunner } from '../../interfaces/node-transformers/ITransformersRunner';
 import { ITransformersRunner } from '../../interfaces/node-transformers/ITransformersRunner';
 import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
 import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
 
 
+import { DeadCodeInjectionCustomNode } from '../../enums/custom-nodes/DeadCodeInjectionCustomNode';
 import { NodeTransformer } from '../../enums/node-transformers/NodeTransformer';
 import { NodeTransformer } from '../../enums/node-transformers/NodeTransformer';
 import { NodeType } from '../../enums/node/NodeType';
 import { NodeType } from '../../enums/node/NodeType';
 
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { NodeGuards } from '../../node/NodeGuards';
 import { NodeGuards } from '../../node/NodeGuards';
-import { Nodes } from '../../node/Nodes';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
@@ -53,23 +55,32 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
      */
      */
     private collectedBlockStatementsLength: number;
     private collectedBlockStatementsLength: number;
 
 
+    /**
+     * @type {TDeadNodeInjectionCustomNodeFactory}
+     */
+    private readonly deadCodeInjectionCustomNodeFactory: TDeadNodeInjectionCustomNodeFactory;
+
     /**
     /**
      * @type {ITransformersRunner}
      * @type {ITransformersRunner}
      */
      */
     private readonly transformersRunner: ITransformersRunner;
     private readonly transformersRunner: ITransformersRunner;
 
 
     /**
     /**
+     * @param {TControlFlowCustomNodeFactory} deadCodeInjectionCustomNodeFactory
      * @param {ITransformersRunner} transformersRunner
      * @param {ITransformersRunner} transformersRunner
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     constructor (
     constructor (
+        @inject(ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode)
+            deadCodeInjectionCustomNodeFactory: TDeadNodeInjectionCustomNodeFactory,
         @inject(ServiceIdentifiers.ITransformersRunner) transformersRunner: ITransformersRunner,
         @inject(ServiceIdentifiers.ITransformersRunner) transformersRunner: ITransformersRunner,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(randomGenerator, options);
         super(randomGenerator, options);
 
 
+        this.deadCodeInjectionCustomNodeFactory = deadCodeInjectionCustomNodeFactory;
         this.transformersRunner = transformersRunner;
         this.transformersRunner = transformersRunner;
     }
     }
 
 
@@ -112,7 +123,7 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
         estraverse.traverse(programNode, {
         estraverse.traverse(programNode, {
             enter: (node: ESTree.Node): any => {
             enter: (node: ESTree.Node): any => {
                 if (NodeGuards.isBlockStatementNode(node)) {
                 if (NodeGuards.isBlockStatementNode(node)) {
-                    this.collectBlockStatementNodes(node, this.collectedBlockStatements);
+                    this.collectBlockStatementNodes(node, this.collectedBlockStatements, parentNode);
                 }
                 }
             }
             }
         });
         });
@@ -138,7 +149,7 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
             return blockStatementNode;
             return blockStatementNode;
         }
         }
 
 
-        const blockScopeOfBlockStatementNode: TNodeWithBlockStatement = NodeUtils
+        const blockScopeOfBlockStatementNode: TNodeWithBlockScope = NodeUtils
             .getBlockScopesOfNode(blockStatementNode)[0];
             .getBlockScopesOfNode(blockStatementNode)[0];
 
 
         if (blockScopeOfBlockStatementNode.type === NodeType.Program) {
         if (blockScopeOfBlockStatementNode.type === NodeType.Program) {
@@ -154,23 +165,25 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
             return blockStatementNode;
             return blockStatementNode;
         }
         }
 
 
-        return this.replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode);
+        return this.replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode, parentNode);
     }
     }
 
 
     /**
     /**
      * @param {BlockStatement} blockStatementNode
      * @param {BlockStatement} blockStatementNode
      * @param {BlockStatement[]} collectedBlockStatements
      * @param {BlockStatement[]} collectedBlockStatements
+     * @param {Node} parentNode
      */
      */
     private collectBlockStatementNodes (
     private collectBlockStatementNodes (
         blockStatementNode: ESTree.BlockStatement,
         blockStatementNode: ESTree.BlockStatement,
-        collectedBlockStatements: ESTree.BlockStatement[]
+        collectedBlockStatements: ESTree.BlockStatement[],
+        parentNode: ESTree.Node
     ): void {
     ): void {
         let clonedBlockStatementNode: ESTree.BlockStatement = NodeUtils.clone(blockStatementNode),
         let clonedBlockStatementNode: ESTree.BlockStatement = NodeUtils.clone(blockStatementNode),
             nestedBlockStatementsCount: number = 0,
             nestedBlockStatementsCount: number = 0,
             isValidBlockStatementNode: boolean = true;
             isValidBlockStatementNode: boolean = true;
 
 
         estraverse.replace(clonedBlockStatementNode, {
         estraverse.replace(clonedBlockStatementNode, {
-            enter: (node: ESTree.Node, parentNode: ESTree.Node | null): any => {
+            enter: (node: ESTree.Node): any => {
                 /**
                 /**
                  * Count nested block statements in current block statement
                  * Count nested block statements in current block statement
                  */
                  */
@@ -202,6 +215,7 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
         /**
         /**
          * We should transform identifiers in the dead code block statement to avoid conflicts with original code
          * We should transform identifiers in the dead code block statement to avoid conflicts with original code
          */
          */
+        NodeUtils.parentizeNode(clonedBlockStatementNode, parentNode);
         clonedBlockStatementNode = this.transformersRunner.transform(
         clonedBlockStatementNode = this.transformersRunner.transform(
             clonedBlockStatementNode,
             clonedBlockStatementNode,
             DeadCodeInjectionTransformer.transformersToRenameBlockScopeIdentifiers
             DeadCodeInjectionTransformer.transformersToRenameBlockScopeIdentifiers
@@ -213,36 +227,26 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
     /**
     /**
      * @param {BlockStatement} blockStatementNode
      * @param {BlockStatement} blockStatementNode
      * @param {BlockStatement} randomBlockStatementNode
      * @param {BlockStatement} randomBlockStatementNode
+     * @param {Node} parentNode
      * @returns {BlockStatement}
      * @returns {BlockStatement}
      */
      */
     private replaceBlockStatementNode (
     private replaceBlockStatementNode (
         blockStatementNode: ESTree.BlockStatement,
         blockStatementNode: ESTree.BlockStatement,
-        randomBlockStatementNode: ESTree.BlockStatement
+        randomBlockStatementNode: ESTree.BlockStatement,
+        parentNode: ESTree.Node
     ): ESTree.BlockStatement {
     ): ESTree.BlockStatement {
-        const random1: boolean = this.randomGenerator.getMathRandom() > 0.5;
-        const random2: boolean = this.randomGenerator.getMathRandom() > 0.5;
-
-        const operator: ESTree.BinaryOperator = random1 ? '===' : '!==';
-        const leftString: string = this.randomGenerator.getRandomString(3);
-        const rightString: string = random2 ? leftString : this.randomGenerator.getRandomString(3);
-
-        const [consequent, alternate]: [ESTree.BlockStatement, ESTree.BlockStatement] = random1 === random2
-            ? [blockStatementNode, randomBlockStatementNode]
-            : [randomBlockStatementNode, blockStatementNode];
-
-        let newBlockStatementNode: ESTree.BlockStatement = Nodes.getBlockStatementNode([
-            Nodes.getIfStatementNode(
-                Nodes.getBinaryExpressionNode(
-                    operator,
-                    Nodes.getLiteralNode(leftString),
-                    Nodes.getLiteralNode(rightString)
-                ),
-                consequent,
-                alternate
-            )
-        ]);
-
-        newBlockStatementNode = NodeUtils.parentize(newBlockStatementNode);
+        const blockStatementDeadCodeInjectionCustomNode: ICustomNode = this.deadCodeInjectionCustomNodeFactory(
+            DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode
+        );
+
+        blockStatementDeadCodeInjectionCustomNode.initialize(
+            blockStatementNode,
+            randomBlockStatementNode
+        );
+
+        const newBlockStatementNode: ESTree.BlockStatement = <ESTree.BlockStatement>blockStatementDeadCodeInjectionCustomNode.getNode()[0];
+
+        NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
 
 
         return newBlockStatementNode;
         return newBlockStatementNode;
     }
     }

+ 6 - 6
src/node-transformers/obfuscating-transformers/ClassDeclarationTransformer.ts

@@ -5,7 +5,7 @@ import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
 import { TIdentifierObfuscatingReplacerFactory } from "../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory";
 import { TIdentifierObfuscatingReplacerFactory } from "../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory";
-import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../types/node/TNodeWithBlockScope';
 
 
 import { IIdentifierObfuscatingReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/IIdentifierObfuscatingReplacer';
 import { IIdentifierObfuscatingReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/IIdentifierObfuscatingReplacer';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
@@ -78,7 +78,7 @@ export class ClassDeclarationTransformer extends AbstractNodeTransformer {
      */
      */
     public transformNode (classDeclarationNode: ESTree.ClassDeclaration, parentNode: ESTree.Node): ESTree.Node {
     public transformNode (classDeclarationNode: ESTree.ClassDeclaration, parentNode: ESTree.Node): ESTree.Node {
         const nodeIdentifier: number = this.nodeIdentifier++;
         const nodeIdentifier: number = this.nodeIdentifier++;
-        const blockScopeNode: TNodeWithBlockStatement = NodeUtils
+        const blockScopeNode: TNodeWithBlockScope = NodeUtils
             .getBlockScopesOfNode(classDeclarationNode)[0];
             .getBlockScopesOfNode(classDeclarationNode)[0];
 
 
         if (!this.options.renameGlobals && blockScopeNode.type === NodeType.Program) {
         if (!this.options.renameGlobals && blockScopeNode.type === NodeType.Program) {
@@ -106,10 +106,10 @@ export class ClassDeclarationTransformer extends AbstractNodeTransformer {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {number} nodeIdentifier
      * @param {number} nodeIdentifier
      */
      */
-    private replaceScopeCachedIdentifiers (blockScopeNode: TNodeWithBlockStatement, nodeIdentifier: number): void {
+    private replaceScopeCachedIdentifiers (blockScopeNode: TNodeWithBlockScope, nodeIdentifier: number): void {
         const cachedReplaceableIdentifiers: ESTree.Identifier[] = <ESTree.Identifier[]>this.replaceableIdentifiers.get(blockScopeNode);
         const cachedReplaceableIdentifiers: ESTree.Identifier[] = <ESTree.Identifier[]>this.replaceableIdentifiers.get(blockScopeNode);
 
 
         cachedReplaceableIdentifiers.forEach((replaceableIdentifier: ESTree.Identifier) => {
         cachedReplaceableIdentifiers.forEach((replaceableIdentifier: ESTree.Identifier) => {
@@ -121,10 +121,10 @@ export class ClassDeclarationTransformer extends AbstractNodeTransformer {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {number} nodeIdentifier
      * @param {number} nodeIdentifier
      */
      */
-    private replaceScopeIdentifiers (blockScopeNode: TNodeWithBlockStatement, nodeIdentifier: number): void {
+    private replaceScopeIdentifiers (blockScopeNode: TNodeWithBlockScope, nodeIdentifier: number): void {
         const storedReplaceableIdentifiers: ESTree.Identifier[] = [];
         const storedReplaceableIdentifiers: ESTree.Identifier[] = [];
 
 
         estraverse.replace(blockScopeNode, {
         estraverse.replace(blockScopeNode, {

+ 6 - 6
src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts

@@ -5,7 +5,7 @@ import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
 import { TIdentifierObfuscatingReplacerFactory } from "../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory";
 import { TIdentifierObfuscatingReplacerFactory } from "../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory";
-import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../types/node/TNodeWithBlockScope';
 import { TReplaceableIdentifiers } from '../../types/node-transformers/TReplaceableIdentifiers';
 import { TReplaceableIdentifiers } from '../../types/node-transformers/TReplaceableIdentifiers';
 import { TReplaceableIdentifiersNames } from '../../types/node-transformers/TReplaceableIdentifiersNames';
 import { TReplaceableIdentifiersNames } from '../../types/node-transformers/TReplaceableIdentifiersNames';
 
 
@@ -80,7 +80,7 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer {
      */
      */
     public transformNode (functionDeclarationNode: ESTree.FunctionDeclaration, parentNode: ESTree.Node): ESTree.Node {
     public transformNode (functionDeclarationNode: ESTree.FunctionDeclaration, parentNode: ESTree.Node): ESTree.Node {
         const nodeIdentifier: number = this.nodeIdentifier++;
         const nodeIdentifier: number = this.nodeIdentifier++;
-        const blockScopeNode: TNodeWithBlockStatement = NodeUtils
+        const blockScopeNode: TNodeWithBlockScope = NodeUtils
             .getBlockScopesOfNode(functionDeclarationNode)[0];
             .getBlockScopesOfNode(functionDeclarationNode)[0];
 
 
         if (!this.options.renameGlobals && blockScopeNode.type === NodeType.Program) {
         if (!this.options.renameGlobals && blockScopeNode.type === NodeType.Program) {
@@ -109,12 +109,12 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer {
 
 
     /**
     /**
      * @param {FunctionDeclaration} functionDeclarationNode
      * @param {FunctionDeclaration} functionDeclarationNode
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {number} nodeIdentifier
      * @param {number} nodeIdentifier
      */
      */
     private replaceScopeCachedIdentifiers (
     private replaceScopeCachedIdentifiers (
         functionDeclarationNode: ESTree.FunctionDeclaration,
         functionDeclarationNode: ESTree.FunctionDeclaration,
-        blockScopeNode: TNodeWithBlockStatement,
+        blockScopeNode: TNodeWithBlockScope,
         nodeIdentifier: number
         nodeIdentifier: number
     ): void {
     ): void {
         const cachedReplaceableIdentifiersNamesMap: TReplaceableIdentifiersNames | undefined = this.replaceableIdentifiers.get(blockScopeNode);
         const cachedReplaceableIdentifiersNamesMap: TReplaceableIdentifiersNames | undefined = this.replaceableIdentifiers.get(blockScopeNode);
@@ -142,10 +142,10 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {number} nodeIdentifier
      * @param {number} nodeIdentifier
      */
      */
-    private replaceScopeIdentifiers (blockScopeNode: TNodeWithBlockStatement, nodeIdentifier: number): void {
+    private replaceScopeIdentifiers (blockScopeNode: TNodeWithBlockScope, nodeIdentifier: number): void {
         const storedReplaceableIdentifiersNamesMap: TReplaceableIdentifiersNames = new Map();
         const storedReplaceableIdentifiersNamesMap: TReplaceableIdentifiersNames = new Map();
 
 
         estraverse.replace(blockScopeNode, {
         estraverse.replace(blockScopeNode, {

+ 2 - 2
src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts

@@ -5,7 +5,7 @@ import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
 import { TIdentifierObfuscatingReplacerFactory } from '../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory';
 import { TIdentifierObfuscatingReplacerFactory } from '../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory';
-import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../types/node/TNodeWithBlockScope';
 import { TReplaceableIdentifiers } from '../../types/node-transformers/TReplaceableIdentifiers';
 import { TReplaceableIdentifiers } from '../../types/node-transformers/TReplaceableIdentifiers';
 import { TReplaceableIdentifiersNames } from '../../types/node-transformers/TReplaceableIdentifiersNames';
 import { TReplaceableIdentifiersNames } from '../../types/node-transformers/TReplaceableIdentifiersNames';
 
 
@@ -80,7 +80,7 @@ export class VariableDeclarationTransformer extends AbstractNodeTransformer {
      * @returns {NodeGuards}
      * @returns {NodeGuards}
      */
      */
     public transformNode (variableDeclarationNode: ESTree.VariableDeclaration, parentNode: ESTree.Node): ESTree.Node {
     public transformNode (variableDeclarationNode: ESTree.VariableDeclaration, parentNode: ESTree.Node): ESTree.Node {
-        const blockScopeNode: TNodeWithBlockStatement = NodeUtils
+        const blockScopeNode: TNodeWithBlockScope = NodeUtils
             .getBlockScopesOfNode(variableDeclarationNode)[0];
             .getBlockScopesOfNode(variableDeclarationNode)[0];
 
 
         if (!this.options.renameGlobals && blockScopeNode.type === NodeType.Program) {
         if (!this.options.renameGlobals && blockScopeNode.type === NodeType.Program) {

+ 15 - 15
src/node/NodeAppender.ts

@@ -1,6 +1,6 @@
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
-import { TNodeWithBlockStatement } from '../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../types/node/TNodeWithBlockScope';
 import { TStatement } from '../types/node/TStatement';
 import { TStatement } from '../types/node/TStatement';
 
 
 import { IStackTraceData } from '../interfaces/analyzers/stack-trace-analyzer/IStackTraceData';
 import { IStackTraceData } from '../interfaces/analyzers/stack-trace-analyzer/IStackTraceData';
@@ -24,38 +24,38 @@ import { IStackTraceData } from '../interfaces/analyzers/stack-trace-analyzer/IS
  */
  */
 export class NodeAppender {
 export class NodeAppender {
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} scopeNode
      * @param {TStatement[]} nodeBodyStatements
      * @param {TStatement[]} nodeBodyStatements
      */
      */
     public static appendNode (
     public static appendNode (
-        blockScopeNode: TNodeWithBlockStatement,
+        scopeNode: TNodeWithBlockScope,
         nodeBodyStatements: TStatement[]
         nodeBodyStatements: TStatement[]
     ): void {
     ): void {
         if (!NodeAppender.validateBodyStatements(nodeBodyStatements)) {
         if (!NodeAppender.validateBodyStatements(nodeBodyStatements)) {
             nodeBodyStatements = [];
             nodeBodyStatements = [];
         }
         }
 
 
-        nodeBodyStatements = NodeAppender.parentizeBodyStatementsBeforeAppend(blockScopeNode, nodeBodyStatements);
+        nodeBodyStatements = NodeAppender.parentizeBodyStatementsBeforeAppend(scopeNode, nodeBodyStatements);
 
 
-        blockScopeNode.body = [
-            ...blockScopeNode.body,
+        scopeNode.body = [
+            ...scopeNode.body,
             ...nodeBodyStatements
             ...nodeBodyStatements
         ];
         ];
     }
     }
 
 
     /**
     /**
      * @param {IStackTraceData[]} blockScopeStackTraceData
      * @param {IStackTraceData[]} blockScopeStackTraceData
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {TStatement[]} nodeBodyStatements
      * @param {TStatement[]} nodeBodyStatements
      * @param {number} index
      * @param {number} index
      */
      */
     public static appendNodeToOptimalBlockScope (
     public static appendNodeToOptimalBlockScope (
         blockScopeStackTraceData: IStackTraceData[],
         blockScopeStackTraceData: IStackTraceData[],
-        blockScopeNode: TNodeWithBlockStatement,
+        blockScopeNode: TNodeWithBlockScope,
         nodeBodyStatements: TStatement[],
         nodeBodyStatements: TStatement[],
         index: number = 0
         index: number = 0
     ): void {
     ): void {
-        let targetBlockScope: TNodeWithBlockStatement;
+        let targetBlockScope: TNodeWithBlockScope;
 
 
         if (!blockScopeStackTraceData.length) {
         if (!blockScopeStackTraceData.length) {
             targetBlockScope = blockScopeNode;
             targetBlockScope = blockScopeNode;
@@ -96,12 +96,12 @@ export class NodeAppender {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {TStatement[]} nodeBodyStatements
      * @param {TStatement[]} nodeBodyStatements
      * @param {number} index
      * @param {number} index
      */
      */
     public static insertNodeAtIndex (
     public static insertNodeAtIndex (
-        blockScopeNode: TNodeWithBlockStatement,
+        blockScopeNode: TNodeWithBlockScope,
         nodeBodyStatements: TStatement[],
         nodeBodyStatements: TStatement[],
         index: number
         index: number
     ): void {
     ): void {
@@ -119,11 +119,11 @@ export class NodeAppender {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {TStatement[]} nodeBodyStatements
      * @param {TStatement[]} nodeBodyStatements
      */
      */
     public static prependNode (
     public static prependNode (
-        blockScopeNode: TNodeWithBlockStatement,
+        blockScopeNode: TNodeWithBlockScope,
         nodeBodyStatements: TStatement[]
         nodeBodyStatements: TStatement[]
     ): void {
     ): void {
         if (!NodeAppender.validateBodyStatements(nodeBodyStatements)) {
         if (!NodeAppender.validateBodyStatements(nodeBodyStatements)) {
@@ -139,12 +139,12 @@ export class NodeAppender {
     }
     }
 
 
     /**
     /**
-     * @param {TNodeWithBlockStatement} blockScopeNode
+     * @param {TNodeWithBlockScope} blockScopeNode
      * @param {TStatement[]} nodeBodyStatements
      * @param {TStatement[]} nodeBodyStatements
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
     private static parentizeBodyStatementsBeforeAppend (
     private static parentizeBodyStatementsBeforeAppend (
-        blockScopeNode: TNodeWithBlockStatement,
+        blockScopeNode: TNodeWithBlockScope,
         nodeBodyStatements: TStatement[]
         nodeBodyStatements: TStatement[]
     ): TStatement[] {
     ): TStatement[] {
         nodeBodyStatements.forEach((statement: TStatement) => {
         nodeBodyStatements.forEach((statement: TStatement) => {

+ 57 - 3
src/node/NodeGuards.ts

@@ -1,10 +1,29 @@
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
-import { TNodeWithBlockStatement } from '../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../types/node/TNodeWithBlockScope';
+import { TNodeWithScope } from '../types/node/TNodeWithScope';
 
 
 import { NodeType } from '../enums/node/NodeType';
 import { NodeType } from '../enums/node/NodeType';
 
 
 export class NodeGuards {
 export class NodeGuards {
+    /**
+     * @type {string[]}
+     */
+    private static readonly nodesWithBlockScope: string[] = [
+        NodeType.ArrowFunctionExpression,
+        NodeType.FunctionDeclaration,
+        NodeType.FunctionExpression,
+        NodeType.MethodDefinition,
+    ];
+
+    /**
+     * @param {Node} node
+     * @returns {boolean}
+     */
+    public static isArrayPatternNode (node: ESTree.Node): node is ESTree.ArrayPattern {
+        return node.type === NodeType.ArrayPattern;
+    }
+
     /**
     /**
      * @param {Node} node
      * @param {Node} node
      * @returns {boolean}
      * @returns {boolean}
@@ -174,8 +193,27 @@ export class NodeGuards {
      * @param {Node} node
      * @param {Node} node
      * @returns {boolean}
      * @returns {boolean}
      */
      */
-    public static isNodeHasBlockStatement (node: ESTree.Node): node is TNodeWithBlockStatement {
-        return Array.isArray((<TNodeWithBlockStatement>node).body);
+    public static isNodeHasBlockScope (node: ESTree.Node): node is TNodeWithBlockScope {
+        const parentNode: ESTree.Node | undefined = node.parentNode;
+
+        if (!parentNode) {
+            return false;
+        }
+
+        return NodeGuards.isProgramNode(node) || (
+            NodeGuards.isBlockStatementNode(node)
+            && NodeGuards.nodesWithBlockScope.includes(parentNode.type)
+        );
+    }
+
+    /**
+     * @param {Node} node
+     * @returns {boolean}
+     */
+    public static isNodeHasScope (node: ESTree.Node): node is TNodeWithScope {
+        return NodeGuards.isProgramNode(node)
+            || NodeGuards.isBlockStatementNode(node)
+            || NodeGuards.isSwitchCaseNode(node);
     }
     }
 
 
     /**
     /**
@@ -245,6 +283,14 @@ export class NodeGuards {
             !NodeGuards.isLabelIdentifierNode(node, parentNode);
             !NodeGuards.isLabelIdentifierNode(node, parentNode);
     }
     }
 
 
+    /**
+     * @param {Node} node
+     * @returns {boolean}
+     */
+    public static isRestElementNode (node: ESTree.Node): node is ESTree.RestElement {
+        return node.type === NodeType.RestElement;
+    }
+
     /**
     /**
      * @param {Node} node
      * @param {Node} node
      * @returns {boolean}
      * @returns {boolean}
@@ -261,6 +307,14 @@ export class NodeGuards {
         return node.type === NodeType.Super;
         return node.type === NodeType.Super;
     }
     }
 
 
+    /**
+     * @param {Node} node
+     * @returns {boolean}
+     */
+    public static isSwitchCaseNode (node: ESTree.Node): node is ESTree.SwitchCase {
+        return node.type === NodeType.SwitchCase;
+    }
+
     /**
     /**
      * @param {Node} node
      * @param {Node} node
      * @returns {boolean}
      * @returns {boolean}

+ 14 - 54
src/node/NodeUtils.ts

@@ -3,26 +3,14 @@ import * as esprima from 'esprima';
 import * as estraverse from 'estraverse';
 import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
-import { TNodeWithBlockStatement } from '../types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../types/node/TNodeWithBlockScope';
+import { TNodeWithScope } from '../types/node/TNodeWithScope';
 import { TObject } from '../types/TObject';
 import { TObject } from '../types/TObject';
 import { TStatement } from '../types/node/TStatement';
 import { TStatement } from '../types/node/TStatement';
 
 
-import { NodeType } from '../enums/node/NodeType';
-
 import { NodeGuards } from './NodeGuards';
 import { NodeGuards } from './NodeGuards';
 
 
 export class NodeUtils {
 export class NodeUtils {
-    /**
-     * @type {string[]}
-     */
-    private static readonly nodesWithBlockScope: string[] = [
-        NodeType.ArrowFunctionExpression,
-        NodeType.FunctionDeclaration,
-        NodeType.FunctionExpression,
-        NodeType.MethodDefinition,
-        NodeType.Program
-    ];
-
     /**
     /**
      * @param {T} astTree
      * @param {T} astTree
      * @returns {T}
      * @returns {T}
@@ -115,48 +103,25 @@ export class NodeUtils {
 
 
     /**
     /**
      * @param {NodeGuards} node
      * @param {NodeGuards} node
-     * @param {number} index
-     * @returns {NodeGuards}
+     * @param {TNodeWithBlockScope[]} blockScopes
+     * @returns {TNodeWithBlockScope[]}
      */
      */
-    public static getBlockStatementNodeByIndex (node: ESTree.Node, index: number = 0): ESTree.Node {
-        if (!NodeGuards.isNodeHasBlockStatement(node)) {
-            throw new TypeError('The specified node have no a block-statement');
-        }
-
-        if (node.body[index] === undefined) {
-            throw new ReferenceError(`Wrong index \`${index}\`. Block-statement body length is \`${node.body.length}\``);
-        }
-
-        return node.body[index];
-    }
-
-    /**
-     * @param {NodeGuards} node
-     * @param {TNodeWithBlockStatement[]} blockScopes
-     * @returns {TNodeWithBlockStatement[]}
-     */
-    public static getBlockScopesOfNode (node: ESTree.Node, blockScopes: TNodeWithBlockStatement[] = []): TNodeWithBlockStatement[] {
+    public static getBlockScopesOfNode (node: ESTree.Node, blockScopes: TNodeWithBlockScope[] = []): TNodeWithBlockScope[] {
         const parentNode: ESTree.Node | undefined = node.parentNode;
         const parentNode: ESTree.Node | undefined = node.parentNode;
 
 
         if (!parentNode) {
         if (!parentNode) {
             throw new ReferenceError('`parentNode` property of given node is `undefined`');
             throw new ReferenceError('`parentNode` property of given node is `undefined`');
         }
         }
 
 
-        if (NodeGuards.isBlockStatementNode(parentNode)) {
-            if (!parentNode.parentNode) {
-                throw new ReferenceError('`parentNode` property of `parentNode` of given node is `undefined`');
-            }
-
-            if (NodeUtils.nodesWithBlockScope.includes(parentNode.parentNode.type)) {
-                blockScopes.push(parentNode);
-            }
+        if (NodeGuards.isBlockStatementNode(parentNode) && NodeGuards.isNodeHasBlockScope(parentNode)) {
+            blockScopes.push(parentNode);
         }
         }
 
 
         if (node !== parentNode) {
         if (node !== parentNode) {
             return NodeUtils.getBlockScopesOfNode(parentNode, blockScopes);
             return NodeUtils.getBlockScopesOfNode(parentNode, blockScopes);
         }
         }
 
 
-        if (NodeGuards.isNodeHasBlockStatement(parentNode)) {
+        if (NodeGuards.isNodeHasBlockScope(parentNode)) {
             blockScopes.push(parentNode);
             blockScopes.push(parentNode);
         }
         }
 
 
@@ -165,25 +130,20 @@ export class NodeUtils {
 
 
     /**
     /**
      * @param {NodeGuards} node
      * @param {NodeGuards} node
-     * @param {number} depth
-     * @returns {number}
+     * @returns {TNodeWithScope}
      */
      */
-    public static getNodeBlockScopeDepth (node: ESTree.Node, depth: number = 0): number {
+    public static getScopeOfNode (node: ESTree.Node): TNodeWithScope {
         const parentNode: ESTree.Node | undefined = node.parentNode;
         const parentNode: ESTree.Node | undefined = node.parentNode;
 
 
         if (!parentNode) {
         if (!parentNode) {
             throw new ReferenceError('`parentNode` property of given node is `undefined`');
             throw new ReferenceError('`parentNode` property of given node is `undefined`');
         }
         }
 
 
-        if (NodeGuards.isProgramNode(parentNode)) {
-            return depth;
+        if (!NodeGuards.isNodeHasScope(parentNode)) {
+            return NodeUtils.getScopeOfNode(parentNode);
         }
         }
 
 
-        if (NodeGuards.isBlockStatementNode(node) && NodeUtils.nodesWithBlockScope.includes(parentNode.type)) {
-            return NodeUtils.getNodeBlockScopeDepth(parentNode, ++depth);
-        }
-
-        return NodeUtils.getNodeBlockScopeDepth(parentNode, depth);
+        return parentNode;
     }
     }
 
 
     /**
     /**
@@ -203,7 +163,7 @@ export class NodeUtils {
      * @returns {T}
      * @returns {T}
      */
      */
     public static parentize <T extends ESTree.Node = ESTree.Node> (astTree: T): T {
     public static parentize <T extends ESTree.Node = ESTree.Node> (astTree: T): T {
-        estraverse.traverse(astTree, {
+        estraverse.replace(astTree, {
             enter: NodeUtils.parentizeNode
             enter: NodeUtils.parentizeNode
         });
         });
 
 

+ 6 - 0
src/options/Options.ts

@@ -206,6 +206,12 @@ export class Options implements IOptions {
     @IsIn([ObfuscationTarget.Browser, ObfuscationTarget.Extension, ObfuscationTarget.Node])
     @IsIn([ObfuscationTarget.Browser, ObfuscationTarget.Extension, ObfuscationTarget.Node])
     public readonly target: ObfuscationTarget;
     public readonly target: ObfuscationTarget;
 
 
+    /**
+     * @type {boolean}
+     */
+    @IsBoolean()
+    public readonly transformObjectKeys: boolean;
+
     /**
     /**
      * @type {boolean}
      * @type {boolean}
      */
      */

+ 1 - 0
src/options/presets/Default.ts

@@ -30,5 +30,6 @@ export const DEFAULT_PRESET: TInputOptions = Object.freeze({
     stringArrayEncoding: false,
     stringArrayEncoding: false,
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
     target: ObfuscationTarget.Browser,
     target: ObfuscationTarget.Browser,
+    transformObjectKeys: false,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
 });
 });

+ 2 - 1
src/options/presets/NoCustomNodes.ts

@@ -4,7 +4,7 @@ import { IdentifierNamesGenerator } from '../../enums/generators/identifier-name
 import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 import { SourceMapMode } from '../../enums/source-map/SourceMapMode';
 import { SourceMapMode } from '../../enums/source-map/SourceMapMode';
 
 
-export const NO_CUSTOM_NODES_PRESET: TInputOptions = Object.freeze({
+export const NO_ADDITIONAL_NODES_PRESET: TInputOptions = Object.freeze({
     compact: true,
     compact: true,
     controlFlowFlattening: false,
     controlFlowFlattening: false,
     controlFlowFlatteningThreshold: 0,
     controlFlowFlatteningThreshold: 0,
@@ -29,5 +29,6 @@ export const NO_CUSTOM_NODES_PRESET: TInputOptions = Object.freeze({
     stringArrayEncoding: false,
     stringArrayEncoding: false,
     stringArrayThreshold: 0,
     stringArrayThreshold: 0,
     target: ObfuscationTarget.Browser,
     target: ObfuscationTarget.Browser,
+    transformObjectKeys: false,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
 });
 });

+ 5 - 0
src/types/container/custom-nodes/TDeadNodeInjectionCustomNodeFactory.d.ts

@@ -0,0 +1,5 @@
+import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
+
+import { DeadCodeInjectionCustomNode } from '../../../enums/custom-nodes/DeadCodeInjectionCustomNode';
+
+export type TDeadNodeInjectionCustomNodeFactory = (deadCodeInjectionCustomNodeName: DeadCodeInjectionCustomNode) => ICustomNode;

+ 3 - 0
src/types/node/TNodeWithBlockScope.d.ts

@@ -0,0 +1,3 @@
+import * as ESTree from 'estree';
+
+export type TNodeWithBlockScope = ESTree.Program | ESTree.BlockStatement;

+ 0 - 3
src/types/node/TNodeWithBlockStatement.d.ts

@@ -1,3 +0,0 @@
-import * as ESTree from 'estree';
-
-export type TNodeWithBlockStatement = ESTree.BlockStatement | ESTree.Program;

+ 3 - 0
src/types/node/TNodeWithScope.d.ts

@@ -0,0 +1,3 @@
+import * as ESTree from 'estree';
+
+export type TNodeWithScope = ESTree.Program | ESTree.BlockStatement | ESTree.SwitchCase;

+ 11 - 25
test/dev/dev.ts

@@ -1,5 +1,5 @@
 'use strict';
 'use strict';
-import { NO_CUSTOM_NODES_PRESET } from '../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNodes';
 
 
 (function () {
 (function () {
     const JavaScriptObfuscator: any = require('../../index');
     const JavaScriptObfuscator: any = require('../../index');
@@ -7,34 +7,20 @@ import { NO_CUSTOM_NODES_PRESET } from '../../src/options/presets/NoCustomNodes'
     let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
     let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
         `
         `
         (function(){
         (function(){
-            if (true) {
-                var foo = function () {
-                    console.log('abc');
-                };
-                var bar = function () {
-                    console.log('def');
-                };
-                var baz = function () {
-                    console.log('ghi');
-                };
-                var bark = function () {
-                    console.log('jkl');
-                };
-                var hawk = function () {
-                    console.log('mno');
-                };
-            
-                foo();
-                bar();
-                baz();
-                bark();
-                hawk();
-            }
+            var object = {
+                foo: 'test1',
+                bar: {
+                    baz: 'test2'
+                }
+            };
         })();
         })();
         `,
         `,
         {
         {
-            ...NO_CUSTOM_NODES_PRESET,
+            ...NO_ADDITIONAL_NODES_PRESET,
             compact: false,
             compact: false,
+            transformObjectKeys: true,
+            stringArray: true,
+            stringArrayThreshold: 1
         }
         }
     ).getObfuscatedCode();
     ).getObfuscatedCode();
 
 

+ 11 - 11
test/functional-tests/analyzers/stack-trace-analyzer/StackTraceAnalyzer.spec.ts

@@ -7,7 +7,7 @@ import * as ESTree from 'estree';
 
 
 import { assert } from 'chai';
 import { assert } from 'chai';
 
 
-import { TNodeWithBlockStatement } from '../../../../src/types/node/TNodeWithBlockStatement';
+import { TNodeWithBlockScope } from '../../../../src/types/node/TNodeWithBlockScope';
 
 
 import { IInversifyContainerFacade } from '../../../../src/interfaces/container/IInversifyContainerFacade';
 import { IInversifyContainerFacade } from '../../../../src/interfaces/container/IInversifyContainerFacade';
 import { IStackTraceAnalyzer } from '../../../../src/interfaces/analyzers/stack-trace-analyzer/IStackTraceAnalyzer';
 import { IStackTraceAnalyzer } from '../../../../src/interfaces/analyzers/stack-trace-analyzer/IStackTraceAnalyzer';
@@ -165,7 +165,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #1: basic-1', () => {
         describe('variant #1: basic-1', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/basic-1.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/basic-1.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -215,7 +215,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #2: basic-2', () => {
         describe('variant #2: basic-2', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/basic-2.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/basic-2.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -254,7 +254,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #3: deep conditions nesting', () => {
         describe('variant #3: deep conditions nesting', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/deep-conditions-nesting.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/deep-conditions-nesting.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -293,7 +293,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #4: call before declaration', () => {
         describe('variant #4: call before declaration', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/call-before-declaration.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/call-before-declaration.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -316,7 +316,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #5: call expression of object member #1', () => {
         describe('variant #5: call expression of object member #1', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/call-expression-of-object-member-1.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/call-expression-of-object-member-1.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -375,7 +375,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #5: call expression of object member #2', () => {
         describe('variant #5: call expression of object member #2', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/call-expression-of-object-member-2.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/call-expression-of-object-member-2.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -403,7 +403,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #6: no call expressions', () => {
         describe('variant #6: no call expressions', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/no-call-expressions.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/no-call-expressions.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -420,7 +420,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #7: only call expression', () => {
         describe('variant #7: only call expression', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/only-call-expression.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/only-call-expression.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -437,7 +437,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #8: self-invoking functions', () => {
         describe('variant #8: self-invoking functions', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/self-invoking-functions.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/self-invoking-functions.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 
@@ -472,7 +472,7 @@ describe('StackTraceAnalyzer', () => {
         describe('variant #9: no recursion', () => {
         describe('variant #9: no recursion', () => {
             before(() => {
             before(() => {
                 const code: string = readFileAsString(__dirname + '/fixtures/no-recursion.js');
                 const code: string = readFileAsString(__dirname + '/fixtures/no-recursion.js');
-                const astTree: TNodeWithBlockStatement = Nodes.getProgramNode(
+                const astTree: TNodeWithBlockScope = Nodes.getProgramNode(
                     NodeUtils.convertCodeToStructure(code)
                     NodeUtils.convertCodeToStructure(code)
                 );
                 );
 
 

+ 3 - 3
test/functional-tests/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
@@ -21,7 +21,7 @@ describe('ConsoleOutputDisableExpressionNode', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     disableConsoleOutput: true
                     disableConsoleOutput: true
                 }
                 }
             );
             );
@@ -50,7 +50,7 @@ describe('ConsoleOutputDisableExpressionNode', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     disableConsoleOutput: false
                     disableConsoleOutput: false
                 }
                 }
             );
             );

+ 3 - 3
test/functional-tests/custom-nodes/domain-lock-nodes/DomainLockNode.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
@@ -19,7 +19,7 @@ describe('DomainLockNode', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     domainLock: ['.example.com']
                     domainLock: ['.example.com']
                 }
                 }
             );
             );
@@ -40,7 +40,7 @@ describe('DomainLockNode', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     domainLock: []
                     domainLock: []
                 }
                 }
             );
             );

+ 3 - 3
test/functional-tests/custom-nodes/string-array-nodes/StringArrayCallsWrapper.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
@@ -20,7 +20,7 @@ describe('StringArrayCallsWrapper', () => {
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1
                 }
                 }
@@ -43,7 +43,7 @@ describe('StringArrayCallsWrapper', () => {
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: false
                     stringArray: false
                 }
                 }
             );
             );

+ 3 - 3
test/functional-tests/custom-nodes/string-array-nodes/StringArrayNode.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
@@ -20,7 +20,7 @@ describe('StringArrayNode', () => {
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1
                 }
                 }
@@ -43,7 +43,7 @@ describe('StringArrayNode', () => {
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: false
                     stringArray: false
                 }
                 }
             );
             );

+ 3 - 3
test/functional-tests/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
@@ -20,7 +20,7 @@ describe('StringArrayRotateFunctionNode', () => {
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     rotateStringArray: true,
                     rotateStringArray: true,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1
@@ -44,7 +44,7 @@ describe('StringArrayRotateFunctionNode', () => {
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     rotateStringArray: false,
                     rotateStringArray: false,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1

+ 10 - 9
test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts

@@ -7,7 +7,7 @@ import { StringArrayEncoding } from '../../../src/enums/StringArrayEncoding';
 
 
 import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes';
 
 
 import { IdentifierNamesGenerator } from '../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
 import { IdentifierNamesGenerator } from '../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
 
 
@@ -26,7 +26,7 @@ describe('JavaScriptObfuscator', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -91,7 +91,7 @@ describe('JavaScriptObfuscator', () => {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             sourceMap: true
                             sourceMap: true
                         }
                         }
                     );
                     );
@@ -120,7 +120,7 @@ describe('JavaScriptObfuscator', () => {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             sourceMap: true,
                             sourceMap: true,
                             sourceMapMode: SourceMapMode.Inline
                             sourceMapMode: SourceMapMode.Inline
                         }
                         }
@@ -195,7 +195,7 @@ describe('JavaScriptObfuscator', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -217,7 +217,7 @@ describe('JavaScriptObfuscator', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -240,7 +240,7 @@ describe('JavaScriptObfuscator', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -269,7 +269,7 @@ describe('JavaScriptObfuscator', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -438,7 +438,7 @@ describe('JavaScriptObfuscator', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -494,6 +494,7 @@ describe('JavaScriptObfuscator', () => {
                         stringArray: true,
                         stringArray: true,
                         stringArrayEncoding: StringArrayEncoding.Rc4,
                         stringArrayEncoding: StringArrayEncoding.Rc4,
                         stringArrayThreshold: 1,
                         stringArrayThreshold: 1,
+                        transformObjectKeys: true,
                         unicodeEscapeSequence: false
                         unicodeEscapeSequence: false
                     }
                     }
                 );
                 );

+ 16 - 15
test/functional-tests/node-transformers/control-flow-transformers/block-statement-control-flow-transformer/BlockStatementControlFlowTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
@@ -29,13 +29,14 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
                 );
                 );
 
 
                 obfuscatedCode = obfuscationResult.getObfuscatedCode();
                 obfuscatedCode = obfuscationResult.getObfuscatedCode();
+                console.log(obfuscatedCode);
             });
             });
 
 
             describe('`console.log` statements', ()=> {
             describe('`console.log` statements', ()=> {
@@ -117,7 +118,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1,
                         controlFlowFlatteningThreshold: 1,
                         unicodeEscapeSequence: false
                         unicodeEscapeSequence: false
@@ -208,7 +209,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -232,7 +233,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -256,7 +257,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -280,7 +281,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -304,7 +305,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -331,7 +332,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -360,7 +361,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -384,7 +385,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -411,7 +412,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -440,7 +441,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -471,7 +472,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code.repeat(samples),
                     code.repeat(samples),
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: controlFlowFlatteningThreshold,
                         controlFlowFlatteningThreshold: controlFlowFlatteningThreshold,
                     }
                     }
@@ -513,7 +514,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }

+ 3 - 3
test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/binary-expression-control-flow-replacer/BinaryExpressionControlFlowReplacer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 
@@ -22,7 +22,7 @@ describe('BinaryExpressionControlFlowReplacer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -64,7 +64,7 @@ describe('BinaryExpressionControlFlowReplacer', function () {
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             controlFlowFlattening: true,
                             controlFlowFlattening: true,
                             controlFlowFlatteningThreshold: 1
                             controlFlowFlatteningThreshold: 1
                         }
                         }

+ 4 - 4
test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/call-expression-control-flow-replacer/CallExpressionControlFlowReplacer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 
@@ -22,7 +22,7 @@ describe('CallExpressionControlFlowReplacer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -64,7 +64,7 @@ describe('CallExpressionControlFlowReplacer', function () {
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             controlFlowFlattening: true,
                             controlFlowFlattening: true,
                             controlFlowFlatteningThreshold: 1
                             controlFlowFlatteningThreshold: 1
                         }
                         }
@@ -111,7 +111,7 @@ describe('CallExpressionControlFlowReplacer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }

+ 5 - 5
test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/logical-expression-control-flow-replacer/LogicalExpressionControlFlowReplacer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 
@@ -22,7 +22,7 @@ describe('LogicalExpressionControlFlowReplacer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -64,7 +64,7 @@ describe('LogicalExpressionControlFlowReplacer', function () {
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             controlFlowFlattening: true,
                             controlFlowFlattening: true,
                             controlFlowFlatteningThreshold: 1
                             controlFlowFlatteningThreshold: 1
                         }
                         }
@@ -111,7 +111,7 @@ describe('LogicalExpressionControlFlowReplacer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -135,7 +135,7 @@ describe('LogicalExpressionControlFlowReplacer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: .1
                         controlFlowFlatteningThreshold: .1
                     }
                     }

+ 2 - 2
test/functional-tests/node-transformers/control-flow-transformers/control-flow-replacers/string-litertal-control-flow-replacer/StringLiteralControlFlowReplacer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 
@@ -20,7 +20,7 @@ describe('StringLiteralControlFlowReplacer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     controlFlowFlattening: true,
                     controlFlowFlattening: true,
                     controlFlowFlatteningThreshold: 1
                     controlFlowFlatteningThreshold: 1
                 }
                 }

+ 9 - 9
test/functional-tests/node-transformers/control-flow-transformers/function-control-flow-transformer/FunctionControlFlowTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -38,7 +38,7 @@ describe('FunctionControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -80,7 +80,7 @@ describe('FunctionControlFlowTransformer', function () {
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                     obfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             controlFlowFlattening: true,
                             controlFlowFlattening: true,
                             controlFlowFlatteningThreshold: 1
                             controlFlowFlatteningThreshold: 1
                         }
                         }
@@ -123,7 +123,7 @@ describe('FunctionControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -147,7 +147,7 @@ describe('FunctionControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }
@@ -182,7 +182,7 @@ describe('FunctionControlFlowTransformer', function () {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             controlFlowFlattening: true,
                             controlFlowFlattening: true,
                             controlFlowFlatteningThreshold: 1
                             controlFlowFlatteningThreshold: 1
                         }
                         }
@@ -211,7 +211,7 @@ describe('FunctionControlFlowTransformer', function () {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 0
                         controlFlowFlatteningThreshold: 0
                     }
                     }
@@ -240,7 +240,7 @@ describe('FunctionControlFlowTransformer', function () {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             controlFlowFlattening: true,
                             controlFlowFlattening: true,
                             controlFlowFlatteningThreshold: 1
                             controlFlowFlatteningThreshold: 1
                         }
                         }
@@ -264,7 +264,7 @@ describe('FunctionControlFlowTransformer', function () {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             controlFlowFlattening: true,
                             controlFlowFlattening: true,
                             controlFlowFlatteningThreshold: 1
                             controlFlowFlatteningThreshold: 1
                         }
                         }

+ 5 - 5
test/functional-tests/node-transformers/converting-transformers/member-expression-transformer/MemberExpressionTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -20,7 +20,7 @@ describe('MemberExpressionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -43,7 +43,7 @@ describe('MemberExpressionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -74,7 +74,7 @@ describe('MemberExpressionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -102,7 +102,7 @@ describe('MemberExpressionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 

+ 4 - 4
test/functional-tests/node-transformers/converting-transformers/method-definition-transformer/MethodDefinitionTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -19,7 +19,7 @@ describe('MethodDefinitionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -42,7 +42,7 @@ describe('MethodDefinitionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1
                 }
                 }
@@ -70,7 +70,7 @@ describe('MethodDefinitionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 

+ 5 - 5
test/functional-tests/node-transformers/converting-transformers/template-literal-transformer/TemplateLiteralTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -15,7 +15,7 @@ describe('TemplateLiteralTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     unicodeEscapeSequence: false
                     unicodeEscapeSequence: false
                 }
                 }
             );
             );
@@ -30,7 +30,7 @@ describe('TemplateLiteralTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     unicodeEscapeSequence: false
                     unicodeEscapeSequence: false
                 }
                 }
             );
             );
@@ -45,7 +45,7 @@ describe('TemplateLiteralTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     unicodeEscapeSequence: false
                     unicodeEscapeSequence: false
                 }
                 }
             );
             );
@@ -60,7 +60,7 @@ describe('TemplateLiteralTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     unicodeEscapeSequence: false
                     unicodeEscapeSequence: false
                 }
                 }
             );
             );

+ 10 - 10
test/functional-tests/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
@@ -33,7 +33,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 1,
                         deadCodeInjectionThreshold: 1,
                         stringArray: true,
                         stringArray: true,
@@ -69,7 +69,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 1,
                         deadCodeInjectionThreshold: 1,
                         stringArray: true,
                         stringArray: true,
@@ -105,7 +105,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 0,
                         deadCodeInjectionThreshold: 0,
                         stringArray: true,
                         stringArray: true,
@@ -149,7 +149,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 1,
                         deadCodeInjectionThreshold: 1,
                         stringArray: true,
                         stringArray: true,
@@ -200,7 +200,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 1,
                         deadCodeInjectionThreshold: 1,
                         stringArray: true,
                         stringArray: true,
@@ -251,7 +251,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 1,
                         deadCodeInjectionThreshold: 1,
                         stringArray: true,
                         stringArray: true,
@@ -339,7 +339,7 @@ describe('DeadCodeInjectionTransformer', () => {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             deadCodeInjection: true,
                             deadCodeInjection: true,
                             deadCodeInjectionThreshold: 1,
                             deadCodeInjectionThreshold: 1,
                             stringArray: true,
                             stringArray: true,
@@ -396,7 +396,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1,
                         stringArrayThreshold: 1,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
@@ -422,7 +422,7 @@ describe('DeadCodeInjectionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 1,
                         deadCodeInjectionThreshold: 1,
                         debugProtection: true
                         debugProtection: true

+ 3 - 3
test/functional-tests/node-transformers/obfuscating-transformers/catch-clause-transformer/CatchClauseTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
@@ -24,7 +24,7 @@ describe('CatchClauseTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -55,7 +55,7 @@ describe('CatchClauseTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 

+ 4 - 4
test/functional-tests/node-transformers/obfuscating-transformers/class-declaration-transformer/ClassDeclarationTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
@@ -24,7 +24,7 @@ describe('ClassDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -50,7 +50,7 @@ describe('ClassDeclarationTransformer', () => {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET
+                            ...NO_ADDITIONAL_NODES_PRESET
                         }
                         }
                     );
                     );
 
 
@@ -77,7 +77,7 @@ describe('ClassDeclarationTransformer', () => {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             renameGlobals: true
                             renameGlobals: true
                         }
                         }
                     );
                     );

+ 6 - 6
test/functional-tests/node-transformers/obfuscating-transformers/function-declaration-transformer/FunctionDeclarationTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
@@ -24,7 +24,7 @@ describe('FunctionDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -50,7 +50,7 @@ describe('FunctionDeclarationTransformer', () => {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET
+                            ...NO_ADDITIONAL_NODES_PRESET
                         }
                         }
                     );
                     );
 
 
@@ -77,7 +77,7 @@ describe('FunctionDeclarationTransformer', () => {
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                         code,
                         code,
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             renameGlobals: true
                             renameGlobals: true
                         }
                         }
                     );
                     );
@@ -108,7 +108,7 @@ describe('FunctionDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -135,7 +135,7 @@ describe('FunctionDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 

+ 8 - 8
test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/FunctionTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -24,7 +24,7 @@ describe('FunctionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -60,7 +60,7 @@ describe('FunctionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -87,7 +87,7 @@ describe('FunctionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -116,7 +116,7 @@ describe('FunctionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -148,7 +148,7 @@ describe('FunctionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -198,7 +198,7 @@ describe('FunctionTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -265,7 +265,7 @@ describe('FunctionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
             const obfuscatedCode: string = obfuscationResult.getObfuscatedCode();
             const obfuscatedCode: string = obfuscationResult.getObfuscatedCode();

+ 2 - 2
test/functional-tests/node-transformers/obfuscating-transformers/labeled-statement-transformer/LabeledStatementTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
@@ -25,7 +25,7 @@ describe('LabeledStatementTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 

+ 14 - 14
test/functional-tests/node-transformers/obfuscating-transformers/literal-transformer/LiteralTransformer.spec.ts

@@ -4,7 +4,7 @@ import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationRe
 
 
 import { StringArrayEncoding } from '../../../../../src/enums/StringArrayEncoding';
 import { StringArrayEncoding } from '../../../../../src/enums/StringArrayEncoding';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -23,7 +23,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -51,7 +51,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -72,7 +72,7 @@ describe('LiteralTransformer', () => {
                 testFunc = () => JavaScriptObfuscator.obfuscate(
                 testFunc = () => JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -95,7 +95,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -123,7 +123,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         unicodeEscapeSequence: true
                         unicodeEscapeSequence: true
 
 
                     }
                     }
@@ -148,7 +148,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1,
                         stringArrayThreshold: 1,
                         unicodeEscapeSequence: true
                         unicodeEscapeSequence: true
@@ -177,7 +177,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
@@ -202,7 +202,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayEncoding: StringArrayEncoding.Base64,
                         stringArrayEncoding: StringArrayEncoding.Base64,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
@@ -231,7 +231,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayEncoding: StringArrayEncoding.Rc4,
                         stringArrayEncoding: StringArrayEncoding.Rc4,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
@@ -262,7 +262,7 @@ describe('LiteralTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     `${code}\n`.repeat(samples),
                     `${code}\n`.repeat(samples),
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: stringArrayThreshold
                         stringArrayThreshold: stringArrayThreshold
                     }
                     }
@@ -301,7 +301,7 @@ describe('LiteralTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1
                 }
                 }
@@ -325,7 +325,7 @@ describe('LiteralTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1
                 }
                 }
@@ -349,7 +349,7 @@ describe('LiteralTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1
                     stringArrayThreshold: 1
                 }
                 }

+ 4 - 4
test/functional-tests/node-transformers/obfuscating-transformers/object-expression-transformer/ObjectExpressionTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -19,7 +19,7 @@ describe('ObjectExpressionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -41,7 +41,7 @@ describe('ObjectExpressionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -63,7 +63,7 @@ describe('ObjectExpressionTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 

+ 15 - 15
test/functional-tests/node-transformers/obfuscating-transformers/variable-declaration-transformer/VariableDeclarationTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { getRegExpMatch } from '../../../../helpers/getRegExpMatch';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
@@ -21,7 +21,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -49,7 +49,7 @@ describe('VariableDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -76,7 +76,7 @@ describe('VariableDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         renameGlobals: true
                         renameGlobals: true
                     }
                     }
                 );
                 );
@@ -104,7 +104,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -126,7 +126,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -149,7 +149,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -183,7 +183,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
             const obfuscatedCode: string = obfuscationResult.getObfuscatedCode();
             const obfuscatedCode: string = obfuscationResult.getObfuscatedCode();
@@ -238,7 +238,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
             const obfuscatedCode: string = obfuscationResult.getObfuscatedCode();
             const obfuscatedCode: string = obfuscationResult.getObfuscatedCode();
@@ -286,7 +286,7 @@ describe('VariableDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -308,7 +308,7 @@ describe('VariableDeclarationTransformer', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -332,7 +332,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -363,7 +363,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -402,7 +402,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -424,7 +424,7 @@ describe('VariableDeclarationTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 

+ 7 - 7
test/functional-tests/node-transformers/preparing-transformers/comments-transformer/CommentsTransformer.spec.ts

@@ -2,7 +2,7 @@ import { assert } from 'chai';
 
 
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
@@ -19,7 +19,7 @@ describe('CommentsTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -41,7 +41,7 @@ describe('CommentsTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -63,7 +63,7 @@ describe('CommentsTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -92,7 +92,7 @@ describe('CommentsTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -112,7 +112,7 @@ describe('CommentsTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 
@@ -134,7 +134,7 @@ describe('CommentsTransformer', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET
+                    ...NO_ADDITIONAL_NODES_PRESET
                 }
                 }
             );
             );
 
 

+ 2 - 2
test/functional-tests/node-transformers/preparing-transformers/obfuscating-guards/black-list-obfuscating-guard/BlackListObfuscatingGuard.spec.ts

@@ -4,7 +4,7 @@ import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscatio
 
 
 import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 
@@ -22,7 +22,7 @@ describe('BlackListObfuscatingGuard', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }

+ 6 - 6
test/functional-tests/node-transformers/preparing-transformers/obfuscating-guards/conditional-comment-obfuscating-guard/ConditionalCommentObfuscatingGuard.spec.ts

@@ -4,7 +4,7 @@ import { IObfuscationResult } from '../../../../../../src/interfaces/IObfuscatio
 
 
 import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
 
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 
@@ -22,7 +22,7 @@ describe('ConditionalCommentObfuscatingGuard', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -54,7 +54,7 @@ describe('ConditionalCommentObfuscatingGuard', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -85,7 +85,7 @@ describe('ConditionalCommentObfuscatingGuard', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET
+                        ...NO_ADDITIONAL_NODES_PRESET
                     }
                     }
                 );
                 );
 
 
@@ -123,7 +123,7 @@ describe('ConditionalCommentObfuscatingGuard', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         deadCodeInjection: true,
                         deadCodeInjection: true,
                         deadCodeInjectionThreshold: 1
                         deadCodeInjectionThreshold: 1
                     }
                     }
@@ -183,7 +183,7 @@ describe('ConditionalCommentObfuscatingGuard', () => {
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
                     {
                     {
-                        ...NO_CUSTOM_NODES_PRESET,
+                        ...NO_ADDITIONAL_NODES_PRESET,
                         controlFlowFlattening: true,
                         controlFlowFlattening: true,
                         controlFlowFlatteningThreshold: 1
                         controlFlowFlatteningThreshold: 1
                     }
                     }

+ 5 - 5
test/functional-tests/templates/custom-nodes/debug-protection-nodes/DebufProtectionFunctionCallTemplate.spec.ts

@@ -5,7 +5,7 @@ import { IObfuscationResult } from '../../../../../src/interfaces/IObfuscationRe
 
 
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
 import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
 
 
@@ -40,7 +40,7 @@ describe('DebugProtectionFunctionCallTemplate (): string', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     debugProtection: true
                     debugProtection: true
                 }
                 }
             );
             );
@@ -75,7 +75,7 @@ describe('DebugProtectionFunctionCallTemplate (): string', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     debugProtection: true,
                     debugProtection: true,
                     mangle: true
                     mangle: true
                 }
                 }
@@ -111,7 +111,7 @@ describe('DebugProtectionFunctionCallTemplate (): string', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     debugProtection: true
                     debugProtection: true
                 }
                 }
             );
             );
@@ -147,7 +147,7 @@ describe('DebugProtectionFunctionCallTemplate (): string', () => {
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
                 code,
                 code,
                 {
                 {
-                    ...NO_CUSTOM_NODES_PRESET,
+                    ...NO_ADDITIONAL_NODES_PRESET,
                     debugProtection: true
                     debugProtection: true
                 }
                 }
             );
             );

+ 2 - 1
test/runtime-tests/JavaScriptObfuscatorRuntime.spec.ts

@@ -22,7 +22,8 @@ describe('JavaScriptObfuscator runtime eval', function () {
                 deadCodeInjection: true,
                 deadCodeInjection: true,
                 debugProtection: true,
                 debugProtection: true,
                 selfDefending: true,
                 selfDefending: true,
-                stringArrayEncoding: StringArrayEncoding.Rc4
+                stringArrayEncoding: StringArrayEncoding.Rc4,
+                transformObjectKeys: true
             }
             }
         );
         );
 
 

+ 3 - 3
test/unit-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts

@@ -6,7 +6,7 @@ import { IInversifyContainerFacade } from '../../../src/interfaces/container/IIn
 import { IJavaScriptObfuscator } from '../../../src/interfaces/IJavaScriptObfsucator';
 import { IJavaScriptObfuscator } from '../../../src/interfaces/IJavaScriptObfsucator';
 import { IObfuscationResult } from '../../../src/interfaces/IObfuscationResult';
 import { IObfuscationResult } from '../../../src/interfaces/IObfuscationResult';
 
 
-import { NO_CUSTOM_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes';
 
 
 import { InversifyContainerFacade } from '../../../src/container/InversifyContainerFacade';
 import { InversifyContainerFacade } from '../../../src/container/InversifyContainerFacade';
 
 
@@ -30,7 +30,7 @@ describe('JavaScriptObfuscator', () => {
                     inversifyContainerFacade.load(
                     inversifyContainerFacade.load(
                         '',
                         '',
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             sourceMap: true,
                             sourceMap: true,
                             sourceMapFileName: sourceMapUrl
                             sourceMapFileName: sourceMapUrl
                         }
                         }
@@ -66,7 +66,7 @@ describe('JavaScriptObfuscator', () => {
                     inversifyContainerFacade.load(
                     inversifyContainerFacade.load(
                         '',
                         '',
                         {
                         {
-                            ...NO_CUSTOM_NODES_PRESET,
+                            ...NO_ADDITIONAL_NODES_PRESET,
                             sourceMap: true,
                             sourceMap: true,
                             sourceMapBaseUrl: sourceMapBaseUrl,
                             sourceMapBaseUrl: sourceMapBaseUrl,
                             sourceMapFileName: sourceMapUrl
                             sourceMapFileName: sourceMapUrl

+ 4 - 4
test/unit-tests/node/node-appender/NodeAppender.spec.ts

@@ -36,7 +36,7 @@ const convertCodeToAst: (fixturePath: string) => ESTree.Program = (fixturePath)
 };
 };
 
 
 describe('NodeAppender', () => {
 describe('NodeAppender', () => {
-    describe('appendNode (blockScopeNode: TNodeWithBlockStatement[], nodeBodyStatements: TStatement[]): void', () => {
+    describe('appendNode (blockScopeNode: TNodeWithBlockScope[], nodeBodyStatements: TStatement[]): void', () => {
         let astTree: ESTree.Program,
         let astTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
             node: TStatement[];
             node: TStatement[];
@@ -57,7 +57,7 @@ describe('NodeAppender', () => {
         });
         });
     });
     });
 
 
-    describe('appendNodeToOptimalBlockScope (blockScopeStackTraceData: IStackTraceData[], blockScopeNode: TNodeWithBlockStatement, nodeBodyStatements: TStatement[], index: number = 0): void', () => {
+    describe('appendNodeToOptimalBlockScope (blockScopeStackTraceData: IStackTraceData[], blockScopeNode: TNodeWithBlockScope, nodeBodyStatements: TStatement[], index: number = 0): void', () => {
         let stackTraceAnalyzer: IStackTraceAnalyzer,
         let stackTraceAnalyzer: IStackTraceAnalyzer,
             astTree: ESTree.Program,
             astTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
@@ -162,7 +162,7 @@ describe('NodeAppender', () => {
         });
         });
     });
     });
 
 
-    describe('insertNodeAtIndex (blockScopeNode: TNodeWithBlockStatement[], nodeBodyStatements: TStatement[], index: number): void', () => {
+    describe('insertNodeAtIndex (blockScopeNode: TNodeWithBlockScope[], nodeBodyStatements: TStatement[], index: number): void', () => {
         let astTree: ESTree.Program,
         let astTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
             node: TStatement[];
             node: TStatement[];
@@ -183,7 +183,7 @@ describe('NodeAppender', () => {
         });
         });
     });
     });
 
 
-    describe('prependNode (blockScopeNode: TNodeWithBlockStatement[], nodeBodyStatements: TStatement[]): void', () => {
+    describe('prependNode (blockScopeNode: TNodeWithBlockScope[], nodeBodyStatements: TStatement[]): void', () => {
         let astTree: ESTree.Program,
         let astTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
             expectedAstTree: ESTree.Program,
             node: TStatement[];
             node: TStatement[];

+ 79 - 87
test/unit-tests/node/node-utils/NodeUtils.spec.ts

@@ -9,8 +9,8 @@ import { NodeUtils } from '../../../../src/node/NodeUtils';
 
 
 describe('NodeUtils', () => {
 describe('NodeUtils', () => {
     describe('addXVerbatimPropertyToLiterals (node: ESTree.Node): void', () => {
     describe('addXVerbatimPropertyToLiterals (node: ESTree.Node): void', () => {
-        let literalNode: any,
-            expectedLiteralNode: any;
+        let literalNode: ESTree.Literal,
+            expectedLiteralNode: ESTree.Literal;
 
 
         before(() => {
         before(() => {
             literalNode = Nodes.getLiteralNode('value');
             literalNode = Nodes.getLiteralNode('value');
@@ -179,39 +179,7 @@ describe('NodeUtils', () => {
         });
         });
     });
     });
 
 
-    describe('getBlockStatementNodeByIndex (node: ESTree.Node, index: number = 0): ESTree.Node', () => {
-        let blockStatementNode: ESTree.BlockStatement,
-            expressionStatementNode1: ESTree.ExpressionStatement,
-            expressionStatementNode2: ESTree.ExpressionStatement;
-
-        beforeEach(() => {
-            expressionStatementNode1 = Nodes.getExpressionStatementNode(Nodes.getIdentifierNode('identifier'));
-            expressionStatementNode2 = Nodes.getExpressionStatementNode(Nodes.getIdentifierNode('identifier'));
-
-            blockStatementNode = Nodes.getBlockStatementNode([
-                expressionStatementNode1,
-                expressionStatementNode2
-            ]);
-        });
-
-        it('should return block-statement child node of given node if that node has block-statement', () => {
-            assert.deepEqual(NodeUtils.getBlockStatementNodeByIndex(blockStatementNode), expressionStatementNode1);
-        });
-
-        it('should return block-statement child node of given node with index `1` if that node has block-statement', () => {
-            assert.deepEqual(NodeUtils.getBlockStatementNodeByIndex(blockStatementNode, 1), expressionStatementNode2);
-        });
-
-        it('should throw a `ReferenceError` if index is out of boundaries', () => {
-            assert.throws(() => NodeUtils.getBlockStatementNodeByIndex(blockStatementNode, 2), ReferenceError);
-        });
-
-        it('should throw a `TypeError` if node have no a block-statement', () => {
-            assert.throws(() => NodeUtils.getBlockStatementNodeByIndex(expressionStatementNode1, 1), TypeError);
-        });
-    });
-
-    describe('getBlockScopesOfNode (node: ESTree.Node, blockScopes: TNodeWithBlockStatement[] = []): TNodeWithBlockStatement[]', () => {
+    describe('getBlockScopesOfNode (node: ESTree.Node, blockScopes: TNodeWithBlockScope[] = []): TNodeWithBlockScope[]', () => {
         let functionDeclarationBlockStatementNode: ESTree.BlockStatement,
         let functionDeclarationBlockStatementNode: ESTree.BlockStatement,
             ifStatementBlockStatementNode1: ESTree.BlockStatement,
             ifStatementBlockStatementNode1: ESTree.BlockStatement,
             ifStatementBlockStatementNode2: ESTree.BlockStatement,
             ifStatementBlockStatementNode2: ESTree.BlockStatement,
@@ -326,18 +294,20 @@ describe('NodeUtils', () => {
         });
         });
     });
     });
 
 
-    describe('getNodeBlockScopeDepth (node: ESTree.Node, depth: number = 0): number', () => {
-        let functionDeclarationBlockStatementNode1: ESTree.BlockStatement,
-            functionDeclarationBlockStatementNode2: ESTree.BlockStatement,
+    describe('getScopeOfNode (node: ESTree.Node): TNodeWithScope | null', () => {
+        let functionDeclarationBlockStatementNode: ESTree.BlockStatement,
             ifStatementBlockStatementNode1: ESTree.BlockStatement,
             ifStatementBlockStatementNode1: ESTree.BlockStatement,
             ifStatementBlockStatementNode2: ESTree.BlockStatement,
             ifStatementBlockStatementNode2: ESTree.BlockStatement,
+            ifStatementBlockStatementNode3: ESTree.BlockStatement,
             ifStatementNode1: ESTree.IfStatement,
             ifStatementNode1: ESTree.IfStatement,
             ifStatementNode2: ESTree.IfStatement,
             ifStatementNode2: ESTree.IfStatement,
-            expressionStatementNode1: ESTree.ExpressionStatement,
-            expressionStatementNode2: ESTree.ExpressionStatement,
+            ifStatementNode3: ESTree.IfStatement,
+            switchCaseNode: ESTree.SwitchCase,
+            switchStatementNode: ESTree.SwitchStatement,
             expressionStatementNode3: ESTree.ExpressionStatement,
             expressionStatementNode3: ESTree.ExpressionStatement,
-            functionDeclarationNode1: ESTree.FunctionDeclaration,
-            functionDeclarationNode2: ESTree.FunctionDeclaration,
+            expressionStatementNode2: ESTree.ExpressionStatement,
+            expressionStatementNode1: ESTree.ExpressionStatement,
+            functionDeclarationNode: ESTree.FunctionDeclaration,
             programNode: ESTree.Program;
             programNode: ESTree.Program;
 
 
         before(() => {
         before(() => {
@@ -345,101 +315,123 @@ describe('NodeUtils', () => {
             expressionStatementNode2 = Nodes.getExpressionStatementNode(Nodes.getIdentifierNode('identifier'));
             expressionStatementNode2 = Nodes.getExpressionStatementNode(Nodes.getIdentifierNode('identifier'));
             expressionStatementNode3 = Nodes.getExpressionStatementNode(Nodes.getIdentifierNode('identifier'));
             expressionStatementNode3 = Nodes.getExpressionStatementNode(Nodes.getIdentifierNode('identifier'));
 
 
-            ifStatementBlockStatementNode2 = Nodes.getBlockStatementNode([
+            ifStatementBlockStatementNode3 = Nodes.getBlockStatementNode([
+                expressionStatementNode2,
                 expressionStatementNode3
                 expressionStatementNode3
             ]);
             ]);
 
 
-            ifStatementNode2 = Nodes.getIfStatementNode(
+            ifStatementNode3 = Nodes.getIfStatementNode(
                 Nodes.getLiteralNode(true),
                 Nodes.getLiteralNode(true),
-                ifStatementBlockStatementNode2
+                ifStatementBlockStatementNode3
             );
             );
 
 
-            functionDeclarationBlockStatementNode2 = Nodes.getBlockStatementNode([
-                ifStatementNode2,
-                expressionStatementNode2
-            ]);
-
-            functionDeclarationNode2 = Nodes.getFunctionDeclarationNode('test', [], functionDeclarationBlockStatementNode2);
+            ifStatementBlockStatementNode2 = Nodes.getBlockStatementNode();
 
 
             ifStatementBlockStatementNode1 = Nodes.getBlockStatementNode([
             ifStatementBlockStatementNode1 = Nodes.getBlockStatementNode([
-                functionDeclarationNode2
+                ifStatementNode3
             ]);
             ]);
 
 
+            ifStatementNode2 = Nodes.getIfStatementNode(
+                Nodes.getLiteralNode(true),
+                ifStatementBlockStatementNode2
+            );
+
             ifStatementNode1 = Nodes.getIfStatementNode(
             ifStatementNode1 = Nodes.getIfStatementNode(
                 Nodes.getLiteralNode(true),
                 Nodes.getLiteralNode(true),
                 ifStatementBlockStatementNode1
                 ifStatementBlockStatementNode1
             );
             );
 
 
-            functionDeclarationBlockStatementNode1 = Nodes.getBlockStatementNode([
+            switchCaseNode = Nodes.getSwitchCaseNode(
+                Nodes.getLiteralNode(1),
+                [
+                    ifStatementNode2
+                ]
+            );
+
+            switchStatementNode = Nodes.getSwitchStatementNode(
+                Nodes.getLiteralNode(1),
+                [
+                    switchCaseNode
+                ]
+            );
+
+            functionDeclarationBlockStatementNode = Nodes.getBlockStatementNode([
                 expressionStatementNode1,
                 expressionStatementNode1,
-                ifStatementNode1
+                ifStatementNode1,
+                switchStatementNode
             ]);
             ]);
 
 
-            functionDeclarationNode1 = Nodes.getFunctionDeclarationNode('test', [], functionDeclarationBlockStatementNode1);
+            functionDeclarationNode = Nodes.getFunctionDeclarationNode('test', [], functionDeclarationBlockStatementNode);
 
 
             programNode = Nodes.getProgramNode([
             programNode = Nodes.getProgramNode([
-                functionDeclarationNode1
+                functionDeclarationNode
             ]);
             ]);
 
 
             programNode.parentNode = programNode;
             programNode.parentNode = programNode;
-            functionDeclarationNode1.parentNode = programNode;
-            functionDeclarationBlockStatementNode1.parentNode = functionDeclarationNode1;
-            expressionStatementNode1.parentNode = functionDeclarationBlockStatementNode1;
-            ifStatementNode1.parentNode = functionDeclarationBlockStatementNode1;
+            functionDeclarationNode.parentNode = programNode;
+            functionDeclarationBlockStatementNode.parentNode = functionDeclarationNode;
+            expressionStatementNode1.parentNode = functionDeclarationBlockStatementNode;
+            ifStatementNode1.parentNode = functionDeclarationBlockStatementNode;
             ifStatementBlockStatementNode1.parentNode = ifStatementNode1;
             ifStatementBlockStatementNode1.parentNode = ifStatementNode1;
-            functionDeclarationNode2.parentNode = ifStatementBlockStatementNode1;
-            functionDeclarationBlockStatementNode2.parentNode = functionDeclarationNode2;
-            expressionStatementNode2.parentNode = functionDeclarationBlockStatementNode2;
-            ifStatementNode2.parentNode = functionDeclarationBlockStatementNode2;
+            switchStatementNode.parentNode = functionDeclarationBlockStatementNode;
+            switchCaseNode.parentNode = switchStatementNode;
+            ifStatementNode2.parentNode = switchCaseNode;
             ifStatementBlockStatementNode2.parentNode = ifStatementNode2;
             ifStatementBlockStatementNode2.parentNode = ifStatementNode2;
+            ifStatementNode3.parentNode = ifStatementBlockStatementNode1;
+            ifStatementBlockStatementNode3.parentNode = ifStatementNode3;
+            expressionStatementNode3.parentNode = ifStatementBlockStatementNode3;
+        });
+
+        it('should return scope node for `program` node child', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(programNode), programNode);
         });
         });
 
 
-        it('should return block-scope depth for `program` node', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(programNode), 0);
+        it('should return scope node for `functionDeclaration` node child node #1', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(functionDeclarationNode), programNode);
         });
         });
 
 
-        it('should return block-scope depth for `functionDeclaration` node #1', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(functionDeclarationNode1), 0);
+        it('should return scope node for `functionDeclaration blockStatement` node child node #1', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(functionDeclarationBlockStatementNode), programNode);
         });
         });
 
 
-        it('should return block-scope depth for `functionDeclaration blockStatement` node #1', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(functionDeclarationBlockStatementNode1), 1);
+        it('should return scope node for `expressionStatement` node #1 child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(expressionStatementNode1), functionDeclarationBlockStatementNode);
         });
         });
 
 
-        it('should return block-scope depth for `expressionStatement` node #1', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(expressionStatementNode1), 1);
+        it('should return scope node for `ifStatement` node #1 child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(ifStatementNode1), functionDeclarationBlockStatementNode);
         });
         });
 
 
-        it('should return block-scope depth for `ifStatement` node #1', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(ifStatementNode1), 1);
+        it('should return scope node for `switchStatement` node child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(switchStatementNode), functionDeclarationBlockStatementNode);
         });
         });
 
 
-        it('should return block-scope depth for `ifStatement blockStatement` node #1', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(ifStatementBlockStatementNode1), 1);
+        it('should return scope node for `switchCase` node child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(switchCaseNode), functionDeclarationBlockStatementNode);
         });
         });
 
 
-        it('should return block-scope depth for `functionDeclaration` node #2', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(functionDeclarationNode2), 1);
+        it('should return scope node for `ifStatement` node #2 child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(ifStatementNode2), switchCaseNode);
         });
         });
 
 
-        it('should return block-scope depth for `functionDeclaration blockStatement` node #2', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(functionDeclarationBlockStatementNode2), 2);
+        it('should return scope node for `ifStatement blockStatement` node #2 child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(ifStatementBlockStatementNode2), switchCaseNode);
         });
         });
 
 
-        it('should return block-scope depth for `expressionStatement` node #2', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(expressionStatementNode2), 2);
+        it('should return scope node for `ifStatement blockStatement` node #1 child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(ifStatementBlockStatementNode1), functionDeclarationBlockStatementNode);
         });
         });
 
 
-        it('should return block-scope depth for `ifStatement` node #2', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(ifStatementNode2), 2);
+        it('should return scope node for `ifStatement blockStatement` node #3 child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(ifStatementBlockStatementNode3), ifStatementBlockStatementNode1);
         });
         });
 
 
-        it('should return block-scope depth for `ifStatement blockStatement` node #2', () => {
-            assert.deepEqual(NodeUtils.getNodeBlockScopeDepth(ifStatementBlockStatementNode2), 2);
+        it('should return scope node for `expressionStatement` node #3 child node', () => {
+            assert.deepEqual(NodeUtils.getScopeOfNode(expressionStatementNode3), ifStatementBlockStatementNode3);
         });
         });
 
 
         it('should throw a `ReferenceError` if node has no `parentNode` property', () => {
         it('should throw a `ReferenceError` if node has no `parentNode` property', () => {
-            assert.throws(() => NodeUtils.getNodeBlockScopeDepth(expressionStatementNode3), ReferenceError);
+            assert.throws(() => NodeUtils.getScopeOfNode(expressionStatementNode2), ReferenceError);
         });
         });
     });
     });
 
 

+ 9 - 9
yarn.lock

@@ -6,9 +6,9 @@
   version "4.0.10"
   version "4.0.10"
   resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.10.tgz#0eb222c7353adde8e0980bea04165d4d3b6afef3"
   resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.10.tgz#0eb222c7353adde8e0980bea04165d4d3b6afef3"
 
 
-"@types/[email protected]5":
-  version "0.7.35"
-  resolved "https://registry.yarnpkg.com/@types/chance/-/chance-0.7.35.tgz#e76f3441b7763476c58eb7dc32f62da3d8ea547e"
+"@types/[email protected]6":
+  version "0.7.36"
+  resolved "https://registry.yarnpkg.com/@types/chance/-/chance-0.7.36.tgz#1c3e14b9b11463d454182393ebcd8e977f1daff5"
 
 
 "@types/[email protected]":
 "@types/[email protected]":
   version "2.12.2"
   version "2.12.2"
@@ -74,9 +74,9 @@
   version "8.0.53"
   version "8.0.53"
   resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8"
   resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8"
 
 
-"@types/[email protected].2":
-  version "8.5.2"
-  resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.2.tgz#83b8103fa9a2c2e83d78f701a9aa7c9539739aa5"
+"@types/[email protected].5":
+  version "8.5.5"
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.5.tgz#6f9e8164ae1a55a9beb1d2571cfb7acf9d720c61"
 
 
 "@types/rimraf@^2.0.2":
 "@types/rimraf@^2.0.2":
   version "2.0.2"
   version "2.0.2"
@@ -1450,9 +1450,9 @@ [email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1
   version "1.0.5"
   version "1.0.5"
   resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
   resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
 
 
[email protected]5:
-  version "1.6.15"
-  resolved "https://registry.yarnpkg.com/escodegen-wallaby/-/escodegen-wallaby-1.6.15.tgz#9d5ef67dd4d8c7c8a58aff1e4edd63512566ba9f"
[email protected]6:
+  version "1.6.16"
+  resolved "https://registry.yarnpkg.com/escodegen-wallaby/-/escodegen-wallaby-1.6.16.tgz#f55b65d1a846d98584f1be18a2bf463f96280527"
   dependencies:
   dependencies:
     esprima "^2.7.1"
     esprima "^2.7.1"
     estraverse "^1.9.1"
     estraverse "^1.9.1"

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff