angular-brackets-to-html-entites
v1.0.3
Published
Change the angular brackets in the string to '<' and '>' to avoid cross site scripting
Downloads
4
Readme
Hi Users!
Description
This package contains a function 'angularBracketsToEntites' which accepts a input string. If the string contains '<' & '>' it replaces it with '<' & '>' respectively and returns it. It is used to avoid cross site scripting as innerHTML renders the string with '<' '>' as valid tag if contains valid tag. Replacing it with the above entity will be rendered as string not as a tag.
How to use
npm i angular-brackets-to-html-entites
- Demo purpose I have used console.log
const { angularBracketsToEntites } = require("../removeAngularBracket/main");
console.log(angularBracketsToEntites("<h1>Hello</h1>"));