FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

lib: use bracket notation instead of startsWith/endsWith for single char · nodejs/node@b71d5de · GitHub

/ node Public

Commit b71d5de

Browse files
authored andcommitted
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 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)

Back | FazBrowse Home | New Git URL