normalize-url
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -64,6 +64,6 @@ export type Options = { | ||
``` | ||
normalizeUrl('user:password@sindresorhus.com'); | ||
normalizeUrl('https://user:password@sindresorhus.com'); | ||
//=> 'https://sindresorhus.com' | ||
normalizeUrl('user:password@sindresorhus.com', {stripAuthentication: false}); | ||
normalizeUrl('https://user:password@sindresorhus.com', {stripAuthentication: false}); | ||
//=> 'https://user:password@sindresorhus.com' | ||
@@ -289,2 +289,4 @@ ``` | ||
Human-friendly URLs with basic auth (for example, `user:password@sindresorhus.com`) are not handled because basic auth conflicts with custom protocols. [Basic auth URLs are also deprecated.](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#access_using_credentials_in_the_url) | ||
@param url - URL to normalize, including [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs). | ||
@@ -291,0 +293,0 @@ |
@@ -16,3 +16,6 @@ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | ||
const {protocol} = new URL(urlString); | ||
return protocol.endsWith(':') && !supportedProtocols.has(protocol); | ||
return protocol.endsWith(':') | ||
&& !protocol.includes('.') | ||
&& !supportedProtocols.has(protocol); | ||
} catch { | ||
@@ -19,0 +22,0 @@ return false; |
{ | ||
"name": "normalize-url", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "Normalize a URL", | ||
@@ -18,2 +18,3 @@ "license": "MIT", | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
@@ -23,3 +24,4 @@ "node": ">=14.16" | ||
"scripts": { | ||
"test": "xo && c8 ava && tsd" | ||
"//test": "xo && c8 ava && tsd", | ||
"test": "c8 ava && tsd" | ||
}, | ||
@@ -26,0 +28,0 @@ "files": [ |
@@ -15,4 +15,2 @@ # normalize-url [![Coverage Status](https://codecov.io/gh/sindresorhus/normalize-url/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/normalize-url) | ||
*If you need Safari support, use version 4: `npm i normalize-url@4`* | ||
## Usage | ||
@@ -36,2 +34,4 @@ | ||
Human-friendly URLs with basic auth (for example, `user:password@sindresorhus.com`) are not handled because basic auth conflicts with custom protocols. [Basic auth URLs are also deprecated.](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#access_using_credentials_in_the_url) | ||
#### url | ||
@@ -108,6 +108,6 @@ | ||
```js | ||
normalizeUrl('user:password@sindresorhus.com'); | ||
normalizeUrl('https://user:password@sindresorhus.com'); | ||
//=> 'https://sindresorhus.com' | ||
normalizeUrl('user:password@sindresorhus.com', {stripAuthentication: false}); | ||
normalizeUrl('https://user:password@sindresorhus.com', {stripAuthentication: false}); | ||
//=> 'https://user:password@sindresorhus.com' | ||
@@ -316,13 +316,1 @@ ``` | ||
- [compare-urls](https://github.com/sindresorhus/compare-urls) - Compare URLs by first normalizing them | ||
--- | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-normalize-url?utm_source=npm-normalize-url&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
25854
458
313