0.1.0 • Published 6 years ago

escape-template-string v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

escape-template-string Build Status

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}\`;
// })`