GenerAI / worldmonitor /server /_shared /parse-string-array.ts
amogaddy's picture
Integra World Monitor (AGPL-3.0, self-hosted) nello Space: pagina, menu, e arricchimento notizie per la AI (part 5)
20f83d9 verified
Raw
History Blame Contribute Delete
355 Bytes
/**
* Defensive parser for repeated-string query params.
* Some codegen paths may pass comma-separated strings into string[] fields.
*/
export function parseStringArray(raw: unknown): string[] {
if (Array.isArray(raw)) return raw.filter(Boolean);
if (typeof raw === 'string' && raw.length > 0) return raw.split(',').filter(Boolean);
return [];
}