iptv/scripts/core/logParser.ts

14 lines
276 B
TypeScript
Raw Normal View History

2023-09-15 17:40:35 +02:00
export type LogItem = {
filepath: string
count: number
}
export class LogParser {
2023-09-22 05:22:47 +02:00
parse(content: string): LogItem[] {
2023-09-15 17:40:35 +02:00
if (!content) return []
const lines = content.split('\n')
return lines.map(line => (line ? JSON.parse(line) : null)).filter(l => l)
}
}