(x: string, addEndingSlash = false)
| 47 | * @returns string[] might be empty |
| 48 | */ |
| 49 | export const getFolderLevels = (x: string, addEndingSlash = false) => { |
| 50 | const res: string[] = []; |
| 51 | |
| 52 | if (x === "" || x === "/") { |
| 53 | return res; |
| 54 | } |
| 55 | |
| 56 | const y1 = x.split("/"); |
| 57 | const i = 0; |
| 58 | for (let index = 0; index + 1 < y1.length; index++) { |
| 59 | let k = y1.slice(0, index + 1).join("/"); |
| 60 | if (k === "" || k === "/") { |
| 61 | continue; |
| 62 | } |
| 63 | if (addEndingSlash) { |
| 64 | k = `${k}/`; |
| 65 | } |
| 66 | res.push(k); |
| 67 | } |
| 68 | return res; |
| 69 | }; |
| 70 | |
| 71 | export const mkdirpInVault = async (thePath: string, vault: Vault) => { |
| 72 | // console.info(thePath); |
no outgoing calls
no test coverage detected