veloze
Version:
A modern and fast express-like webserver for the web
37 lines (24 loc) • 678 B
Markdown
[◀︎ utils/cookie](../utils/cookie.md)
[🛖](../index.md)
[utils/ms ▶](../utils/ms.md)
# utils/escapeHtml
Escape HTML.
# escapeHtml()
escape HTML and prevent double escaping of '&'
```js
import { utils } from 'veloze'
const { escapeHtml } = utils
escapeHTML('<h1>"One" & \'Two\' & Works</h1>')
// <h1>"One" & 'Two' & Works</h1>
```
# escapeHtmlLit
Escape all vars in a template literal
```js
import { utils } from 'veloze'
const { escapeHtmlLit } = utils
const title = `"One" & 'Two' & Works`
escapeHtmlLit`<h1>${title}</h1>`
// <h1>"One" & 'Two' & Works</h1>;
```
---
[🔝 TOP](#top)