Update getBranch docs

This commit is contained in:
Eric Bailey
2025-06-09 17:29:58 -05:00
parent a84fbce8de
commit f91fa11593
+10 -11
View File
@@ -114,8 +114,6 @@ export function sortAndAnnotateThreadItems(
) )
} }
} }
console.log(threadItems)
} }
} else if (item.depth > 0) { } else if (item.depth > 0) {
/* /*
@@ -497,16 +495,17 @@ export function buildThread({
* parent and it's children (not siblings). Returned indices are inclusive of * parent and it's children (not siblings). Returned indices are inclusive of
* the parent and its last child. * the parent and its last child.
* *
* items[] (index, depth) * items[] (index, depth)
* ├── branch ───── (0, 1) * └─┬ anchor ──────── (0, 0)
* ├─ branch ───── (1, 1) (start) * ├─── branch ───── (1, 1)
* ├──┬ leaf ──── (2, 2) * ├──┬ branch ───── (2, 1) (start)
* ── leaf ── (3, 3) * │ ── leaf ──── (3, 2)
* └── leaf ───── (4, 2) (end) * │ │ └── leaf ── (4, 3)
* ├── branch ───── (5, 1) * │ └─── leaf ──── (5, 2) (end)
* ── branch ───── (6, 1) * ├─── branch ───── (6, 1)
* └─── branch ───── (7, 1)
* *
* const { start: 1, end: 3 } = getBranch(items, 1, 1) * const { start: 2, end: 5, length: 3 } = getBranch(items, 2, 1)
*/ */
export function getBranch( export function getBranch(
thread: ApiThreadItem[], thread: ApiThreadItem[],