polish get parent folder

This commit is contained in:
fyears
2021-11-28 10:45:46 +08:00
parent d6cbf4260a
commit 0d75ea92b1
2 changed files with 26 additions and 1 deletions
+4 -1
View File
@@ -45,7 +45,10 @@ export const getFolderLevels = (x: string) => {
const y1 = x.split("/");
let i = 0;
for (let index = 0; index + 1 < y1.length; index++) {
res.push(y1.slice(0, index + 1).join("/"));
const k = y1.slice(0, index + 1).join("/");
if (k !== '' && k!== '/') {
res.push(k)
}
}
return res;
};