Improve parser: trim lines, add timestamp extraction
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
// Directive parser
|
||||
export function parse(raw: string) {
|
||||
return raw.split("\n").filter(Boolean);
|
||||
// Directive parser v2
|
||||
export function parse(raw: string): string[] {
|
||||
return raw.split("\n").map(l => l.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
export function parseTimestamp(line: string): Date | null {
|
||||
const match = line.match(/\d{4}-\d{2}-\d{2}/);
|
||||
return match ? new Date(match[0]) : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user