‚̧Nondeterministic Polynomial Munchies
    Have ideas to improve npm?Join in the discussion! ¬Ľ

    html-escape

    2.0.0¬†‚Äʬ†Public¬†‚Äʬ†Published

    html-escape

    Escape a string to be safe for use in html. &, <, ', and " characters are replaced with with their named character references: &amp;, &lt;, &apos;, and &quot;. Escaped strings will be safe for use in the following contexts:

    Example

    var escape = require("html-escape");
    var xssAttempt = "Hello <script>while(1);</script> world!";
    // Output safe html
    console.log("<p>" + escape(xssAttempt) + "</p>");
    // "<p>Hello &lt;script>while(1);&lt;/script> world!</p>"

    Installation

    npm install html-escape
    

    Install

    npm i html-escape

    DownloadsWeekly Downloads

    3,153

    Version

    2.0.0

    License

    Public Domain

    Last publish

    Collaborators

    • avatar