JSPM

html-escape

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7268
  • Score
    100M100P100Q130164F
  • License Public Domain

Escape reserved HTML characters

Package Exports

  • html-escape

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-escape) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

html-escape

Escape a string to be safe for use in HTML by replacing all five reserved characters (&<>'") with their respective entity.

Example

var escape = require("html-escape");

var xss = "Hello <script>while(1);</script> world!";

// Produce html that could be safely used
console.log("<p>" + escape(xss) + "</p>");

Installation

npm install html-escape