function relPath(path, basePath) {
    const idx = basePath.lastIndexOf("/");
    const dir = idx === -1 ? "" : basePath.slice(0, idx);
    const dirCount = dir.length ? dir.split("/").length : 0;
    return "../".repeat(dirCount) + path;
}
// assuming it and basePath are relative to document
assuming it and basePath are relative to document
assuming it and basePath are relative to document
function relPath(path, basePath) {
    const idx = basePath.lastIndexOf("/");
    const dir = idx === -1 ? "" : basePath.slice(0, idx);
    const dirCount = dir.length ? dir.split("/").length : 0;
    return "../".repeat(dirCount) + path;
}
function relPath ( path , basePath ) { const idx = basePath . lastIndexOf ( "/" ) ; const dir = idx === - 1 ? "" : basePath . slice ( 0 , idx ) ; const dirCount = dir . length ? dir . split ( "/" ) . length : 0 ; return "../" . repeat ( dirCount ) + path ; }
assuming it and basePath are relative to document
assuming it and basePath are relative to document