7 lines
309 B
TypeScript
7 lines
309 B
TypeScript
export function resolveAsset(base: string, path: string): string {
|
|
if (!path || path.startsWith('http://') || path.startsWith('https://') || path.startsWith('data:')) return path
|
|
const b = base.endsWith('/') ? base.slice(0, -1) : base
|
|
const p = path.startsWith('/') ? path : '/' + path
|
|
return b + p
|
|
}
|