Skip to content

Commit 2bbb2b2

Browse files
perf(shared): use non-capture group for resolveRoutePathFromUrl (#1539)
Co-authored-by: Xinyu Liu <[email protected]>
1 parent aea8de4 commit 2bbb2b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/shared/src/utils/resolveRoutePathFromUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const resolveRoutePathFromUrl = (url: string, base = '/'): string => {
22
const pathname = url
33
// remove url origin
4-
.replace(/^(https?:)?\/\/[^/]*/, '')
4+
.replace(/^(?:https?:)?\/\/[^/]*/, '')
55

66
// remove site base
77
return pathname.startsWith(base)

0 commit comments

Comments
 (0)