Skip to content

Commit 8435ef4

Browse files
committed
net: slit comments
1 parent 0ad8c9f commit 8435ef4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/internal/socketaddress.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,11 @@ class SocketAddress {
161161
const isIPv6 = address[0] === '[' && address.endsWith(']');
162162

163163
// Strip userinfo (e.g. "user:pass@") before searching for port separator.
164-
// For IPv6, indexOf(']:') + 1 points at ':' (or 0 if absent, treated as no port).
165-
// For IPv4, lastIndexOf(':') points at ':' (or -1 if absent).
166164
const atIdx = input.lastIndexOf('@');
167165
const hostPart = atIdx >= 0 ? input.slice(atIdx + 1) : input;
166+
167+
// For IPv6, indexOf(']:') + 1 points at ':' (or 0 if absent, treated as no port).
168+
// For IPv4, lastIndexOf(':') points at ':' (or -1 if absent).
168169
const sepIdx = isIPv6 ? hostPart.indexOf(']:') + 1 : hostPart.lastIndexOf(':');
169170
const port = sepIdx > 0 ? NumberParseInt(hostPart.slice(sepIdx + 1), 10) || 0 : 0;
170171

0 commit comments

Comments
 (0)