# All files / src/node-obfuscators LiteralObfuscator.js

88.89% Statements 16/18
72.73% Branches 8/11
100% Functions 0/0
88.89% Lines 16/18

    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
    1x
    1x
    1x

    205x

    205x

    205x
    205x

    24x
    24x

    72x
    72x

    107x
    107x

    2x

    203x

    1x
     "use strict";
    const escodegen = require('escodegen');
    const NodeObfuscator_1 = require('./NodeObfuscator');
    const Nodes_1 = require("../Nodes");
    class LiteralObfuscator extends NodeObfuscator_1.NodeObfuscator {
        obfuscateNode(literalNode, parentNode) {
            if (Nodes_1.Nodes.isPropertyNode(parentNode) && parentNode.key === literalNode) I{
                return;
            }
            if (literalNode['x-verbatim-property']) I{
                return;
            }
            let content;
            switch (typeof literalNode.value) {
                case 'boolean':
                    content = this.replaceLiteralBooleanWithJSFuck(literalNode.value);
                    break;
                case 'number':
                    content = this.replaceLiteralNumberWithHexadecimalValue(literalNode.value);
                    break;
                case 'string':
                    content = this.replaceLiteralValueWithUnicodeValue(literalNode.value);
                    break;
                default:
                    return;
            }
            literalNode['x-verbatim-property'] = {
                content: content,
                precedence: escodegen.Precedence.Primary
            };
        }
    }
    exports.LiteralObfuscator = LiteralObfuscator;
    //# sourceMappingURL=LiteralObfuscator.js.map