refactor: convert if-statements to switch..case

This commit is contained in:
Alois Klink
2024-10-18 16:57:46 +09:00
parent e765007b21
commit 7fa8b35bdc

View File

@@ -832,14 +832,15 @@ const getTypeFromVertex = (vertex: FlowVertex) => {
}
return 'icon';
}
if (vertex.type === 'square') {
return 'squareRect';
switch (vertex.type) {
case 'square':
case undefined:
return 'squareRect';
case 'round':
return 'roundedRect';
default:
return vertex.type;
}
if (vertex.type === 'round') {
return 'roundedRect';
}
return vertex.type ?? 'squareRect';
};
const findNode = (nodes: Node[], id: string) => nodes.find((node) => node.id === id);