Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
attachElement(element: Element | null) {
if (!element || this.interpreter) {
return;
}
const { machine } = this.state;
const nodes = utils.getNodes(machine);
const graphNodes = [machine, ...nodes]
.map(node => {
const entryLabel = node.onEntry.length ? `\nentry / ${node.onEntry.join(',')}` : '';
const exitLabel = node.onExit.length ? `\nexit / ${node.onExit.join(',')}` : '';
return [
{
data: {
id: node.id,
label: node.key,
parent: node.parent ? node.parent.id : undefined,
parallel: node.parallel
}
},
node.initial && {
data: {