trousse 3.20.0 → 3.20.1
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/dist/urls.js +2 -3
- package/package.json +1 -1
package/dist/urls.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { toPatternList } from "./internal.js";
|
|
2
2
|
import { isFunction, isNullish, isString } from "./is.js";
|
|
3
3
|
import { includesAnyOf, isAnyOf } from "./matching.js";
|
|
4
|
+
import { setKey } from "./objects.js";
|
|
4
5
|
import { trimString } from "./strings.js";
|
|
5
6
|
import { decodeHTMLStrict } from "entities";
|
|
6
7
|
// src/urls.ts
|
|
@@ -265,7 +266,7 @@ const readParams = (params, names, options) => {
|
|
|
265
266
|
const picked = {};
|
|
266
267
|
for (const name of names) {
|
|
267
268
|
const value = readParamValues(params, name, options)[0];
|
|
268
|
-
if (value !== void 0) picked
|
|
269
|
+
if (value !== void 0) setKey(picked, name, value);
|
|
269
270
|
}
|
|
270
271
|
return picked;
|
|
271
272
|
};
|
|
@@ -347,7 +348,6 @@ const plusRegex = /\+/g;
|
|
|
347
348
|
const httpSchemeRegex = /^http:\/\//i;
|
|
348
349
|
const httpsSchemeRegex = /^https:\/\//i;
|
|
349
350
|
const repeatedSlashesRegex = /(?<!:|%3a)\/{2,}/gi;
|
|
350
|
-
const pathSlashRunRegex = /^https?:\/\/[^/?#]+(?=\/)[^?#]*\/\//i;
|
|
351
351
|
const leadingWhitespaceChars = [
|
|
352
352
|
" ",
|
|
353
353
|
" ",
|
|
@@ -632,7 +632,6 @@ const lowercaseQueryPair = (pair) => {
|
|
|
632
632
|
});
|
|
633
633
|
};
|
|
634
634
|
const normalizeUrl = (url, options) => {
|
|
635
|
-
if (options.collapseSlashes && Object.entries(options).every(([key, value]) => key === "collapseSlashes" || !value) && !pathSlashRunRegex.test(url)) return url;
|
|
636
635
|
const parsed = parseUrl(options.normalizeUnicode ? url.normalize("NFC") : url);
|
|
637
636
|
if (!parsed) return url;
|
|
638
637
|
if (options.stripHostTrailingDot && parsed.hostname.endsWith(".")) parsed.hostname = parsed.hostname.slice(0, -1);
|
package/package.json
CHANGED