npm.io
0.5.0 • Published 5 years ago

@diagrams-ts/graphviz-functional-ts

Licence
MIT
Version
0.5.0
Deps
0
Size
34 kB
Vulns
0
Weekly
0
Stars
20

GraphViz-Functional

Create valid dot output using TypeScript. Get type support for all graph, node and edge properties. Use freely combinable render functions to create your dot input.

Installation and Requirements

Install this package by running:

npm install @diagrams-ts/graphviz-functional-ts

# or when using yarn

yarn add @diagrams-ts/graphviz-functional-ts

Usage

import { edges, createDotGraph } from "@diagrams-ts/graphviz-functional-ts";

createDotGraph([
  ...edges([
    { nodes: [{ id: "a1" }, { id: "b2" }] },
    { nodes: [{ id: "a1" }, { id: "b3" }] },
  ]),
]).then(console.log);

/*
 *  Will log:
 *
 *  digraph "g" {
 *     a1->b2 ;
 *     a3->b4 ;
 *  }
 */