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