normalize-url 6.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +19 -1
- package/index.js +4 -0
- package/package.json +1 -1
- package/readme.md +19 -1
package/index.d.ts
CHANGED
|
@@ -155,8 +155,26 @@ declare namespace normalizeUrl {
|
|
|
155
155
|
});
|
|
156
156
|
//=> 'http://sindresorhus.com/?foo=bar'
|
|
157
157
|
```
|
|
158
|
+
|
|
159
|
+
If a boolean is provided, `true` will remove all the query parameters.
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
normalizeUrl('www.sindresorhus.com?foo=bar', {
|
|
163
|
+
removeQueryParameters: true
|
|
164
|
+
});
|
|
165
|
+
//=> 'http://sindresorhus.com'
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`false` will not remove any query parameter.
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
normalizeUrl('www.sindresorhus.com?foo=bar&utm_medium=test&ref=test_ref', {
|
|
172
|
+
removeQueryParameters: false
|
|
173
|
+
});
|
|
174
|
+
//=> 'http://www.sindresorhus.com/?foo=bar&ref=test_ref&utm_medium=test'
|
|
175
|
+
```
|
|
158
176
|
*/
|
|
159
|
-
readonly removeQueryParameters?: ReadonlyArray<RegExp | string
|
|
177
|
+
readonly removeQueryParameters?: ReadonlyArray<RegExp | string> | boolean;
|
|
160
178
|
|
|
161
179
|
/**
|
|
162
180
|
Removes trailing slash.
|
package/index.js
CHANGED
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -175,7 +175,7 @@ normalizeUrl('http://www.sindresorhus.com', {stripWWW: false});
|
|
|
175
175
|
|
|
176
176
|
##### removeQueryParameters
|
|
177
177
|
|
|
178
|
-
Type: `Array<RegExp | string
|
|
178
|
+
Type: `Array<RegExp | string> | boolean`\
|
|
179
179
|
Default: `[/^utm_\w+/i]`
|
|
180
180
|
|
|
181
181
|
Remove query parameters that matches any of the provided strings or regexes.
|
|
@@ -187,6 +187,24 @@ normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
|
|
|
187
187
|
//=> 'http://sindresorhus.com/?foo=bar'
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
+
If a boolean is provided, `true` will remove all the query parameters.
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
normalizeUrl('www.sindresorhus.com?foo=bar', {
|
|
194
|
+
removeQueryParameters: true
|
|
195
|
+
});
|
|
196
|
+
//=> 'http://sindresorhus.com'
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`false` will not remove any query parameter.
|
|
200
|
+
|
|
201
|
+
```js
|
|
202
|
+
normalizeUrl('www.sindresorhus.com?foo=bar&utm_medium=test&ref=test_ref', {
|
|
203
|
+
removeQueryParameters: false
|
|
204
|
+
});
|
|
205
|
+
//=> 'http://www.sindresorhus.com/?foo=bar&ref=test_ref&utm_medium=test'
|
|
206
|
+
```
|
|
207
|
+
|
|
190
208
|
##### removeTrailingSlash
|
|
191
209
|
|
|
192
210
|
Type: `boolean`\
|