INNER CODE UNIT · TypeScript
match
iurysza/module-graph · .agents/skills/audio-transcribe/scripts/transcribe.ts:180
const match = /^(\d+(?:\.\d+)?)s$/.exec(offset);
if (!match) return undefined;
const seconds = Number.parseFloat(match[1]);
return Number.isFinite(seconds) && seconds >= 0 ? seconds : undefined;
}
function speakerName(speaker: string | undefined): string {
if (!speaker) return "Speaker";
const match = /^spk[_:](\d+)$/i.exec(speaker);
return match ? `Speaker ${match[1]}` : speaker;
}
function joinWords(words: string[]): string {
return words
.join(" ")
.replace(/\s+([,.;:!?])/g, "$1")
.replace(/([([{])\s+/g, "$1")
.replace(/\s+([)\]}])/g, "$1");