add-subpath.ts 191 字节
Newer Older
P
Peter Pan 已提交
1 2 3 4 5
export const addSubpath = (url: string, subpath: string | null) =>
    url
        .replace('/', `/${subpath}/`)
        .replace(/(https?:\/\/)|(\/)+/g, '$1$2')
        .replace(/\/$/, '');