mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-27 03:09:43 +02:00
refactor: convert if-statements to switch..case
This commit is contained in:
@@ -832,14 +832,15 @@ const getTypeFromVertex = (vertex: FlowVertex) => {
|
|||||||
}
|
}
|
||||||
return 'icon';
|
return 'icon';
|
||||||
}
|
}
|
||||||
if (vertex.type === 'square') {
|
switch (vertex.type) {
|
||||||
return 'squareRect';
|
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);
|
const findNode = (nodes: Node[], id: string) => nodes.find((node) => node.id === id);
|
||||||
|
Reference in New Issue
Block a user