mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
lib: use bracket notation instead of startsWith/endsWith for single char
Signed-off-by: Taejin Kim <rlaxowls1316@naver.com> PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
774f663c56
commit
6bf852197d
1 file changed
+1
-1
@@ -157,7 +157,7 @@ class SocketAddress {
|
||||
hostname: address,
|
||||
port,
|
||||
} = URLParse(`http://${input}`);
|
||||
if (address.startsWith('[') && address.endsWith(']')) {
|
||||
if (address[0] === '[' && address[address.length - 1] === ']') {
|
||||
return new SocketAddress({
|
||||
address: address.slice(1, -1),
|
||||
port: port | 0,
|
||||
|
||||
Reference in new issue
Block a user