1.1.0 • Published 9 months ago
top-dag-mermaid v1.1.0
top-dag-mermaid
top-dag-mermaid
Transforms directed acyclical graphs into mermaidjs-compatible flowchart strings.
Install
npm install top-dag-mermaid
Usage
import { transformDagToFlowchart, Dictionary } from 'top-dag-mermaid';
const dag = JSON.parse(`{
"data": {
"first": "first-data",
"second": "second-data",
"third": "third-data",
"fourth": "fourth-data"
},
"outgoingEdges": {
"first": [
"second",
"third"
],
"second": [],
"third": [
"fourth"
],
"fourth": []
}
}`);
const flowchartString = transformDagToFlowchart(dag, 'TD');
//=> 'flowchart TD\nfirst --> second\nfirst --> third\nsecond\nthird --> fourth\nfourth\n'
Development
Type: string
Default: rainbows
The most convenient way to debug tests is to use VS Code's built-in "Run and Debug" (Ctrl+Shift+D). The project has a launch.json
file to support this (on Windows), but you will still have to select the "Debug Jest Tests" script next to "RUN AND DEBUG".
To debug in any Chromium-based browser:
- execute
npm run test:debug
- open the browser and go to chrome://inspect
- click on "Open Dedicated DevTools for Node"
- click on the address displayed in the terminal (usually something like localhost:9229)