Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let generateOptions: escodegen.GenerateOptions = {
format: formatOptions,
moz: mozillaOptions,
parse: () => {},
comment: true,
sourceMap: " ",
sourceMapWithCode: true,
sourceContent: " ",
sourceCode: " ",
sourceMapRoot: " ",
directive: true,
file: " ",
verbatim: " "
};
let precedence: escodegen.Precedence = escodegen.Precedence.Primary;
let myCode: string = escodegen.generate({}, generateOptions);
let ast: any = escodegen.attachComments({}, {}, {});
value: function literalNodeController(node) {
switch (_typeof(node.value)) {
case 'string':
if (node['x-verbatim-property']) {
break;
}
node['x-verbatim-property'] = {
content: Utils_1.Utils.stringToUnicode(node.value),
precedence: escodegen.Precedence.Primary
};
break;
default:
break;
}
}
}, {
value: function identifierNodeController(node) {
var nodeValue = node.name,
literalNode = {
raw: '\'' + nodeValue + '\'',
'x-verbatim-property': {
content: this.replaceLiteralValueByUnicodeValue(nodeValue),
precedence: escodegen.Precedence.Primary
},
type: NodeType_1.NodeType.Literal,
value: nodeValue
};
delete node.name;
Object.assign(node, literalNode);
}
}, {
value: function literalNodeController(node) {
switch (_typeof(node.value)) {
case 'string':
if (node['x-verbatim-property']) {
break;
}
node['x-verbatim-property'] = {
content: this.replaceLiteralValueByUnicodeValue(node.value),
precedence: escodegen.Precedence.Primary
};
break;
default:
break;
}
}
}]);
switch (_typeof(literalNode.value)) {
case 'boolean':
content = this.replaceLiteralBooleanByJSFuck(literalNode.value);
break;
case 'number':
content = this.replaceLiteralNumberByHexadecimalValue(literalNode.value);
break;
case 'string':
content = this.replaceLiteralValueByUnicodeValue(literalNode.value);
break;
default:
return;
}
literalNode['x-verbatim-property'] = {
content: content,
precedence: escodegen.Precedence.Primary
};
}
}]);
function verbatimLiteral(str) {
return {
type: 'Literal',
value: 0,
'x-verbatim-property': {
content: str,
precedence : gen.Precedence.Primary
}
}
}
'elements': this.unicodeArray.map(function (value) {
return {
'type': NodeType_1.NodeType.Literal,
'value': value,
'raw': '\'' + value + '\'',
'x-verbatim-property': {
'content': value,
precedence: escodegen.Precedence.Primary
}
};
})
}
leave: function (currentNode, parentNode) {
if (currentNode.type === syntax.Literal && typeof currentNode.raw !== 'undefined') {
currentNode['x-verbatim-espower'] = {
content: currentNode.raw,
precedence: escodegen.Precedence.Primary
};
return currentNode;
} else {
return undefined;
}
}
};
public obfuscateNode (literalNode: any, parentNode: any): void {
if (parentNode.type === 'Property' && parentNode.key === literalNode) {
return;
}
switch (typeof literalNode.value) {
case 'string':
if (literalNode['x-verbatim-property']) {
break;
}
literalNode['x-verbatim-property'] = {
content : this.replaceLiteralStringByArrayElement(literalNode.value),
precedence: escodegen.Precedence.Primary
};
break;
}
}
}