export function escapeHTML(str) {
if (typeof str !== 'string') return '';
return str.replace(/[&<>"']/g, function(c) {
return {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
'\'': '''
} [c]
})
}
export function textToHTML(text) {
if (typeof text !== 'string') return '';
return escapeHTML(text).replace(/\n/g, '
')
}