From d6f31dcc7d35a9b792e0eb0fd894aebaa1365e20 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 --- 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 724ffd90cf77f1..28696d6cc87f6e 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,