(html: string, pattern: RegExp)
| 113 | } |
| 114 | |
| 115 | function extractFirstMatch(html: string, pattern: RegExp): string | undefined { |
| 116 | const match = html.match(pattern) |
| 117 | if (!match?.[1]) return undefined |
| 118 | return normalizeText(decodeHtmlEntities(stripTags(match[1]))) |
| 119 | } |
| 120 | |
| 121 | function stripTags(html: string): string { |
| 122 | return html.replace(/<[^>]*>/g, ' ') |
no test coverage detected