# All files / src/node-groups AbstractCustomNodeGroup.ts

100% Statements 8/8
100% Branches 0/0
100% Functions 2/2
100% Lines 8/8

    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

    1x

    1x

    12915x

    12915x
    12915x

    1533x
    3574x

    1533x

     import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
    import { INodesGroup } from '../interfaces/INodesGroup';
    import { IOptions } from '../interfaces/IOptions';
    import { IStackTraceData } from '../interfaces/stack-trace-analyzer/IStackTraceData';

    import { AppendState } from '../enums/AppendState';

    export abstract class AbstractNodesGroup implements INodesGroup {
        /**
         * @type {AppendState}
         */
        protected appendState: AppendState = AppendState.BeforeObfuscation;

        /**
         * @type {IStackTraceData[]}
         */
        protected stackTraceData: IStackTraceData[];

        /**
         * @type {IOptions}
         */
        protected options: IOptions;

        /**
         * @param stackTraceData
         * @param options
         */
        constructor (stackTraceData: IStackTraceData[], options: IOptions) {
            this.stackTraceData = stackTraceData;
            this.options = options;
        }

        /**
         * @returns {Map<string, ICustomNode> | undefined}
         */
        public abstract getNodes (): Map <string, ICustomNode> | undefined;

        /**
         * @param customNodes
         * @returns {Map<string, ICustomNode>}
         */
        protected syncCustomNodesWithNodesGroup (customNodes: Map <string, ICustomNode>): Map <string, ICustomNode> {
            customNodes.forEach((node: ICustomNode) => {
                node.setAppendState(this.appendState);
            });

            return customNodes;
        }
    }