Created
September 20, 2018 11:14
-
-
Save baladkb/414abd412659d87f9a8021ef9feddbd1 to your computer and use it in GitHub Desktop.
replace uncode to special char in Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
entityMap : { | |
'&': '&', | |
'<': '<', | |
'>': '>', | |
//'"': '"', | |
//"'": ''', | |
//'/': '/', | |
//'`': '`', | |
'=': '=' | |
}, | |
escapeHtml(string) { | |
return String(string).replace(/[&<>"'`=\/]/g, function (s) { | |
return PromotionJS.entityMap[s]; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment