MCPcopy
hub / github.com/remotely-save/remotely-save / getFolderLevels

Function getFolderLevels

src/misc.ts:49–69  ·  view source on GitHub ↗
(x: string, addEndingSlash = false)

Source from the content-addressed store, hash-verified

47 * @returns string[] might be empty
48 */
49export 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
71export const mkdirpInVault = async (thePath: string, vault: Vault) => {
72 // console.info(thePath);

Callers 11

_walkFromRootMethod · 0.90
_writeFileFromRootMethod · 0.90
walkMethod · 0.90
mkdirMethod · 0.90
writeFileMethod · 0.90
mkdirMethod · 0.90
writeFileMethod · 0.90
mkdirMethod · 0.90
writeFileMethod · 0.90
getSkipItemsByListFunction · 0.90
mkdirpInVaultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected