normalize-url
Advanced tools
Comparing version 3.1.0 to 3.2.0
11
index.js
@@ -51,5 +51,12 @@ 'use strict'; | ||
// Remove duplicate slashes | ||
// Remove duplicate slashes if not preceded by a protocol | ||
if (urlObj.pathname) { | ||
urlObj.pathname = urlObj.pathname.replace(/\/{2,}/g, '/'); | ||
// TODO: Use the following instead when targeting Node.js 10 | ||
// `urlObj.pathname = urlObj.pathname.replace(/(?<!https?:)\/{2,}/g, '/');` | ||
urlObj.pathname = urlObj.pathname.replace(/((?![https?:]).)\/{2,}/g, (_, p1) => { | ||
if (/^(?!\/)/g.test(p1)) { | ||
return `${p1}/`; | ||
} | ||
return '/'; | ||
}); | ||
} | ||
@@ -56,0 +63,0 @@ |
{ | ||
"name": "normalize-url", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Normalize a URL", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9013
98