MCPcopy Index your code
hub / github.com/Dimillian/CodexMonitor / splitRowsByRoot

Function splitRowsByRoot

src/features/app/components/threadSearchUtils.ts:39–72  ·  view source on GitHub ↗
(
  rows: Row[],
)

Source from the content-addressed store, hash-verified

37}
38
39export function splitRowsByRoot<Row extends { depth: number }>(
40 rows: Row[],
41): RootRowGroup<Row>[] {
42 const groups: RootRowGroup<Row>[] = [];
43 let current: Row[] = [];
44 let currentRootIndex = 0;
45
46 rows.forEach((row, rowIndex) => {
47 if (row.depth === 0 && current.length > 0) {
48 groups.push({
49 root: current[0],
50 rootIndex: currentRootIndex,
51 rows: current,
52 });
53 current = [row];
54 currentRootIndex = rowIndex;
55 return;
56 }
57 if (current.length === 0) {
58 currentRootIndex = rowIndex;
59 }
60 current.push(row);
61 });
62
63 if (current.length > 0) {
64 groups.push({
65 root: current[0],
66 rootIndex: currentRootIndex,
67 rows: current,
68 });
69 }
70
71 return groups;
72}
73
74export function filterRowsByQuery<Row extends { depth: number; thread: ThreadSummary }>(
75 rows: Row[],

Callers 3

Sidebar.tsxFile · 0.90
filterRowsByQueryFunction · 0.85
countRootRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected