(html: string, encode?: boolean)
| 13 | const getEscapeReplacement = (ch: string) => escapeReplacements[ch]; |
| 14 | |
| 15 | export function escapeHtmlEntities(html: string, encode?: boolean) { |
| 16 | if (encode) { |
| 17 | if (other.escapeTest.test(html)) { |
| 18 | return html.replace(other.escapeReplace, getEscapeReplacement); |
| 19 | } |
| 20 | } else { |
| 21 | if (other.escapeTestNoEncode.test(html)) { |
| 22 | return html.replace(other.escapeReplaceNoEncode, getEscapeReplacement); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | return html; |
| 27 | } |
| 28 | |
| 29 | export function cleanUrl(href: string) { |
| 30 | try { |