UNPKG

ant-design-x-vue-next

Version:

Ant Design X for Vue — community continuation aligned with @ant-design/x

20 lines (19 loc) 450 B
const s = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "/": "&#x2F;" }, a = /[&<>"'/]/, n = /[&<>"'/]/g, p = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, o = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, c = (e) => s[e]; function r(e, t) { if (t) { if (a.test(e)) return e.replace(n, c); } else if (p.test(e)) return e.replace(o, c); return e; } export { r as escapeHtml };