(comment: string)
| 71 | }; |
| 72 | }; |
| 73 | const parseIntroComment = (comment: string) => { |
| 74 | const introPattern = /^intro:\s*([\s\S]*)$/i; |
| 75 | const match = comment.match(introPattern); |
| 76 | if (!match) return []; |
| 77 | |
| 78 | const lines = match[1].split('\n').filter((line) => line.trim() !== ''); |
| 79 | const segments = lines.map((line: string) => { |
| 80 | const parts = line.split('-').map((part) => part.trim()); |
| 81 | const timePattern = /(\d{1,2}):(\d{2}):(\d{2})|(\d{2}):(\d{2})/; |
| 82 | const startTimeMatch = parts[0].match(timePattern); |
| 83 | |
| 84 | let start; |
| 85 | if (startTimeMatch) { |
| 86 | if (startTimeMatch[1]) { |
| 87 | start = |
| 88 | parseInt(startTimeMatch[1], 10) * 3600 + |
| 89 | parseInt(startTimeMatch[2], 10) * 60 + |
| 90 | parseInt(startTimeMatch[3], 10); |
| 91 | } else { |
| 92 | start = |
| 93 | parseInt(startTimeMatch[4], 10) * 60 + |
| 94 | parseInt(startTimeMatch[5], 10); |
| 95 | } |
| 96 | } else { |
| 97 | start = 0; |
| 98 | } |
| 99 | |
| 100 | const title = parts.length > 2 ? parts[2] : parts[1]; |
| 101 | return { start, title, end: 0 }; |
| 102 | }); |
| 103 | |
| 104 | for (let i = 0; i < segments.length - 1; i++) { |
| 105 | segments[i].end = segments[i + 1].start; |
| 106 | } |
| 107 | |
| 108 | if (lines.length > 0) { |
| 109 | const lastLineParts = lines[lines.length - 1] |
| 110 | .split('-') |
| 111 | .map((part) => part.trim()); |
| 112 | if (lastLineParts.length >= 3) { |
| 113 | const timePattern = /(\d{1,2}):(\d{2}):(\d{2})|(\d{2}):(\d{2})/; |
| 114 | const endTimeMatch = lastLineParts[1].match(timePattern); |
| 115 | let end; |
| 116 | if (endTimeMatch) { |
| 117 | if (endTimeMatch[1]) { |
| 118 | end = |
| 119 | parseInt(endTimeMatch[1], 10) * 3600 + |
| 120 | parseInt(endTimeMatch[2], 10) * 60 + |
| 121 | parseInt(endTimeMatch[3], 10); |
| 122 | } else { |
| 123 | end = |
| 124 | parseInt(endTimeMatch[4], 10) * 60 + parseInt(endTimeMatch[5], 10); |
| 125 | } |
| 126 | segments[segments.length - 1].end = end; |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 |
no outgoing calls
no test coverage detected