Skip to content

Commit 2bbb2b2

Browse files
Mister-Hopemeteorlxy
andauthoredApr 15, 2024
perf(shared): use non-capture group for resolveRoutePathFromUrl (#1539)
Co-authored-by: Xinyu Liu <meteor.lxy@foxmail.com>
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

+1-1
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)
Please sign in to comment.