Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function escapeHtml(str) {
- // html escape from Underscore.js https://coderwall.com/p/ostduq/escape-html-with-javascript
- let entityMap = {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': '"',
- "'": ''',
- "/": '/'
- };
- return str.toString().replace(/[&<>"'\/]/g, (s) => entityMap[s]);
- }
Add Comment
Please, Sign In to add comment