chore: Add return type
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
parent
543c40207c
commit
f4ec8f8d36
|
|
@ -2,11 +2,15 @@ import { FreshContext } from "$fresh/server.ts";
|
||||||
import { parse, toSeconds } from "https://esm.sh/iso8601-duration@2.1.1";
|
import { parse, toSeconds } from "https://esm.sh/iso8601-duration@2.1.1";
|
||||||
import { nrkRadio, OriginalEpisode } from "../../../../../lib/nrk.ts";
|
import { nrkRadio, OriginalEpisode } from "../../../../../lib/nrk.ts";
|
||||||
|
|
||||||
// TODO: This type `OriginalEpisode` is missing stuff.
|
type Chapter = {
|
||||||
function toChapters(episode: OriginalEpisode) {
|
title: string | undefined;
|
||||||
|
startTime: number | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
function toChapters(episode: OriginalEpisode): Chapter[] {
|
||||||
return episode.indexPoints.map((indexPoint) => ({
|
return episode.indexPoints.map((indexPoint) => ({
|
||||||
title: indexPoint.title,
|
title: indexPoint.title,
|
||||||
startTime: toSeconds(parse(indexPoint.startPoint)),
|
startTime: indexPoint.startPoint ? toSeconds(parse(indexPoint.startPoint)) : undefined,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue