DenReg/jsx-html/node/utils/htmlEncode.ts
Fabian Stamm 1b2d85eeef
All checks were successful
continuous-integration/drone/push Build is passing
Adding hotfixes for packages
2020-10-14 02:56:11 +02:00

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, '&lt;')
.replace(/>/g, '&gt;')
.replace(/'/g, '&#39;'));
}