MCPcopy Create free account
hub / github.com/jakesgordon/javascript-state-machine / dotify

Function dotify

lib/visualize.js:214–235  ·  view source on GitHub ↗
(dotcfg)

Source from the content-addressed store, hash-verified

212}
213
214function dotify(dotcfg) {
215
216 dotcfg = dotcfg || {};
217
218 var name = dotcfg.name || 'fsm',
219 states = dotcfg.states || [],
220 transitions = dotcfg.transitions || [],
221 rankdir = dotcfg.rankdir,
222 output = [],
223 n, max;
224
225 output.push("digraph " + quote(name) + " {")
226 if (rankdir)
227 output.push(" rankdir=" + rankdir + ";")
228 for(n = 0, max = states.length ; n < max ; n++)
229 output.push(dotify.state(states[n]))
230 for(n = 0, max = transitions.length ; n < max ; n++)
231 output.push(dotify.edge(transitions[n]))
232 output.push("}")
233 return output.join("\n")
234
235}
236
237dotify.state = function(state) {
238 return " " + quote(state) + ";"

Callers 2

visualizeFunction · 0.70
visualize.jsFile · 0.50

Calls 1

quoteFunction · 0.70

Tested by

no test coverage detected