24 lines
714 B
TypeScript
24 lines
714 B
TypeScript
const invalidSheetCharacters = /[:/\\?*[\]]/g;
|
|
|
|
export function sanitizeSheetName(input: string, maxLength = 100): string {
|
|
const cleaned = input.replace(invalidSheetCharacters, ' ').replace(/\s+/g, ' ').trim();
|
|
return (cleaned || 'Newsletter').slice(0, maxLength);
|
|
}
|
|
|
|
export function escapeCell(value: unknown): unknown {
|
|
if (typeof value !== 'string') {
|
|
return value;
|
|
}
|
|
return /^[=+\-@]/.test(value) ? `'${value}` : value;
|
|
}
|
|
|
|
export interface CatalogPayload {
|
|
rows: Record<string, unknown>[];
|
|
sponsors: Record<string, unknown>[];
|
|
deadLinks: Record<string, unknown>[];
|
|
}
|
|
|
|
export interface OutputWriter {
|
|
write(payload: CatalogPayload, summary?: Record<string, unknown>): Promise<unknown>;
|
|
}
|