(array: readonly T[], property: string)
| 287 | } |
| 288 | |
| 289 | function nest<T extends Record<string, any>>(array: readonly T[], property: string): Nested<T>[] { |
| 290 | const nested: Nested<T>[] = []; |
| 291 | const lookup = new Map<string, Nested<T>>(); |
| 292 | |
| 293 | for (const item of array) { |
| 294 | const key = item[property]; |
| 295 | getOrCreate(lookup, key, () => { |
| 296 | const items = { |
| 297 | items: [], |
| 298 | key |
| 299 | }; |
| 300 | nested.push(items); |
| 301 | return items; |
| 302 | }).items.push(item); |
| 303 | } |
| 304 | |
| 305 | return nested; |
| 306 | } |
| 307 | |
| 308 | function showTruncatedWarnings(warnings: readonly RollupLog[]): void { |
| 309 | const nestedByModule = nest(warnings, 'id'); |
no test coverage detected
searching dependent graphs…