( segment: TranscriptSegment | null | undefined, )
| 63 | } |
| 64 | |
| 65 | function normalizeTranscriptSegment( |
| 66 | segment: TranscriptSegment | null | undefined, |
| 67 | ): TranscriptSegment | null { |
| 68 | if (!segment) return null; |
| 69 | |
| 70 | const start = coerceToNumber((segment as any).start); |
| 71 | const duration = coerceToNumber((segment as any).duration); |
| 72 | |
| 73 | if (start === null || duration === null) { |
| 74 | return null; |
| 75 | } |
| 76 | |
| 77 | const text = |
| 78 | typeof (segment as any).text === 'string' |
| 79 | ? (segment as any).text |
| 80 | : String((segment as any).text ?? ''); |
| 81 | |
| 82 | return { |
| 83 | text, |
| 84 | start, |
| 85 | duration, |
| 86 | }; |
| 87 | } |
| 88 | |
| 89 | export function normalizeTranscript( |
| 90 | transcript: TranscriptSegment[] | null | undefined, |
no test coverage detected