trousse 2.16.2 → 2.16.3

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/is.js CHANGED
@@ -25,7 +25,7 @@ const isPlainObject = (value) => {
25
25
  };
26
26
  const whitespaceOnlyRegex = /^\p{White_Space}*$/u;
27
27
  const isNonEmptyString = (value) => {
28
- if (!isString(value) || value === "") return false;
28
+ if (!isString(value) || !value) return false;
29
29
  const code = value.charCodeAt(0);
30
30
  if (code > 32 && code < 127) return true;
31
31
  return !whitespaceOnlyRegex.test(value);
package/dist/urls.js CHANGED
@@ -183,11 +183,9 @@ const httpOrSchemeRelativeRegex = /^(?:https?:)?\/\//i;
183
183
  const slugTailRegex = /[/.-]/;
184
184
  const lostSeparatorRegex = /(?<!\s)\s+(?=[A-Za-z_][\w.-]*=)/g;
185
185
  const slashClosedValueRegex = /(=[^&/=]+)\/+(?=&|$)/g;
186
- const isGlueTail = (head, glueIndex, pathEnd, ownEnd) => {
186
+ const isGlueTail = (head, glueIndex, pathEnd) => {
187
187
  const tail = head.slice(glueIndex + 1, pathEnd).split("&")[0] ?? "";
188
- if (tail === "" || tail.includes("=")) return true;
189
- if (slugTailRegex.test(tail)) return false;
190
- return head.slice(glueIndex + 1, ownEnd).includes("=");
188
+ return tail.includes("=") || !slugTailRegex.test(tail);
191
189
  };
192
190
  const fixMalformedQuery = (url) => {
193
191
  if (!httpOrSchemeRelativeRegex.test(url)) return url;
@@ -204,7 +202,7 @@ const fixMalformedQuery = (url) => {
204
202
  const pathIndex = head.indexOf("/", authorityEnd);
205
203
  const pathEnd = hasMark ? markIndex : ownEnd;
206
204
  const glueIndex = pathIndex !== -1 && pathIndex < pathEnd ? head.indexOf("&", pathIndex) : -1;
207
- const isGlued = glueIndex !== -1 && glueIndex < pathEnd && isGlueTail(head, glueIndex, pathEnd, ownEnd);
205
+ const isGlued = glueIndex !== -1 && glueIndex < pathEnd && isGlueTail(head, glueIndex, pathEnd);
208
206
  if (!isGlued && !hasMark) return url;
209
207
  const queryIndex = isGlued ? glueIndex : markIndex;
210
208
  const queryStart = queryIndex + (isGlued && head[glueIndex + 1] === "?" ? 2 : 1);
@@ -380,7 +378,7 @@ const normalizeUrl = (url, options) => {
380
378
  parsed.search = pairs.join("&");
381
379
  }
382
380
  if (options.sortQueryParams && parsed.search.includes("&")) parsed.search = parsed.search.slice(1).split("&").filter(Boolean).sort(compareQueryPairs).join("&");
383
- if (options.stripEmptyQuery && parsed.search === "") parsed.search = "";
381
+ if (options.stripEmptyQuery && !parsed.search) parsed.search = "";
384
382
  let result = parsed.href;
385
383
  if (options.stripRootSlash && result === `${parsed.origin}/`) result = parsed.origin;
386
384
  if (options.stripScheme ?? options.stripProtocol) result = result.replace(schemePrefixRegex, "");
package/package.json CHANGED
@@ -40,11 +40,11 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/bun": "^1.4.2",
43
- "kvalita": "^1.26.4",
43
+ "kvalita": "^1.28.0",
44
44
  "tsdown": "0.23.1"
45
45
  },
46
46
  "dependencies": {
47
47
  "entities": "^8.1.0"
48
48
  },
49
- "version": "2.16.2"
49
+ "version": "2.16.3"
50
50
  }