Kind: Function
Source: src/utils/ipaddr.ts
Part of: Utils
Expand IPv6 Address
expandIPv6 expands an IPv6 address that uses compressed notation into its expanded colon-separated form. It is used by IP address handling code when later operations need each address segment represented explicitly.
Signature
tsfunction expandIPv6(ipV6: string): string
Parameters
| Name | Type |
|---|---|
ipV6 | string |
Returns: string
Diagram
mermaidgraph LR A[Compressed IPv6 address] --> B[expandIPv6] B --> C[Split address segments] C --> D[Expand omitted segments] D --> E[Expanded IPv6 address]
Usage
tsimport { expandIPv6 } from './utils/ipaddr';
const address = 'a::b';
const expandedAddress = expandIPv6(address);
console.log(expandedAddress);
AI Coding Instructions
- Pass IPv6 address strings to
expandIPv6before code that requires explicit address segments. - Keep compressed-address handling inside this utility rather than duplicating expansion logic in callers.
- Preserve colon-separated IPv6 formatting when changing this function.
- Check how callers handle invalid or already-expanded addresses before changing return behavior.
Was this page helpful?