(input: T[])
| 131 | } |
| 132 | |
| 133 | function groupBySession<T extends { id: string; sessionID: string }>(input: T[]) { |
| 134 | return input.reduce<Record<string, T[]>>((acc, item) => { |
| 135 | if (!item?.id || !item.sessionID) return acc |
| 136 | const list = acc[item.sessionID] |
| 137 | if (list) list.push(item) |
| 138 | if (!list) acc[item.sessionID] = [item] |
| 139 | return acc |
| 140 | }, {}) |
| 141 | } |
| 142 | |
| 143 | function projectID(directory: string, projects: Project[]) { |
| 144 | return projects.find((project) => project.worktree === directory || project.sandboxes?.includes(directory))?.id |
no test coverage detected