1.1.0 • Published 9 months ago

top-dag-mermaid v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

top-dag-mermaid

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly Semantic Release

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:

  1. execute npm run test:debug
  2. open the browser and go to chrome://inspect
  3. click on "Open Dedicated DevTools for Node"
  4. click on the address displayed in the terminal (usually something like localhost:9229)