Skip to content

Commit d6f31dc

Browse files
committed
lib: use bracket notation instead of startsWith/endsWith for single char
1 parent 5d39030 commit d6f31dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/socketaddress.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class SocketAddress {
157157
hostname: address,
158158
port,
159159
} = URLParse(`http://${input}`);
160-
if (address.startsWith('[') && address.endsWith(']')) {
160+
if (address[0] === '[' && address[address.length - 1] === ']') {
161161
return new SocketAddress({
162162
address: address.slice(1, -1),
163163
port: port | 0,

0 commit comments

Comments
 (0)