unescape-html
Version:
The reverse of escape-html
19 lines (16 loc) • 360 B
JavaScript
/**
* un-escape special characters in the given string of html.
*
* @param {String} html
* @return {String}
*/
module.exports = function (html) {
return String(html)
.replace(/"/g, '"')
.replace(/'/g, '\'')
.replace(/:/g, ':')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/&/g, '&')
}