(value: string)
| 19 | ): Record<string, string> { |
| 20 | // Clickhouse breaks on insert if a property contains invalid surrogate pairs |
| 21 | function removeInvalidSurrogates(value: string): string { |
| 22 | const validSurrogatePairRegex = |
| 23 | /[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g; |
| 24 | return value.match(validSurrogatePairRegex)?.join('') || ''; |
| 25 | } |
| 26 | |
| 27 | return Object.entries(obj).reduce((acc, [key, value]) => { |
| 28 | if (typeof value === 'object' && value !== null) { |