Skip to content

Commit 2df4ce7

Browse files
authored
lib: use bracket notation instead of startsWith/endsWith for single char
Signed-off-by: Taejin Kim <rlaxowls1316@naver.com> PR-URL: #61500 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 97c7e32 commit 2df4ce7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)