MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / remove

Function remove

src/lib/fileList.js:52–65  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

50 * @param {string} item url
51 */
52export function remove(item) {
53 if (filesTree[item]) {
54 removeRootTree(item);
55 emit("remove-file", item);
56 return;
57 }
58
59 const tree = getTree(Object.values(filesTree), item);
60 if (!tree) return;
61 const { parent } = tree;
62 const index = parent.children.indexOf(tree);
63 parent.children.splice(index, 1);
64 emit("remove-file", tree);
65}
66
67function removeRootTree(url) {
68 const rootUrl = url.endsWith("/") ? url : `${url}/`;

Callers

nothing calls this directly

Calls 3

removeRootTreeFunction · 0.85
getTreeFunction · 0.85
emitFunction · 0.70

Tested by

no test coverage detected