(str: string)
| 310 | } |
| 311 | |
| 312 | export function parseErrorHtml(str: string): string { |
| 313 | const elements = []; |
| 314 | const regexes = [ |
| 315 | /<title.*?>([\s\S]*?)<\/title>/g, |
| 316 | /<h1.*?>([\s\S]*?)<\/h1>/g, |
| 317 | /<h2.*?>([\s\S]*?)<\/h2>/g, |
| 318 | /<h3.*?>([\s\S]*?)<\/h3>/g, |
| 319 | ]; |
| 320 | for (const regex of regexes) { |
| 321 | let match = str.match(regex); |
| 322 | if (match) { |
| 323 | elements.push( |
| 324 | match |
| 325 | .map((m) => |
| 326 | m |
| 327 | .match(/<.*?>([\s\S]*?)<\/.*?>/)![1] |
| 328 | .trim() |
| 329 | .replace(/\s+/g, " "), |
| 330 | ) |
| 331 | .join(" "), |
| 332 | ); |
| 333 | } |
| 334 | } |
| 335 | const result = elements.filter(Boolean).join("\n"); |
| 336 | return result.length > 0 ? result : str; |
| 337 | } |
| 338 | |
| 339 | export function replaceVariables( |
| 340 | input: string, |
no outgoing calls
no test coverage detected