Files
2025-11-28 19:45:44 -07:00

13 lines
224 B
JavaScript

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