(email: string)
| 33 | * boundary — so a stale PSL is low-impact. |
| 34 | */ |
| 35 | export function extractEmailDomain(email: string): string | null { |
| 36 | const atIndex = email.lastIndexOf('@'); |
| 37 | if (atIndex === -1) return null; |
| 38 | const host = email.slice(atIndex + 1).toLowerCase(); |
| 39 | if (host.length === 0) return null; |
| 40 | const registrable = getDomain(host, { allowPrivateDomains: true }); |
| 41 | if (registrable !== null) return registrable; |
| 42 | return `${host}.invalid`; |
| 43 | } |
no outgoing calls
no test coverage detected