export function escapeHtml(str: string): string { const htmlEscapes: Record = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', }; return String(str).replace(/[&<>"']/g, (s) => htmlEscapes[s]); }