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