From 430486a9b9f09cdc0515d9c3513ca49f48dee649 Mon Sep 17 00:00:00 2001 From: adrifcastr Date: Wed, 21 Jun 2023 12:48:33 +0200 Subject: [PATCH] direct return --- src/backend/metadata/getmeta.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/backend/metadata/getmeta.ts b/src/backend/metadata/getmeta.ts index 0ef84474..8010c89a 100644 --- a/src/backend/metadata/getmeta.ts +++ b/src/backend/metadata/getmeta.ts @@ -47,10 +47,9 @@ export function formatTMDBMetaResult( details: TMDBShowData | TMDBMovieData, type: MWMediaType ): TMDBMediaResult { - let tmdbmeta; if (type === MWMediaType.MOVIE) { const movie = details as TMDBMovieData; - tmdbmeta = { + return { id: details.id, title: movie.title, object_type: mediaTypeToTMDB(type), @@ -60,7 +59,7 @@ export function formatTMDBMetaResult( } if (type === MWMediaType.SERIES) { const show = details as TMDBShowData; - tmdbmeta = { + return { id: details.id, title: show.name, object_type: mediaTypeToTMDB(type), @@ -74,8 +73,7 @@ export function formatTMDBMetaResult( }; } - if (!tmdbmeta) throw new Error("unsupported type"); - return tmdbmeta; + throw new Error("unsupported type"); } export async function getMetaFromId(