(data)
| 60 | } |
| 61 | |
| 62 | function normalizeImportData(data) { |
| 63 | if (!data || typeof data !== 'object') { |
| 64 | return []; |
| 65 | } |
| 66 | |
| 67 | if (Array.isArray(data.connections)) { |
| 68 | return data.connections |
| 69 | .map((connection, index) => normalizeConnection(connection, index)) |
| 70 | .filter(Boolean); |
| 71 | } |
| 72 | |
| 73 | if (data.connection && Array.isArray(data.messages)) { |
| 74 | return [normalizeConnection({ |
| 75 | ...data.connection, |
| 76 | messages: data.messages |
| 77 | }, 0)].filter(Boolean); |
| 78 | } |
| 79 | |
| 80 | if (isConnectionLike(data)) { |
| 81 | return [normalizeConnection(data, 0)].filter(Boolean); |
| 82 | } |
| 83 | |
| 84 | return []; |
| 85 | } |
| 86 | |
| 87 | function isConnectionLike(data) { |
| 88 | return data && |
no test coverage detected