Group array elements by a key function.
A Map from key to array of elements that share that key.
Map
const notes = line.notes ?? [];const byType = groupBy(notes, n => n.type);// byType.get(1) → all tap notes// byType.get(2) → all hold notes Copy
const notes = line.notes ?? [];const byType = groupBy(notes, n => n.type);// byType.get(1) → all tap notes// byType.get(2) → all hold notes
Group array elements by a key function.