Socket
Socket
Sign inDemoInstall

html-sanitize

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-sanitize

This module Sanitizes HTML input, stripping all tags and attributes that aren't whitelisted.HTML sanitization can be used to protect against cross-site scripting (XSS) attacks by sanitizing any HTML code submitted by a user.


Version published
Maintainers
1
Weekly downloads
1,167
decreased by-48.16%
Bundle size
240 bytes
Minified + gzipped

Weekly downloads

Readme

Source

html_sanitize

A small library providing utility methods to escape and unescape HTML entities

Installation

npm install html_sanitize --save

Usage

  var html_sanitize = require('html_sanitize')
      escape = html_sanitize.escape,
      unescape = html_sanitize.unescape;

  var html = '<h1>Hello World</h1>',
      escaped = escape(html),
      unescaped = unescape(escaped);

  console.log('html', html, 'escaped', escaped, 'unescaped', unescaped);

Tests

npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Release History

  • 1.1.5 Initial release

Keywords

FAQs

Last updated on 28 Oct 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