(str: string)
| 136 | } |
| 137 | |
| 138 | export function escapeHTML(str: string) { |
| 139 | return str.replace( |
| 140 | /[&<>'"]/g, |
| 141 | tag => |
| 142 | ({ |
| 143 | '&': '&', |
| 144 | '<': '<', |
| 145 | '>': '>', |
| 146 | '\'': ''', |
| 147 | '"': '"', |
| 148 | }[tag] || tag), |
| 149 | ); |
| 150 | } |
| 151 | |
| 152 | export function unescapeHTML(str: string) { |
| 153 | return str.replace( |
no test coverage detected