All files / Rindu/utils carousels.tsx

12.5% Statements 1/8
0% Branches 0/7
0% Functions 0/1
14.28% Lines 1/7

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      2x                              
import { CardType } from "components/CardContent";
import { IMappedAlbums } from "pages/artist/[artistId]";
 
export function getCarouselItems(
  type: CardType,
  items: IMappedAlbums | SpotifyApi.ArtistsRelatedArtistsResponse
): IMappedAlbums["items"] | SpotifyApi.ArtistObjectFull[] {
  Iif (!items) return [];
 
  Iif (type === "album" && "items" in items) {
    return items.items;
  }
 
  Iif (type === "artist" && "artists" in items) {
    return items.artists;
  }
  return [];
}