Skip to content

Commit 88a6403

Browse files
authored
Merge pull request #281 from CanadaHonk/whatwg-url
refactor: replace url.parse with new URL
2 parents 0280670 + b75afa1 commit 88a6403

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

markdown-link-check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ function getInputs() {
6969
stream.on('error', onError);
7070
stream.on('response', onResponse);
7171
try { // extract baseUrl from supplied URL
72-
const parsed = url.parse(filenameOrUrl);
73-
delete parsed.search;
74-
delete parsed.hash;
72+
const parsed = new URL(filenameOrUrl);
73+
parsed.search = '';
74+
parsed.hash = '';
7575
if (parsed.pathname.lastIndexOf('/') !== -1) {
7676
parsed.pathname = parsed.pathname.substr(0, parsed.pathname.lastIndexOf('/') + 1);
7777
}
78-
baseUrl = url.format(parsed);
78+
baseUrl = parsed.toString();
7979
} catch (err) { /* ignore error */
8080
}
8181
} else {

0 commit comments

Comments
 (0)