All files / player-browser/src/collection chart-preservation.ts

100% Statements 3/3
100% Branches 5/5
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13        273x 3179x   273x          
import type { BeMusicJSON } from '@be-music/chart-source';
 
/** Drop formatting data while retaining the original WAV loader order and branch gates used by LR2 EXTRA. */
export function compactChartPreservation(chart: BeMusicJSON): void {
  const sourceLines = chart.preservation.bms.sourceLines.filter(
    (entry) => entry.kind === 'directive' || (entry.kind === 'header' && /^WAV[0-9A-Z]{2}$/i.test(entry.command)),
  );
  chart.preservation = {
    bms: { sourceLines: sourceLines.length === 0 ? sourceLines : structuredClone(sourceLines), objectLines: [] },
    bmson: { lines: [], bpmEvents: [], stopEvents: [], soundChannels: [] },
  };
}