Skip to content

Commit

Permalink
perf(shared): use non-capture group for resolveRoutePathFromUrl (#1539)
Browse files Browse the repository at this point in the history
Co-authored-by: Xinyu Liu <[email protected]>
  • Loading branch information
Mister-Hope and meteorlxy authored Apr 15, 2024
1 parent aea8de4 commit 2bbb2b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/shared/src/utils/resolveRoutePathFromUrl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const resolveRoutePathFromUrl = (url: string, base = '/'): string => {
const pathname = url
// remove url origin
.replace(/^(https?:)?\/\/[^/]*/, '')
.replace(/^(?:https?:)?\/\/[^/]*/, '')

// remove site base
return pathname.startsWith(base)
Expand Down

0 comments on commit 2bbb2b2

Please sign in to comment.