cal.pub0.org/packages/lib/sanitizeCalendarObject.ts

13 lines
385 B
TypeScript
Raw Normal View History

import type { DAVObject } from "tsdav";
export const sanitizeCalendarObject = (obj: DAVObject) => {
return obj.data
.replaceAll("\r\n", "\r")
.replaceAll("\r", "\r\n")
.replaceAll(/(: \r\n|:\r\n|\r\n:|\r\n :)/gm, ":")
.replaceAll(/(; \r\n|;\r\n|\r\n;|\r\n ;)/gm, ";")
.replaceAll(/(= \r\n|=\r\n|\r\n=|\r\n =)/gm, "=");
};
export default sanitizeCalendarObject;