Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

escape-html-template-tag

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escape-html-template-tag - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "escape-html-template-tag",
"version": "1.0.0",
"version": "1.0.1",
"description": "Tag literal strings with this function to html escape interpolated values",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -66,2 +66,27 @@ # escape-html-template-tag

// </div>
```
### Compose templates easily with functions
```js
const html = require('escape-html-template-tag')
const anchor = (text, href) => html`<a href="${href}">${text}</a>`
const list = items => html`
<ul>
${items.map(item => html`<li>${item}</li>`)}
</ul>
`
const navigation = list(
anchor('Home', '/home'),
anchor('About', '/about'),
anchor('Blog', '/blog')
);
// <ul>
// <li><a href="&#x2F;home">Home</a></li>
// <li><a href="&#x2F;about">About</a></li>
// <li><a href="&#x2F;blog">Blog</a></li>
// </ul>
```

@@ -32,2 +32,1 @@ const assert = require('assert')

assert.strictEqual(String(escapeHtml`${escapeHtml.safe(escapeHtml`<a>`)}`), '<a>')
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc