(value: unknown)
| 37 | } |
| 38 | |
| 39 | function cleanProperties(value: unknown): unknown { |
| 40 | if (Array.isArray(value)) { |
| 41 | return value |
| 42 | .map((entry) => cleanProperties(entry)) |
| 43 | .filter((entry) => entry !== undefined) |
| 44 | } |
| 45 | |
| 46 | if (value && typeof value === 'object') { |
| 47 | const cleanedEntries = Object.entries(<Record<string, unknown>>value) |
| 48 | .map(([key, entry]) => [key, cleanProperties(entry)] as const) |
| 49 | .filter(([, entry]) => entry !== undefined) |
| 50 | |
| 51 | return Object.fromEntries(cleanedEntries) |
| 52 | } |
| 53 | |
| 54 | if (value === undefined) { |
| 55 | return undefined |
| 56 | } |
| 57 | |
| 58 | return value |
| 59 | } |
| 60 | |
| 61 | function truncateValue(value: string) { |
| 62 | return value.length > TELEMETRY_VALUE_MAX_LENGTH |
no outgoing calls
no test coverage detected