( transcript: TranscriptSegment[] | null | undefined, )
| 87 | } |
| 88 | |
| 89 | export function normalizeTranscript( |
| 90 | transcript: TranscriptSegment[] | null | undefined, |
| 91 | ): TranscriptSegment[] { |
| 92 | if (!Array.isArray(transcript)) return []; |
| 93 | |
| 94 | const normalized: TranscriptSegment[] = []; |
| 95 | for (const segment of transcript) { |
| 96 | const normalizedSegment = normalizeTranscriptSegment(segment); |
| 97 | if (normalizedSegment) { |
| 98 | normalized.push(normalizedSegment); |
| 99 | } |
| 100 | } |
| 101 | return normalized; |
| 102 | } |
| 103 | |
| 104 | function computeDuration(segments: TopicSegment[] = []): number { |
| 105 | return segments.reduce((total, segment) => { |
no test coverage detected