Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

eskape

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eskape

html escaping as an es6 tagged template string

latest
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

eskape

html escaping as an es6 tagged template string in 1k min+gz.

Installation

npm install --save eskape

Usage

eskape escapes all of the interpolated values in the template string, but assumes all literal content is safe. This is often a good assumption when performing quick, one-off templating like so:

var eskape = require('eskape');

var userinput = "<script>alert('gotcha')</script>";
document.body.innerHTML = eskape`
  <html>
    <body>
      Hello, ${userinput}
    </body>
  </html>`;

This will set the body's html content to the literal html content in the string, but will escape the userinput value.

License

(c) 2016 Will Binns-Smith. Licensed MIT.

Keywords

es6

FAQs

Package last updated on 23 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts