Skip to content

Commit b75afa1

Browse files
committed
refactor: replace url.parse with new URL
`url.parse` is deprecated, `new URL` is supported since Node v10.
1 parent 1a5a675 commit b75afa1

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
@@ -66,13 +66,13 @@ function getInputs() {
6666
stream.on('error', onError);
6767
stream.on('response', onResponse);
6868
try { // extract baseUrl from supplied URL
69-
const parsed = url.parse(filenameOrUrl);
70-
delete parsed.search;
71-
delete parsed.hash;
69+
const parsed = new URL(filenameOrUrl);
70+
parsed.search = '';
71+
parsed.hash = '';
7272
if (parsed.pathname.lastIndexOf('/') !== -1) {
7373
parsed.pathname = parsed.pathname.substr(0, parsed.pathname.lastIndexOf('/') + 1);
7474
}
75-
baseUrl = url.format(parsed);
75+
baseUrl = parsed.toString();
7676
} catch (err) { /* ignore error */
7777
}
7878
} else {

0 commit comments

Comments
 (0)