Improve node export
Summary: ^ Reviewed By: antonk52 Differential Revision: D49634301 fbshipit-source-id: a7e27d3f370a17f5eb3740772f572135e586e0c7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6e97e73cf1
commit
d971820609
@@ -82,12 +82,7 @@ export function exportNode(
|
|||||||
nodes: Map<Id, ClientNode>,
|
nodes: Map<Id, ClientNode>,
|
||||||
recursive: boolean = false,
|
recursive: boolean = false,
|
||||||
): any {
|
): any {
|
||||||
const rawExport: any = (
|
const rawExport: any = (node: ClientNode) => {
|
||||||
node: ClientNode,
|
|
||||||
metadata: Map<MetadataId, Metadata>,
|
|
||||||
nodes: Map<Id, ClientNode>,
|
|
||||||
recursive: boolean = false,
|
|
||||||
) => {
|
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
attributes: transform(node.attributes, metadata),
|
attributes: transform(node.attributes, metadata),
|
||||||
@@ -98,11 +93,11 @@ export function exportNode(
|
|||||||
throw new Error(`Node ${child} not found`);
|
throw new Error(`Node ${child} not found`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rawExport(childNode, metadata, nodes, recursive);
|
return rawExport(childNode);
|
||||||
})
|
})
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return JSON.stringify(rawExport(node, metadata, nodes, recursive), null, 2);
|
return JSON.stringify(rawExport(node), null, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user