Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const productionToDiagram = (production, options) => {
if (production.identifier) {
return production.complex
? ComplexDiagram(productionToDiagram(production.definition, options))
: Diagram(productionToDiagram(production.definition, options));
}
if (production.terminal) {
return Terminal(production.terminal);
}
if (production.nonTerminal) {
return NonTerminal(production.nonTerminal, {
href: `#${dasherize(production.nonTerminal)}`
});
}
if (production.skip) {
return Skip();
}
if (production.specialSequence) {
const sequence = NonTerminal(" " + production.specialSequence + " ", {});
sequence.attrs.class = "special-sequence";