From 5355e9fd432a07f832a1c315a225d90527afd13b Mon Sep 17 00:00:00 2001 From: Taejin Kim Date: Sat, 24 Jan 2026 10:17:49 +0900 Subject: [PATCH] lib: use bracket notation instead of startsWith/endsWith for single char Signed-off-by: Taejin Kim --- lib/internal/socketaddress.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/socketaddress.js b/lib/internal/socketaddress.js index 724ffd90cf77..28696d6cc87f 100644 --- a/lib/internal/socketaddress.js +++ b/lib/internal/socketaddress.js @@ -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,