(file: ImportFile)
| 49 | ]) |
| 50 | |
| 51 | function parseJsonFile(file: ImportFile): Record<string, unknown> | null { |
| 52 | try { |
| 53 | const parsed = JSON.parse(file.content) |
| 54 | return parsed && typeof parsed === 'object' && !Array.isArray(parsed) |
| 55 | ? (parsed as Record<string, unknown>) |
| 56 | : null |
| 57 | } |
| 58 | catch { |
| 59 | return null |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | function getSnippetBody(value: unknown): string | null { |
| 64 | if (typeof value === 'string') { |
no outgoing calls
no test coverage detected