Escape a string to be safe for use in HTML by escaping reserved
characters
(&<>'"
).
> var escape = require("html-escape");
> var xssAttempt = "Hello <script>while(1);</script> world!";
> // Output safe html
> console.log("<p>" + escape(xssAttempt) + "</p>");
"<p>Hello <script>while(1);</script> world!</p>"
npm install html-escape