Files
openclaw/src/shared/html-escape.ts
T
2026-07-28 12:11:08 +02:00

10 lines
302 B
TypeScript

/** Escapes text for safe insertion into HTML text and quoted attribute values. */
export function escapeHtml(value: string): string {
return value
.replaceAll("&", "&")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#39;");
}