RPE Chart Utils
    Preparing search index...

    Function groupBy

    • Group array elements by a key function.

      Type Parameters

      • T
      • K

      Parameters

      • arr: T[]
      • keyFn: (item: T) => K

      Returns Map<K, T[]>

      A Map from key to array of elements that share that key.

      const notes = line.notes ?? [];
      const byType = groupBy(notes, n => n.type);
      // byType.get(1) → all tap notes
      // byType.get(2) → all hold notes