I have a chat app and I am using this to escape / sanitize user input,
function sanitize(string) { const map = { \'&\': \'&\', \'<\':