openclaw/src/auto-reply/reply/inbound-text.ts

8 lines
264 B
TypeScript
Raw Normal View History

2026-01-17 04:04:17 +00:00
export function normalizeInboundTextNewlines(input: string): string {
const text = input.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
if (text.includes("\n")) return text;
if (!text.includes("\\n")) return text;
return text.replaceAll("\\n", "\n");
}