summaryrefslogtreecommitdiffhomepage
path: root/src/vault-context.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-03-28 01:47:12 +0900
committerAdam Malczewski <[email protected]>2026-03-28 01:47:12 +0900
commit94bca96aec909890da7c06a03e5c2c6b380be4a8 (patch)
tree4bbe68761f16f956fd48808919761e0625c97d93 /src/vault-context.ts
parent7ecd929a1d6dbfbf61accdf7d4236a7005ea25e4 (diff)
downloadai-pulse-obsidian-plugin-94bca96aec909890da7c06a03e5c2c6b380be4a8.tar.gz
ai-pulse-obsidian-plugin-94bca96aec909890da7c06a03e5c2c6b380be4a8.zip
fix build errors and cleanup code
Diffstat (limited to 'src/vault-context.ts')
-rw-r--r--src/vault-context.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vault-context.ts b/src/vault-context.ts
index 80afa03..c20ddfa 100644
--- a/src/vault-context.ts
+++ b/src/vault-context.ts
@@ -32,7 +32,10 @@ function buildFolderTree(app: App): string {
if (!tree.has(key)) {
tree.set(key, []);
}
- tree.get(key)!.push(folder.path);
+ const siblings = tree.get(key);
+ if (siblings !== undefined) {
+ siblings.push(folder.path);
+ }
}
const lines: string[] = [];
@@ -41,7 +44,8 @@ function buildFolderTree(app: App): string {
const children = tree.get(path) ?? [];
children.sort();
for (let i = 0; i < children.length; i++) {
- const child = children[i];
+ const child: string | undefined = children[i];
+ if (child === undefined) continue;
const isLast = i === children.length - 1;
const connector = isLast ? "└── " : "├── ";
const childPrefix = isLast ? " " : "│ ";