Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
Fixes #159
  • Loading branch information
sindresorhus committed Feb 22, 2022
1 parent 8c3933e commit 699ce1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -43,7 +43,8 @@ Type: `object`
##### defaultProtocol

Type: `string`\
Default: `http:`
Default: `http:`\
Values: `'https:' | 'http:'`

##### normalizeProtocol

Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 699ce1e

Please sign in to comment.