/** * Escape special characters in the given string of html. * * @param {String} html * @return {String} */ module.exports = { escape: function(html) { return String(html) .replace(/&/g, '&') .replace(/"/g, '"') .replace(/'/g, ''') .replace(/</g, '<') .replace(/>/g, '>'); }, /** * Unescape special characters in the given string of html. * * @param {String} html * @return {String} */ unescape: function(html) { return String(html) .replace(/&/g, '&') .replace(/"/g, '"') .replace(/'/g, ''') .replace(/</g, '<') .replace(/>/g, '>'); } };