ts-graphviz
Advanced tools
Comparing version 1.4.1-dev.d42db466f to 1.5.1-dev.43c55b93e
@@ -0,1 +1,11 @@ | ||
function escapeValue(value) { | ||
if (value !== true) { | ||
if (typeof value === 'string' && /\s/g.test(value)) { | ||
return `="${value}"`; | ||
} else { | ||
return `=${value}`; | ||
} | ||
} | ||
return ''; | ||
} | ||
function* args(options) { | ||
@@ -7,4 +17,3 @@ const { suppressWarnings = true, format = 'svg', attributes = {}, library = [], y = false, scale } = options; | ||
for (const [key, value] of Object.entries(attributes.graph)) { | ||
if (value === true) yield `-G${key}`; | ||
else yield `-G${key}="${value}"`; | ||
yield `-G${key}${escapeValue(value)}`; | ||
} | ||
@@ -14,4 +23,3 @@ } | ||
for (const [key, value] of Object.entries(attributes.node)) { | ||
if (value === true) yield `-N${key}`; | ||
else yield `-N${key}="${value}"`; | ||
yield `-N${key}${escapeValue(value)}`; | ||
} | ||
@@ -21,4 +29,3 @@ } | ||
for (const [key, value] of Object.entries(attributes.edge)) { | ||
if (value === true) yield `-E${key}`; | ||
else yield `-E${key}="${value}"`; | ||
yield `-E${key}${escapeValue(value)}`; | ||
} | ||
@@ -25,0 +32,0 @@ } |
{ | ||
"name": "ts-graphviz", | ||
"version": "1.4.1-dev.d42db466f", | ||
"version": "1.5.1-dev.43c55b93e", | ||
"author": "kamiazya <yuki@kamiazya.tech>", | ||
@@ -5,0 +5,0 @@ "description": "Graphviz library for TypeScript.", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
568536
18915