Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

normalize-url

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-url - npm Package Compare versions

Comparing version 1.5.3 to 1.6.0

7

index.js

@@ -40,3 +40,4 @@ 'use strict';

stripWWW: true,
removeQueryParameters: [/^utm_\w+/i]
removeQueryParameters: [/^utm_\w+/i],
removeTrailingSlash: true
}, opts);

@@ -125,3 +126,5 @@

// remove ending `/`
str = str.replace(/\/$/, '');
if (opts.removeTrailingSlash || urlObj.pathname === '/') {
str = str.replace(/\/$/, '');
}

@@ -128,0 +131,0 @@ // restore relative protocol, if applicable

{
"name": "normalize-url",
"version": "1.5.3",
"version": "1.6.0",
"description": "Normalize a URL",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -99,3 +99,23 @@ # normalize-url [![Build Status](https://travis-ci.org/sindresorhus/normalize-url.svg?branch=master)](https://travis-ci.org/sindresorhus/normalize-url)

##### removeTrailingSlash
Type: `boolean`<br>
Default: `true`
Remove trailing slash.
**Note:** Trailing slash is always removed if the URL doesn't have a pathname.
```js
normalizeUrl('http://sindresorhus.com/redirect/');
//=> 'http://sindresorhus.com/redirect'
normalizeUrl('http://sindresorhus.com/redirect/', {removeTrailingSlash: false});
//=> 'http://sindresorhus.com/redirect/'
normalizeUrl('http://sindresorhus.com/', {removeTrailingSlash: false});
//=> 'http://sindresorhus.com'
```
## Related

@@ -102,0 +122,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc