diff --git a/index.js b/index.js index f8297f5..4727186 100644 --- a/index.js +++ b/index.js @@ -120,8 +120,38 @@ 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(/(?=12.20" }, "scripts": { - "test": "xo && nyc ava && tsd" + "test": "xo && c8 ava && tsd" }, "files": [ "index.js", @@ -39,11 +39,12 @@ ], "devDependencies": { "ava": "^3.15.0", - "nyc": "^15.1.0", + "c8": "^7.7.3", "tsd": "^0.17.0", + "typescript": "^4.3.5", "xo": "^0.41.0" }, - "nyc": { + "c8": { "reporter": [ "text", "lcov" diff --git a/test.js b/test.js index d19b128..149b51a 100644 --- a/test.js +++ b/test.js @@ -269,19 +269,19 @@ test('invalid urls', t => { t.throws(() => { normalizeUrl('http://'); }, { - message: 'Invalid URL', + message: /^Invalid URL/, }); t.throws(() => { normalizeUrl('/'); }, { - message: 'Invalid URL', + message: /^Invalid URL/, }); t.throws(() => { normalizeUrl('/relative/path/'); }, { - message: 'Invalid URL', + message: /^Invalid URL/, }); });