| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 771abcb commit 60d6141
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -747,13 +747,13 @@ ObjectDefineProperties(URLSearchParams.prototype, { | |||
| 747 | 747 | * We use `href` and `protocol` as they are the only properties that are | |
| 748 | 748 | * easy to retrieve and calculate due to the lazy nature of the getters. | |
| 749 | 749 | * | |
| 750 | - * We check for auth attribute to distinguish legacy url instance with | ||
| 750 | + * We check for `auth` and `path` attribute to distinguish legacy url instance with | ||
| 751 | 751 | * WHATWG URL instance. | |
| 752 | 752 | * @param {*} self | |
| 753 | 753 | * @returns {self is URL} | |
| 754 | 754 | */ | |
| 755 | 755 | function isURL(self) { | |
| 756 | - return Boolean(self?.href && self.protocol && self.auth === undefined); | ||
| 756 | + return Boolean(self?.href && self.protocol && self.auth === undefined && self.path === undefined); | ||
| 757 | 757 | } | |
| 758 | 758 | ||
| 759 | 759 | class URL { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,3 +9,8 @@ const { isURL } = require('internal/url'); | |||
| 9 | 9 | ||
| 10 | 10 | assert.strictEqual(isURL(new URL('https://www.nodejs.org')), true); | |
| 11 | 11 | assert.strictEqual(isURL(parse('https://www.nodejs.org')), false); | |
| 12 | + assert.strictEqual(isURL({ | ||
| 13 | + href: 'https://www.nodejs.org', | ||
| 14 | + protocol: 'https:', | ||
| 15 | + path: '/', | ||
| 16 | + }), false); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments