13 lines
358 B
TypeScript
13 lines
358 B
TypeScript
|
export function doubleQuoteEncode(text: string): string {
|
||
|
return text
|
||
|
.replace(/"/g, '"')
|
||
|
}
|
||
|
|
||
|
export function htmlEncode(text: string): string {
|
||
|
return doubleQuoteEncode(text
|
||
|
.replace(/&/g, '&')
|
||
|
.replace(/\//g, '/')
|
||
|
.replace(/</g, '<')
|
||
|
.replace(/>/g, '>')
|
||
|
.replace(/'/g, '''));
|
||
|
}
|