* 解析单行 JSONL
(line: string)
| 92 | * 解析单行 JSONL |
| 93 | */ |
| 94 | function parseLine(line: string): JsonlLine | null { |
| 95 | const trimmed = line.trim() |
| 96 | if (!trimmed || trimmed.startsWith('#')) { |
| 97 | // 空行或注释行,跳过 |
| 98 | return null |
| 99 | } |
| 100 | try { |
| 101 | return JSON.parse(trimmed) as JsonlLine |
| 102 | } catch { |
| 103 | // 解析失败,跳过该行 |
| 104 | return null |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | // ==================== 特征定义 ==================== |
| 109 |
no test coverage detected