diff --git a/lib/internal/url.js b/lib/internal/url.js index 9c18aab07ff19d..c2d2971e168a37 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -767,7 +767,11 @@ ObjectDefineProperties(URLSearchParams.prototype, { * @returns {self is URL} */ function isURL(self) { - return Boolean(self?.href && self.protocol && self.auth === undefined && self.path === undefined); + return Boolean(typeof self === 'object' && + self?.href && + self.protocol && + self.auth === undefined && + self.path === undefined); } /**