mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
refactoring
This commit is contained in:
+2
-10
@@ -8,16 +8,8 @@ class DebugProtectionNodesGroup extends NodesGroup_1.NodesGroup {
|
||||
constructor(options = {}) {
|
||||
super(options);
|
||||
this.debugProtectionFunctionIdentifier = Utils_1.Utils.getRandomVariableName();
|
||||
this.nodes = new Map([
|
||||
[
|
||||
'debugProtectionFunctionNode',
|
||||
new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier)
|
||||
],
|
||||
[
|
||||
'debugProtectionFunctionCallNode',
|
||||
new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier)
|
||||
]
|
||||
]);
|
||||
this.nodes.set('debugProtectionFunctionNode', new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier));
|
||||
this.nodes.set('debugProtectionFunctionCallNode', new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier));
|
||||
if (this.options['debugProtectionInterval']) {
|
||||
this.nodes.set('debugProtectionFunctionIntervalNode', new DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode(this.debugProtectionFunctionIdentifier));
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
class NodesGroup {
|
||||
constructor(options = {}) {
|
||||
this.nodes = new Map();
|
||||
this.options = options;
|
||||
}
|
||||
getNodes() {
|
||||
|
||||
+1
-6
@@ -11,12 +11,7 @@ class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
|
||||
this.unicodeArrayRotateValue = Utils_1.Utils.getRandomInteger(100, 500);
|
||||
this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
|
||||
let unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(this.unicodeArrayName, this.unicodeArrayRotateValue), unicodeArray = unicodeArrayNode.getNodeData();
|
||||
this.nodes = new Map([
|
||||
[
|
||||
'unicodeArrayNode',
|
||||
unicodeArrayNode
|
||||
]
|
||||
]);
|
||||
this.nodes.set('unicodeArrayNode', unicodeArrayNode);
|
||||
if (this.options['wrapUnicodeArrayCalls']) {
|
||||
this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray));
|
||||
}
|
||||
|
||||
@@ -20,16 +20,14 @@ export class DebugProtectionNodesGroup extends NodesGroup {
|
||||
constructor (options: IOptions = {}) {
|
||||
super(options);
|
||||
|
||||
this.nodes = new Map <string, ICustomNode> ([
|
||||
[
|
||||
'debugProtectionFunctionNode',
|
||||
new DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier)
|
||||
],
|
||||
[
|
||||
'debugProtectionFunctionCallNode',
|
||||
new DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier)
|
||||
]
|
||||
]);
|
||||
this.nodes.set(
|
||||
'debugProtectionFunctionNode',
|
||||
new DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier)
|
||||
);
|
||||
this.nodes.set(
|
||||
'debugProtectionFunctionCallNode',
|
||||
new DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier)
|
||||
);
|
||||
|
||||
if (this.options['debugProtectionInterval']) {
|
||||
this.nodes.set(
|
||||
|
||||
@@ -7,7 +7,7 @@ export abstract class NodesGroup implements INodesGroup {
|
||||
/**
|
||||
* @type {Map<string, Node>}
|
||||
*/
|
||||
protected nodes: Map <string, ICustomNode>;
|
||||
protected nodes: Map <string, ICustomNode> = new Map <string, ICustomNode> ();
|
||||
|
||||
/**
|
||||
* @type {IOptions}
|
||||
|
||||
@@ -35,12 +35,10 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
|
||||
),
|
||||
unicodeArray: string [] = unicodeArrayNode.getNodeData();
|
||||
|
||||
this.nodes = new Map <string, ICustomNode> ([
|
||||
[
|
||||
'unicodeArrayNode',
|
||||
unicodeArrayNode
|
||||
]
|
||||
]);
|
||||
this.nodes.set(
|
||||
'unicodeArrayNode',
|
||||
unicodeArrayNode
|
||||
);
|
||||
|
||||
if (this.options['wrapUnicodeArrayCalls']) {
|
||||
this.nodes.set(
|
||||
|
||||
Reference in New Issue
Block a user