escape-html.ts 209 B

12345678
  1. export function escapeHtml(value: string): string {
  2. return value
  3. .replace(/&/g, '&')
  4. .replace(/</g, '&lt;')
  5. .replace(/>/g, '&gt;')
  6. .replace(/"/g, '&quot;')
  7. .replace(/'/g, '&#39;');
  8. }