MCPcopy Create free account
hub / github.com/bywwcnll/StreamPanel / normalizeImportData

Function normalizeImportData

devtools/modules/importManager.js:62–85  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

60}
61
62function 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
87function isConnectionLike(data) {
88 return data &&

Callers 1

handleImportFunction · 0.70

Calls 2

normalizeConnectionFunction · 0.70
isConnectionLikeFunction · 0.70

Tested by

no test coverage detected