From 3c6deebd3a156d236cae434ba4e5345139d9d4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 11 Aug 2021 14:58:41 +0200 Subject: [PATCH 1/2] avoid use of negative lookbehind entirely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- index.js | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f8297f5..616c961 100644 --- a/index.js +++ b/index.js @@ -120,8 +120,36 @@ export default function normalizeUrl(urlString, options) { } // Remove duplicate slashes if not preceded by a protocol + // NOTE: This could be implemented using a single negative lookbehind + // regex, but we avoid that to maintain compatibility with older js engines + // which do not have support for that feature. if (urlObject.pathname) { - urlObject.pathname = urlObject.pathname.replace(/(? Date: Wed, 11 Aug 2021 15:32:13 +0200 Subject: [PATCH 2/2] Update index.js --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 616c961..4727186 100644 --- a/index.js +++ b/index.js @@ -124,6 +124,8 @@ export default function normalizeUrl(urlString, options) { // regex, but we avoid that to maintain compatibility with older js engines // which do not have support for that feature. if (urlObject.pathname) { + // TODO: Replace everything below with `urlObject.pathname = urlObject.pathname.replace(/(?