Socket
Socket
Sign inDemoInstall

html-escaper

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    html-escaper

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


Version published
Weekly downloads
20M
decreased by-19.39%
Maintainers
1
Created
Weekly downloads
 

Package description

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

Readme

Source

html-escaper

A module to escape/unescape common problematic entities done the right way.

Keywords

FAQs

Last updated on 08 Apr 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc