(html: string)
| 74 | .replaceAll(">", ">"); |
| 75 | |
| 76 | const inputFields = (html: string): Record<string, string> => { |
| 77 | const fields: Record<string, string> = {}; |
| 78 | for (const input of html.matchAll(/<input\b[^>]*>/gi)) { |
| 79 | const tag = input[0]; |
| 80 | const name = tag.match(/\bname=["']([^"']+)["']/i)?.[1]; |
| 81 | const value = tag.match(/\bvalue=["']([^"']*)["']/i)?.[1] ?? ""; |
| 82 | if (name) fields[decodeHtml(name)] = decodeHtml(value); |
| 83 | } |
| 84 | return fields; |
| 85 | }; |
| 86 | |
| 87 | const formAction = (html: string, fallback: string): string => { |
| 88 | const action = html.match(/<form\b[^>]*\baction=["']([^"']+)["']/i)?.[1]; |
no test coverage detected