/**
 * Escape given string for use in HTML string.
 */ export function escapeHtml ( str ) { return str . replace ( /[&<>"']/g , replacer ) ; } function replacer ( char ) { switch ( char ) { case "&" : return "&amp;" ; case "<" : return "&lt;" ; case ">" : return "&gt;" ; case '"' : return "&quot;" ; case "'" : return "&#39;" ; default : return char ; } }