cmc-web/packages/common/components/utils/resolvePath.js

14 lines
331 B
JavaScript
Raw Normal View History

2024-08-20 12:11:31 +00:00
/**
* Created by HaijunZhang on 2018/12/10.
*/
import path from 'path';
export function isExternalLink (path) {
return /^(http:|https:|mailto:|tel:)\/\//.test(path);
}
export function resolvePath (basePath, routePath) {
if (isExternalLink(routePath)) {
return routePath;
}
return path.resolve(basePath, routePath);
}