mirror of
https://github.com/hanzonet/explore.git
synced 2026-10-30 18:16:57 +00:00
13 lines
241 B
TypeScript
13 lines
241 B
TypeScript
// ensure that path always starts with /
|
|
export default function formatFilePath(path: string) {
|
|
if (path[0] === '.' && path[1] === '/') {
|
|
return path.slice(1);
|
|
}
|
|
|
|
if (path[0] === '/') {
|
|
return path;
|
|
}
|
|
|
|
return '/' + path;
|
|
}
|