All files / src/node-groups DebugProtectionCustomNodeGroup.ts

61.54% Statements 8/13
25% Branches 1/4
100% Functions 0/0
61.54% Lines 8/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41    1x 1x 1x   1x 1x   1x         2583x 2583x                                                  
import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
 
import { DebugProtectionFunctionCallNode } from '../custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode';
import { DebugProtectionFunctionIntervalNode } from '../custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode';
import { DebugProtectionFunctionNode } from '../custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode';
 
import { AbstractNodesGroup } from './AbstractNodesGroup';
import { Utils } from '../Utils';
 
export class DebugProtectionNodesGroup extends AbstractNodesGroup {
    /**
     * @returns {Map<string, ICustomNode> | undefined}
     */
    public getNodes (): Map <string, ICustomNode> | undefined {
        Eif (!this.options.debugProtection) {
            return;
        }
 
        const debugProtectionFunctionName: string = Utils.getRandomVariableName();
        const customNodes: Map <string, ICustomNode> = new Map <string, ICustomNode> ([
            [
                'debugProtectionFunctionNode',
                new DebugProtectionFunctionNode(debugProtectionFunctionName, this.options)
            ],
            [
                'debugProtectionFunctionCallNode',
                new DebugProtectionFunctionCallNode(debugProtectionFunctionName, this.options)
            ]
        ]);
 
        if (this.options.debugProtectionInterval) {
            customNodes.set(
                'debugProtectionFunctionIntervalNode',
                new DebugProtectionFunctionIntervalNode(debugProtectionFunctionName, this.options)
            );
        }
 
        return this.syncCustomNodesWithNodesGroup(customNodes);
    }
}