Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function toString(jsAst, code) {
const g = new CodeGenerator(jsAst, {}, code);
// Babel sanitises strings to not contain complex characters
// however we need them in order to be able to render complex strings
g._generator.StringLiteral = function(node, parent) {
var raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.token(raw);
return;
}
return this.token(JSON.stringify(node.value));
};
return g.generate();
}