This commit is contained in:
mindfulminun committed 2023-02-01 22:20:55 -06:00
1 parent db4a8529f7
commit 8d0e185e96
8 files changed
+269 -5

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
/**
* HTML escape sequences for unsafe characters
*/
export const HTML_ESCAPES = {
export const HTML_ESCAPES = {
"&": "&",
"<": "&lt;",
">": "&gt;",
@@ -91,6 +91,6 @@ export function templateNoop(
* @author MindfulMinun
* @since 2020-06-23
*/
export function xss(unsafe: string): string {
export function xss(unsafe: string): string {
return unsafe.replace(/[&<>"'\/]/g, key => HTML_ESCAPES[key as keyof typeof HTML_ESCAPES])
}