Skip to content

Commit b71d5de

Browse files
kimtaejin3aduh95
authored andcommitted
lib: use bracket notation instead of startsWith/endsWith for single char
Signed-off-by: Taejin Kim <[email protected]> PR-URL: #61500 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jordan Harband <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 788976c commit b71d5de

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)