export function escapeHTML (str: string, type = 'dom') {
    if (type !== 'dom') {
        const dom = document.createElement("div")
        dom.textContent = str

        return dom.innerHTML
    } else {
        return str.replace(/[&<>"']/g, (match) => ({
            '&': '&amp;',
            '<': '&lt;',
            '>': '&gt;',
            '"': '&quot;',
            "'": '&#39;'
        }[match]));

    }

}