diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..a8c305e --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,15 @@ +export function matchesRegex(line: string, regex: string) { + if (!regex) return true; + try { + return new RegExp(regex, "i").test(line); + } catch { + return true; + } +} + +export function highlight(line: string) { + return line + .replace(/error/gi, "🔴 ERROR") + .replace(/warn/gi, "🟡 WARN") + .replace(/info/gi, "🔵 INFO"); +} \ No newline at end of file