All files / webpack:/src/node-groups UnicodeArrayNodesGroup.ts

100% Statements 13/13
50% Branches 3/6
100% Functions 1/1
100% Lines 12/12
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93      1x   1x   1x           1x                                   1x 1x 1x     1x       1x             1x                             1x                     1x                                      
import { IOptions } from "../interfaces/IOptions";
 
import { NodesGroup } from './NodesGroup';
import { UnicodeArrayCallsWrapper } from "../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper";
import { UnicodeArrayDecodeNode } from "../custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode";
import { UnicodeArrayNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayNode';
import { UnicodeArrayRotateFunctionNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode';
import { Utils } from '../Utils';
 
export class UnicodeArrayNodesGroup extends NodesGroup {
    /**
     * @type {string}
     */
    private unicodeArrayName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
 
    /**
     * @type {number}
     */
    private unicodeArrayRotateValue: number;
 
    /**
     * @type {string}
     */
    private unicodeArrayTranslatorName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
 
    /**
     * @param options
     */
    constructor (options: IOptions) {
        super(options);
 
        if (this.options.get('rotateUnicodeArray')) {
            thisE.unicodeArrayRotateValue = Utils.getRandomGenerator().integer(E{
                min: 100,
                max: 500
            });
        } else {
            this.unicodeArrayRotateValue = 0;
        }E
 
        let unicodeArrayNode: UnicodeArrayNode = new UnicodeArrayNode(
                this.unicodeArrayName,
                this.unicodeArrayRotateValue,
                this.options
            ),
            unicodeArray: string [] = unicodeArrayNode.getNodeData();
 
        this.nodes.set(
            'unicodeArrayNode',
            unicodeArrayNode
        );
 
        if (this.options.get('wrapUnicodeArrayCalls')) {
            this.nodes.set(
                'unicodeArrayCallsWrapper',
                new UnicodeArrayCallsWrapper(
                    this.unicodeArrayTranslatorName,
                    this.unicodeArrayName,
                    unicodeArray,
                    this.options
                )
            );
        }
 
        if (this.options.get('encodeUnicodeLiterals')) {
            this.nodes.set(
                'unicodeArrayDecodeNode',
                new UnicodeArrayDecodeNode (
                    this.unicodeArrayName,
                    unicodeArray,
                    this.options
                )
            );
        }
 
        if (this.options.get('rotateUnicodeArray')) {
            this.nodes.set(
                'unicodeArrayRotateFunctionNode',
                new UnicodeArrayRotateFunctionNode(
                    this.unicodeArrayName,
                    unicodeArray,
                    this.unicodeArrayRotateValue,
                    this.options
                )
            );
        }
    }
}
 
 
 
// WEBPACK FOOTER //
// ./src/node-groups/UnicodeArrayNodesGroup.ts