0.1.0 • Published 6 years ago
escape-template-string v0.1.0
escape-template-string
Escape a string so that it can be eval-ed in as a template literal.
console.log(escape(`(function() {
var x = 'test';
return \`\${x}\\n\${x}\`;
})`));
// This prints the string below, which can be eval-ed in.
// `(function() {
// var x = 'test';
// return \`\${x}\\n\${x}\`;
// })`
0.1.0
6 years ago