@ls-stack/utils 3.51.0 → 3.52.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.
@@ -58,12 +58,13 @@ function matchPath(pattern, pathname) {
58
58
  if (typeof pattern === "string") {
59
59
  pattern = { path: pattern, caseSensitive: false, end: true };
60
60
  }
61
+ const normalizedPathname = pathname === "" ? "" : pathname.replace(/^\/*/, "/");
61
62
  const [matcher, compiledParams] = compilePath(
62
63
  pattern.path,
63
64
  pattern.caseSensitive,
64
65
  pattern.end
65
66
  );
66
- const match = pathname.match(matcher);
67
+ const match = normalizedPathname.match(matcher);
67
68
  if (!match) return null;
68
69
  const matchedPathname = match[0];
69
70
  let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
package/dist/matchPath.js CHANGED
@@ -12,12 +12,13 @@ function matchPath(pattern, pathname) {
12
12
  if (typeof pattern === "string") {
13
13
  pattern = { path: pattern, caseSensitive: false, end: true };
14
14
  }
15
+ const normalizedPathname = pathname === "" ? "" : pathname.replace(/^\/*/, "/");
15
16
  const [matcher, compiledParams] = compilePath(
16
17
  pattern.path,
17
18
  pattern.caseSensitive,
18
19
  pattern.end
19
20
  );
20
- const match = pathname.match(matcher);
21
+ const match = normalizedPathname.match(matcher);
21
22
  if (!match) return null;
22
23
  const matchedPathname = match[0];
23
24
  let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ls-stack/utils",
3
3
  "description": "Universal TypeScript utilities for browser and Node.js",
4
- "version": "3.51.0",
4
+ "version": "3.52.0",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "dist",