(obj: T)
| 103 | } |
| 104 | |
| 105 | export function cleanODataMetadata<T>(obj: T): T { |
| 106 | if (!obj || typeof obj !== 'object') return obj |
| 107 | |
| 108 | if (Array.isArray(obj)) { |
| 109 | return obj.map((item) => cleanODataMetadata(item)) as T |
| 110 | } |
| 111 | |
| 112 | const cleaned: Record<string, unknown> = {} |
| 113 | for (const [key, value] of Object.entries(obj as Record<string, unknown>)) { |
| 114 | if (key.includes('@odata')) continue |
| 115 | |
| 116 | cleaned[key] = cleanODataMetadata(value) |
| 117 | } |
| 118 | |
| 119 | return cleaned as T |
| 120 | } |