MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / collapseStaticLayoutIssues

Function collapseStaticLayoutIssues

packages/cli/src/utils/layoutAudit.ts:164–200  ·  view source on GitHub ↗
(issues: LayoutIssue[])

Source from the content-addressed store, hash-verified

162}
163
164export function collapseStaticLayoutIssues(issues: LayoutIssue[]): LayoutIssue[] {
165 const groups = new Map<
166 string,
167 {
168 issue: LayoutIssue;
169 firstSeen: number;
170 lastSeen: number;
171 occurrences: number;
172 }
173 >();
174
175 for (const issue of issues) {
176 const key = staticIssueKey(issue);
177 const existing = groups.get(key);
178 if (!existing) {
179 groups.set(key, {
180 issue,
181 firstSeen: issue.time,
182 lastSeen: issue.time,
183 occurrences: 1,
184 });
185 continue;
186 }
187
188 existing.firstSeen = Math.min(existing.firstSeen, issue.time);
189 existing.lastSeen = Math.max(existing.lastSeen, issue.time);
190 existing.occurrences += 1;
191 }
192
193 return [...groups.values()].map(({ issue, firstSeen, lastSeen, occurrences }) => ({
194 ...issue,
195 time: firstSeen,
196 firstSeen,
197 lastSeen,
198 occurrences,
199 }));
200}
201
202export function limitLayoutIssues(
203 issues: LayoutIssue[],

Callers 2

runFunction · 0.85

Calls 3

staticIssueKeyFunction · 0.85
getMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected