Skip to content

Commit

Permalink
stripAuth => stripAuthentication
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 6, 2018
1 parent 211322b commit f0f3e81
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -12,7 +12,7 @@ module.exports = (urlString, opts) => {
normalizeProtocol: true,
forceHttp: false,
forceHttps: false,
stripAuth: true,
stripAuthentication: true,
stripHash: false,
stripWWW: true,
removeQueryParameters: [/^utm_\w+/i],
Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports = (urlString, opts) => {
}

// Remove auth
if (opts.stripAuth) {
if (opts.stripAuthentication) {
urlObj.username = '';
urlObj.password = '';
}
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Expand Up @@ -91,19 +91,19 @@ normalizeUrl('http://sindresorhus.com:80/', {forceHttps: true});

This option can't be used with the `forceHttp` option at the same time.

##### stripAuth
##### stripAuthentication

Type: `boolean`<br>
Default: `true`

Strip the [authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) part of a URL.

```js
normalizeUrl('user:password@sindresorhus.com/about.html');
//=> 'http://sindresorhus.com/about.html'
normalizeUrl('user:password@sindresorhus.com');
//=> 'https://sindresorhus.com'

normalizeUrl('user:password@sindresorhus.com/about.html', {stripAuth: false});
//=> 'http://user:password@sindresorhus.com/about.html'
normalizeUrl('user:password@sindresorhus.com', {stripAuthentication: false});
//=> 'https://user:password@sindresorhus.com'
```

##### stripHash
Expand Down
4 changes: 2 additions & 2 deletions test.js
Expand Up @@ -54,8 +54,8 @@ test('backwards compatibility', t => {
t.is(m('http://sindresorhus.com', {normalizeHttp: true}), 'https://sindresorhus.com');
});

test('stripAuth option', t => {
const opts = {stripAuth: false};
test('stripAuthentication option', t => {
const opts = {stripAuthentication: false};
t.is(m('http://user:password@www.sindresorhus.com', opts), 'http://user:password@sindresorhus.com');
t.is(m('https://user:password@www.sindresorhus.com', opts), 'https://user:password@sindresorhus.com');
t.is(m('https://user:password@www.sindresorhus.com/@user', opts), 'https://user:password@sindresorhus.com/@user');
Expand Down

5 comments on commit f0f3e81

@mathieumg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! 😊

@sindresorhus
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariosant No worries. Was not your fault. I just realized after merging that it would be nicer with the full word.

@mariosant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to understand what's going on πŸ˜†

@mathieumg
Copy link
Contributor

@mathieumg mathieumg commented on f0f3e81 Nov 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ˜‚ @sindresorhus obviously meant to mention me but made a typo, sorry for the noise! πŸ‘Ό

@mariosant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, going back to the cave then! ⛰️

Please sign in to comment.