export function removeRedundantSemicolons(data) { if (Array.isArray(data)) return data.map(item => removeRedundantSemicolons(item)); if (data && typeof data === 'object') return Object.fromEntries( Object.entries(data).map(([key, value]) => [key, removeRedundantSemicolons(value)]), ); if (typeof data === 'string') return data .replace(/^[\s;]+/, '') // 去除开头的分号和空白 .replace(/\s*;+\s*/g, ';') // 分号和两边空白合并为一个分号 .replace(/;{2,}/g, ';'); // 再次合并可能出现的连续分号 return data; }