# escape-template-string

> Escape a string so that it can be eval-ed in as a template literal.

Latest version **0.1.0** (published 2018-11-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install escape-template-string
pnpm add escape-template-string
yarn add escape-template-string
bun add escape-template-string
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-11-18 |
| First published | 2018-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 846 B |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Varun Ramesh |
| Maintainers | vramesh |

## Links

- npm: https://www.npmjs.com/package/escape-template-string
- Repository: https://github.com/rameshvarun/escape-template-string
- Homepage: https://github.com/rameshvarun/escape-template-string#readme
- Issues: https://github.com/rameshvarun/escape-template-string/issues
- npm.io page: https://npm.io/package/escape-template-string

## Recent versions

- 0.1.0 (latest) — 2018-11-18

## README

# escape-template-string

[![Node.js CI](https://github.com/rameshvarun/escape-template-string/actions/workflows/node.js.yml/badge.svg)](https://github.com/rameshvarun/escape-template-string/actions/workflows/node.js.yml)

Escape a string so that it can be eval-ed in as a template literal. This is useful for projects such as [ProtoWorld](https://github.com/rameshvarun/protoworld/blob/ac53623145411c01002eb8e601add71c06c408c1/src/modules/interface.js#L39) that generate human-readable JavaScript code.

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

---
_Source: https://npm.io/package/escape-template-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
