translate commands on error

This commit is contained in:
2020-05-08 09:44:37 +02:00
parent 6e53d8d260
commit 7a351b7dab
2 changed files with 37 additions and 15 deletions

View File

@ -1,11 +1,28 @@
/* eslint-disable line-comment-position */
/* eslint-disable no-inline-comments */
export type GraphStreamCommand =
'cn'| // create node
'en'| // end node
'cug'| // create unordered graph
'cdg'| // create directional graph
'csg'| // create subgraph
'eg'| // end graph
'at'| // add attributes
'ce' // create edge
type GraphStreamCommand =
'cn'|
'en'|
'cug'|
'cdg'|
'csg'|
'eg'|
'at'|
'ce'
function translate_command (cmd: GraphStreamCommand|''): string {
const translations = {
cn: 'create node',
en: 'end node',
cug: 'create unordered graph',
cdg: 'create directional graph',
csg: 'create subgraph',
eg: 'end graph',
at: 'attributes',
ce: 'create edge',
'': 'start'
};
return translations[cmd];
}
export { GraphStreamCommand, translate_command };