diff --git a/lib/internal/modules/esm/fetch_module.js b/lib/internal/modules/esm/fetch_module.js index 07904e685becf8..8f18e9bf04e0b4 100644 --- a/lib/internal/modules/esm/fetch_module.js +++ b/lib/internal/modules/esm/fetch_module.js @@ -3,9 +3,7 @@ const { ObjectPrototypeHasOwnProperty, PromisePrototypeThen, SafeMap, - StringPrototypeEndsWith, StringPrototypeSlice, - StringPrototypeStartsWith, } = primordials; const { Buffer: { concat: BufferConcat }, @@ -248,8 +246,8 @@ allowList.addRange('127.0.0.1', '127.255.255.255'); async function isLocalAddress(hostname) { try { if ( - StringPrototypeStartsWith(hostname, '[') && - StringPrototypeEndsWith(hostname, ']') + hostname[0] === '[' && + hostname[hostname.length - 1] === ']' ) { hostname = StringPrototypeSlice(hostname, 1, -1); }