From 699ce1e4b3a1a5cb2f916e7eb24bd5083b36aac5 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 23 Feb 2022 00:15:03 +0700 Subject: [PATCH] Improve docs Fixes #159 --- index.d.ts | 8 ++++++-- readme.md | 9 ++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index caa264c..918f82a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,8 +1,10 @@ export interface Options { /** @default 'http:' + + Values: `'https:' | 'http:'` */ - readonly defaultProtocol?: string; + readonly defaultProtocol?: string; // TODO: Make this `'https:' | 'http:'` in the next major version. /** Prepends `defaultProtocol` to the URL if it's protocol-relative. @@ -87,7 +89,9 @@ export interface Options { readonly stripHash?: boolean; /** - Removes HTTP(S) protocol from an URL `http://sindresorhus.com` → `sindresorhus.com`. + Remove the protocol from the URL: `http://sindresorhus.com` → `sindresorhus.com`. + + It will only remove `https://` and `http://` protocols. @default false diff --git a/readme.md b/readme.md index 71d8638..4ac8df4 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,7 @@ Useful when you need to display, store, deduplicate, sort, compare, etc, URLs. npm install normalize-url ``` -*If you need to use this in the browser, use version 4: `npm i normalize-url@4`* +*If you need Safari support, use version 4: `npm i normalize-url@4`* ## Usage @@ -43,7 +43,8 @@ Type: `object` ##### defaultProtocol Type: `string`\ -Default: `http:` +Default: `http:`\ +Values: `'https:' | 'http:'` ##### normalizeProtocol @@ -127,7 +128,9 @@ normalizeUrl('sindresorhus.com/about.html#contact', {stripHash: true}); Type: `boolean`\ Default: `false` -Remove HTTP(S) protocol from the URL: `http://sindresorhus.com` → `sindresorhus.com`. +Remove the protocol from the URL: `http://sindresorhus.com` → `sindresorhus.com`. + +It will only remove `https://` and `http://` protocols. ```js normalizeUrl('https://sindresorhus.com');