(options: LookupOptions)
| 41 | * Handles: 0 | 4 | 6 | 'IPv4' | 'IPv6' | undefined |
| 42 | */ |
| 43 | export function getAddressFamily(options: LookupOptions): 0 | 4 | 6 { |
| 44 | switch (options.family) { |
| 45 | case 0: |
| 46 | case 4: |
| 47 | case 6: |
| 48 | return options.family |
| 49 | case 'IPv6': |
| 50 | return 6 |
| 51 | case 'IPv4': |
| 52 | case undefined: |
| 53 | return 4 |
| 54 | default: |
| 55 | throw new Error(`Unsupported address family: ${options.family}`) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | type EnvLike = Record<string, string | undefined> |
| 60 |
no outgoing calls
no test coverage detected