UNPKG

vanzy-protect

Version:

Epic Obfuscator Yeahhh

29 lines (28 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.variableDeclarator = void 0; const cfg_1 = require("../config/cfg"); const warn_1 = require("../log/warn"); const comment_1 = require("../obfuscate/comment"); const obfuscateName_1 = require("../obfuscate/obfuscateName"); const objectPattern_1 = require("./objectPattern"); const rightExpression_1 = require("./rightExpression"); function variableDeclarator({ id, init }) { var data = ''; if (id.type === 'Identifier') { data += (0, cfg_1.cfg)().transforms.obfuscateNames ? (0, obfuscateName_1.obfuscateName)(id.name) : id.name; } else if (id.type === 'ObjectPattern') { data += (0, objectPattern_1.objectPattern)(id); } else if (id.type === 'ArrayPattern') { } else (0, warn_1.warn)(`Unknown expression type in variableDeclarator(e) => e.id : ${id.type}`); if (init) { data += (0, comment_1.comment)(2) + '=' + (0, comment_1.comment)(2); data += (0, rightExpression_1.rightExpression)(init); } return data; } exports.variableDeclarator = variableDeclarator;