MCPcopy Create free account
hub / github.com/SamuelZ12/longcut / normalizeTranscriptSegment

Function normalizeTranscriptSegment

lib/topic-utils.ts:65–87  ·  view source on GitHub ↗
(
  segment: TranscriptSegment | null | undefined,
)

Source from the content-addressed store, hash-verified

63}
64
65function 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
89export function normalizeTranscript(
90 transcript: TranscriptSegment[] | null | undefined,

Callers 1

normalizeTranscriptFunction · 0.85

Calls 1

coerceToNumberFunction · 0.85

Tested by

no test coverage detected