refactor(parsedata): destruct data

This commit is contained in:
moklick
2019-08-06 16:41:58 +02:00
parent fbbd0a93ba
commit 59cd72ddef
5 changed files with 46 additions and 39 deletions
+15 -12
View File
@@ -26,22 +26,25 @@ export const removeElements = (elements, elementsToRemove) => {
const getEdgeId = (e) => `react-graph__edge-${e.source}-${e.target}`;
export const parseElement = (e) => {
e.type = e.type || 'default';
if (isEdge(e)) {
e.id = e.id ? e.id.toString() : getEdgeId(e);
return e;
return {
...e,
type: e.type || 'default',
id: e.id ? e.id.toString() : getEdgeId(e)
};
}
e.id = e.id.toString();
e.__rg = {
position: e.position,
width: null,
height: null,
handleBounds : {}
return {
...e,
id: e.id.toString(),
type: e.type || 'default',
__rg: {
position: e.position,
width: null,
height: null,
handleBounds : {}
}
};
return { ...e };
};
export const separateElements = (res, element) => {