const ESCAPES = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; export function escapeHtml(str) { return str.replace(/[&<>"']/g, c => ESCAPES[c]); }