mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 13:17:52 +08:00
16 lines
390 B
TypeScript
16 lines
390 B
TypeScript
import path from 'path-browserify'
|
|
|
|
export function isExternalLink(path: string) {
|
|
return /^(https?:|mailto:|tel:)/.test(path)
|
|
}
|
|
|
|
export function resolveRoutePath(basePath: string, routePath: string) {
|
|
if (isExternalLink(routePath)) {
|
|
return routePath
|
|
}
|
|
if (isExternalLink(basePath)) {
|
|
return basePath
|
|
}
|
|
return basePath ? path.resolve(basePath, routePath) : routePath
|
|
}
|