Utility module for detecting personal/consumer email providers, distinguishing them from business/corporate domains. ## Key Components | Export | Type | Description | |--------|------|-------------| | `GENERIC_EMAIL_DOMAINS` | `const` array | Readonly list of ~30 known generic email domains (Gmail, Yahoo, iCloud, ISPs, international providers) | | `GenericEmailDomain` | `type` | Union type inferred from `GENERIC_EMAIL_DOMAINS` entries | | `extractDomainFromEmail` | `function` | Parses the domain portion from an email address string | | `normalizeDomain` | `function` | Strips protocol, `www.`, and paths from a domain or URL string | | `isGenericDomain` | `function` | Returns `true` if a domain matches any entry in `GENERIC_EMAIL_DOMAINS` | | `hasGenericEmailDomain` | `function` | Checks whether an email address belongs to a generic provider | | `isGenericWebsiteDomain` | `function` | Checks whether a website URL resolves to a generic provider domain | ## Usage Example ```typescript import { extractDomainFromEmail, hasGenericEmailDomain, isGenericDomain, isGenericWebsiteDomain, } from './generic-domain-utils' // Extract domain from email extractDomainFromEmail('user@gmail.com') // → 'gmail.com' extractDomainFromEmail('invalid-email') // → null // Check if an email uses a generic provider hasGenericEmailDomain('user@gmail.com') // → true hasGenericEmailDomain('user@acme.com') // → false // Check a raw domain string isGenericDomain('yahoo.com') // → true // Check a website URL (strips protocol/www automatically) isGenericWebsiteDomain('https://www.gmail.com/inbox') // → true isGenericWebsiteDomain('https://acme.com') // → false ``` > **Typical use case:** Gate B2B sign-up flows or lead enrichment pipelines by rejecting personal email addresses — ensuring only corporate domains are accepted for company-linked records.