All files / src/node-obfuscators CatchClauseObfuscator.js

100% Statements 14/14
100% Branches 1/1
100% Functions 3/3
100% Lines 13/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  1x 1x   8x   2x     2x 2x   2x 2x 2x     2x 2x   18x         1x  
"use strict";
const estraverse = require('estraverse');
const NodeObfuscator_1 = require('./NodeObfuscator');
class CatchClauseObfuscator extends NodeObfuscator_1.NodeObfuscator {
    constructor(...args) {
        super(...args);
        this.catchClauseParam = new Map();
    }
    obfuscateNode(catchClauseNode) {
        this.storeCatchClauseParam(catchClauseNode);
        this.replaceCatchClauseParam(catchClauseNode);
    }
    storeCatchClauseParam(catchClauseNode) {
        estraverse.traverse(catchClauseNode.param, {
            leave: (node) => this.storeIdentifiersNames(node, this.catchClauseParam)
        });
    }
    replaceCatchClauseParam(catchClauseNode) {
        estraverse.replace(catchClauseNode, {
            leave: (node, parentNode) => {
                this.replaceIdentifiersWithRandomNames(node, parentNode, this.catchClauseParam);
            }
        });
    }
}
exports.CatchClauseObfuscator = CatchClauseObfuscator;
//# sourceMappingURL=CatchClauseObfuscator.js.map