All checks were successful
Deploy / Deploy to Production (push) Successful in 6s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
19 lines
465 B
TypeScript
19 lines
465 B
TypeScript
/**
|
|
* Decodes HTML entities in a string
|
|
* @param text The text that may contain HTML entities
|
|
* @returns The decoded text
|
|
*/
|
|
export function decodeHTMLEntities(text: string): string {
|
|
const entityMap: Record<string, string> = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"',
|
|
''': "'",
|
|
'/': '/',
|
|
'`': '`',
|
|
'=': '='
|
|
};
|
|
|
|
return text.replace(/&[#\w]+;/g, (entity) => entityMap[entity] || entity);
|
|
}
|