We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e62937 commit 7563affCopy full SHA for 7563aff
1 file changed
lib/internal/socketaddress.js
@@ -158,7 +158,7 @@ class SocketAddress {
158
// the raw input string instead.
159
const { hostname: address } = URLParse(`http://${input}`);
160
161
- const isIPv6 = address.startsWith('[') && address.endsWith(']');
+ const isIPv6 = address[0] === '[' && address.endsWith(']');
162
163
// For IPv6, indexOf(']:') + 1 points at ':' (or 0 if absent, treated as no port).
164
// For IPv4, lastIndexOf(':') points at ':' (or -1 if absent).
0 commit comments