formatting, update
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Timo Hocker 2021-05-02 11:30:21 +02:00
parent fa8e0d25c6
commit 019647b04a
4 changed files with 859 additions and 1394 deletions

View File

@ -83,7 +83,7 @@ export class Graph extends Element {
.replace (/^\s+$/gmu, ''); .replace (/^\s+$/gmu, '');
} }
public add_node (constructor: ((n: Node) => void) | string): string { public add_node (constructor: string | ((n: Node) => void)): string {
const node = new Node ('unnamed', this.full_name); const node = new Node ('unnamed', this.full_name);
if (typeof constructor === 'string') { if (typeof constructor === 'string') {
@ -96,7 +96,7 @@ export class Graph extends Element {
return node.full_name; return node.full_name;
} }
public add_graph (constructor: ((g: Graph) => void) | string): string { public add_graph (constructor: string | ((g: Graph) => void)): string {
const graph = new Graph ('unnamed', this.full_name); const graph = new Graph ('unnamed', this.full_name);
graph.directional = this.directional; graph.directional = this.directional;

View File

@ -42,7 +42,7 @@ export class GraphStream extends Transform {
return ' '.repeat (this._path.length); return ' '.repeat (this._path.length);
} }
private finish_node ():void { private finish_node (): void {
if ( if (
[ [
'ce', 'ce',
@ -168,7 +168,7 @@ export class GraphStream extends Transform {
// this.write ({ type: 'en', args: [] }); // this.write ({ type: 'en', args: [] });
} }
public create_graph (name: string, type: 'u'|'d'|'s' = 's'): void { public create_graph (name: string, type: 'd' | 's' | 'u' = 's'): void {
const instr_type = `c${type}g` as GraphStreamCommand; const instr_type = `c${type}g` as GraphStreamCommand;
this.write ({ type: instr_type, args: [ validate_name (name) ] }); this.write ({ type: instr_type, args: [ validate_name (name) ] });
} }

View File

@ -43,7 +43,7 @@ const complex = `digraph foo {
// eslint-disable-next-line max-lines-per-function // eslint-disable-next-line max-lines-per-function
describe ('stream', () => { describe ('stream', () => {
it ('stream graph', () => new Promise ((resolve) => { it ('stream graph', () => new Promise<void> ((resolve) => {
let output = ''; let output = '';
const stream = (new GraphStream); const stream = (new GraphStream);
stream.on ('data', (data) => { stream.on ('data', (data) => {
@ -60,7 +60,7 @@ describe ('stream', () => {
})); }));
// eslint-disable-next-line max-statements // eslint-disable-next-line max-statements
it ('complex stream graph', () => new Promise ((resolve) => { it ('complex stream graph', () => new Promise<void> ((resolve) => {
let output = ''; let output = '';
const stream = (new GraphStream); const stream = (new GraphStream);
stream.on ('data', (data) => { stream.on ('data', (data) => {
@ -111,31 +111,31 @@ describe ('stream', () => {
* ce eg, cn, csg, ce, at cug, cdg * ce eg, cn, csg, ce, at cug, cdg
*/ */
const cn = (g:GraphStream) => { const cn = (g: GraphStream) => {
g.create_node ('foo'); g.create_node ('foo');
}; };
const cug = (g:GraphStream) => { const cug = (g: GraphStream) => {
g.create_graph ('foo', 'u'); g.create_graph ('foo', 'u');
}; };
const cdg = (g:GraphStream) => { const cdg = (g: GraphStream) => {
g.create_graph ('foo', 'd'); g.create_graph ('foo', 'd');
}; };
const csg = (g:GraphStream) => { const csg = (g: GraphStream) => {
g.create_graph ('foo', 's'); g.create_graph ('foo', 's');
}; };
const eg = (g:GraphStream) => { const eg = (g: GraphStream) => {
g.end_graph (); g.end_graph ();
}; };
const at = (g:GraphStream) => { const at = (g: GraphStream) => {
g.attributes ({ color: 'red' }); g.attributes ({ color: 'red' });
}; };
const ce = (g:GraphStream) => { const ce = (g: GraphStream) => {
g.create_edge ('foo', 'bar'); g.create_edge ('foo', 'bar');
}; };
const combinations = [ const combinations = [
{ {
primary: (g:GraphStream) => { primary: (g: GraphStream) => {
cug (g); cug (g);
cn (g); cn (g);
}, },
@ -159,7 +159,7 @@ describe ('stream', () => {
] ]
}, },
{ {
primary: (g:GraphStream) => { primary: (g: GraphStream) => {
cug (g); cug (g);
csg (g); csg (g);
}, },
@ -169,7 +169,7 @@ describe ('stream', () => {
] ]
}, },
{ {
primary: (g:GraphStream) => { primary: (g: GraphStream) => {
cug (g); cug (g);
csg (g); csg (g);
eg (g); eg (g);
@ -181,7 +181,7 @@ describe ('stream', () => {
] ]
}, },
{ {
primary: (g:GraphStream) => { primary: (g: GraphStream) => {
cug (g); cug (g);
at (g); at (g);
}, },
@ -192,7 +192,7 @@ describe ('stream', () => {
] ]
}, },
{ {
primary: (g:GraphStream) => { primary: (g: GraphStream) => {
cug (g); cug (g);
ce (g); ce (g);
}, },

2217
yarn.lock

File diff suppressed because it is too large Load Diff