Skip to content

Commit

Permalink
fix: url transform
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Sep 11, 2023
1 parent 5d918dd commit da49f6b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/transforms/url.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { GITHUB_USERNAME, V2_ONLINE_URL, V1_LEGACY_URL } from '@/config'

export const getPageURL = (route: string) => {
return `${V2_ONLINE_URL}/${route}`.replace(/\/+/g, '/')
const url = V2_ONLINE_URL.replace(/\/$/, '')
const path = route.replace(/^\//, '')
return `${url}/${path}`
}

export const getLegacyPageURL = (route: string) => {
return `${V1_LEGACY_URL}/${route}`.replace(/\/+/g, '/')
const url = V1_LEGACY_URL.replace(/\/$/, '')
const path = route.replace(/^\//, '')
return `${url}/${path}/`
}

export function getNPMHomepageURL(packageName: string) {
Expand Down

0 comments on commit da49f6b

Please sign in to comment.