mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-04 10:10:01 +00:00
* refactor(scripts): deslop tooling scripts third pass Consolidate AST traversal, binding and shadow handling, report grouping, fixture metadata, and developer harness plumbing. Remove the unused PR comment verdict parser and one-use forwarding layers while preserving CLI, guard, baseline, and generated-byte contracts. * test(scripts): parse mocked fetch requests with Request * test(scripts): include shared AST helper in protocol fixture
10 lines
305 B
TypeScript
10 lines
305 B
TypeScript
export function groupBy<T, K>(values: Iterable<T>, keyFor: (value: T) => K): Map<K, T[]> {
|
|
const groups = new Map<K, T[]>();
|
|
for (const value of values) {
|
|
const key = keyFor(value);
|
|
const group = groups.get(key) ?? [];
|
|
group.push(value);
|
|
groups.set(key, group);
|
|
}
|
|
return groups;
|
|
}
|