All files / Rindu/utils formatLyrics.ts

70% Statements 7/10
0% Branches 0/3
100% Functions 2/2
87.5% Lines 7/8

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 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29    3x     1x 1x                 1x   1x     2x   1x            
import { GetLyrics, IFormatLyricsResponse } from "types/lyrics";
 
export function formatLyrics(
  lyricsData: GetLyrics
): IFormatLyricsResponse | null {
  Iif (lyricsData?.isFullscreen === undefined) return null;
  Iif (lyricsData.isFullscreen) {
    return {
      colors: lyricsData.colors,
      lines: lyricsData.lyrics.lines,
      provider: lyricsData.lyrics.provider,
      syncType: lyricsData.lyrics.syncType,
    };
  }
 
  Iif (!lyricsData.lyrics) return null;
 
  const lines: IFormatLyricsResponse["lines"] = lyricsData.lyrics
    .split("\n")
    .map((line) => {
      return { words: line };
    });
  return {
    lines,
    provider: "legacy",
    syncType: "UNSYNCED",
  };
}