sankey = {
const sankey = d3
.sankey()
.nodeId(d => d.name)
.nodeAlign(d3.sankeyJustify)
.nodeWidth(15)
.nodePadding(10)
.extent([[1, 5], [width - 1, height - 5]]);
return ({ nodes, links }) =>
sankey({
nodes: nodes.map(d => Object.assign({}, d)),
links: links.map(d => Object.assign({}, d))
});
}