Node.js examples for String:HTML String
Encode HTML string
function encodeHTML(source) { return String(source) .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); }