(text: string)
| 1174 | |
| 1175 | // Decode HTML entities helper |
| 1176 | const decodeHtmlEntities = (text: string): string => { |
| 1177 | // & must be decoded last to avoid double-decoding (e.g. &lt; -> < -> <) |
| 1178 | return text |
| 1179 | .replace(/</g, '<') |
| 1180 | .replace(/>/g, '>') |
| 1181 | .replace(/"/g, '"') |
| 1182 | .replace(/'/g, "'") |
| 1183 | .replace(/ /g, ' ') |
| 1184 | .replace(/&#(\d+);/g, (_, dec) => String.fromCharCode(dec)) |
| 1185 | .replace(/&#x([0-9A-Fa-f]+);/g, (_, hex) => String.fromCharCode(parseInt(hex, 16))) |
| 1186 | .replace(/&/g, '&'); |
| 1187 | }; |
| 1188 | |
| 1189 | // Determine title (prefer og:title, then <title>) |
| 1190 | let title = ogTitleMatch?.[1] || titleMatch?.[1] || ''; |
no outgoing calls
no test coverage detected