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

html-escaper

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-escaper

fast and safe way to escape and unescape &<>'" chars

  • 3.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28M
increased by9.59%
Maintainers
1
Weekly downloads
 
Created

What is html-escaper?

The html-escaper npm package is designed to escape and unescape HTML entities. It is useful for preventing XSS attacks by sanitizing user input or for properly displaying text that includes characters that are reserved in HTML.

What are html-escaper's main functionalities?

Escape HTML

Escapes HTML entities to prevent execution of potentially harmful scripts and to display HTML tags as plain text.

const { escape } = require('html-escaper');
const escapedString = escape('<div>Hello & Welcome!</div>');
console.log(escapedString); // &lt;div&gt;Hello &amp; Welcome!&lt;/div&gt;

Unescape HTML

Unescapes HTML entities to convert them back to their original characters, which is useful for rendering text that was previously escaped.

const { unescape } = require('html-escaper');
const unescapedString = unescape('&lt;div&gt;Hello &amp; Welcome!&lt;/div&gt;');
console.log(unescapedString); // <div>Hello & Welcome!</div>

Other packages similar to html-escaper

Keywords

FAQs

Package last updated on 18 Feb 2021

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

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