All files / webpack:/src/custom-nodes Node.ts

66.67% Statements 2/3
100% Branches 2/2
100% Functions 0/0
66.67% Lines 2/3
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                                                                        6x                                 1x                                
import { ICustomNode } from '../interfaces/ICustomNode';
import { INode } from '../interfaces/nodes/INode';
import { IOptions } from "../interfaces/IOptions";
 
import { AppendState } from '../enums/AppendState';
 
import { NodeUtils } from "../NodeUtils";
 
export abstract class Node implements ICustomNode {
    /**
     * @type {AppendState}
     */
    protected appendState: AppendState = AppendState.BeforeObfuscation;
 
    /**
     * @type {INode}
     */
    protected node: INode;
 
    /**
     * @type {IOptions}
     */
    protected options: IOptions;
 
    /**
     * @param options
     */
    constructor (options: IOptions) {
        this.options = options;
    }
 
    public abstract appendNode (astTree: INode): void;
 
    /**
     * @returns {AppendState}
     */
    public getAppendState (): AppendState {
        return this.appendState;
    }
 
    /**
     * @returns any
     */
    public getNode (): INode {
        NodeUtils.parentize(this.node);
 
        return this.node;
    }
 
    /**
     * @param node
     */
    public setNode (node: INode): void {
        this.node = node;
    }
 
    public updateNode (): void {
        this.node = this.getNodeStructure();
    }
 
    /**
     * @returns any
     */
    protected abstract getNodeStructure (): any;
}
 
 
 
// WEBPACK FOOTER //
// ./src/custom-nodes/Node.ts