From b75afa1840920e6bb7f49b3120e2e0e1cf897049 Mon Sep 17 00:00:00 2001 From: CanadaHonk Date: Tue, 17 Oct 2023 19:49:09 +0100 Subject: [PATCH] refactor: replace url.parse with new URL `url.parse` is deprecated, `new URL` is supported since Node v10. --- markdown-link-check | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/markdown-link-check b/markdown-link-check index 210b6c3..7be6206 100755 --- a/markdown-link-check +++ b/markdown-link-check @@ -66,13 +66,13 @@ function getInputs() { stream.on('error', onError); stream.on('response', onResponse); try { // extract baseUrl from supplied URL - const parsed = url.parse(filenameOrUrl); - delete parsed.search; - delete parsed.hash; + const parsed = new URL(filenameOrUrl); + parsed.search = ''; + parsed.hash = ''; if (parsed.pathname.lastIndexOf('/') !== -1) { parsed.pathname = parsed.pathname.substr(0, parsed.pathname.lastIndexOf('/') + 1); } - baseUrl = url.format(parsed); + baseUrl = parsed.toString(); } catch (err) { /* ignore error */ } } else {