ts-graphviz 1.4.1-dev.d42db466f → 1.5.1-dev.43c55b93e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,26 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
function escapeValue(value) {
|
|
6
|
+
if (value !== true) {
|
|
7
|
+
if (typeof value === 'string' && /\s/g.test(value)) {
|
|
8
|
+
return `="${value}"`;
|
|
9
|
+
} else {
|
|
10
|
+
return `=${value}`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
5
15
|
function* args(options) {
|
|
6
16
|
const { suppressWarnings = true, format = 'svg', attributes = {}, library = [], y = false, scale } = options;
|
|
7
17
|
if (suppressWarnings) yield '-q';
|
|
8
18
|
yield `-T${format}`;
|
|
9
19
|
if (attributes.graph) {
|
|
10
20
|
for (const [key, value] of Object.entries(attributes.graph)) {
|
|
11
|
-
|
|
12
|
-
else yield `-G${key}="${value}"`;
|
|
21
|
+
yield `-G${key}${escapeValue(value)}`;
|
|
13
22
|
}
|
|
14
23
|
}
|
|
15
24
|
if (attributes.node) {
|
|
16
25
|
for (const [key, value] of Object.entries(attributes.node)) {
|
|
17
|
-
|
|
18
|
-
else yield `-N${key}="${value}"`;
|
|
26
|
+
yield `-N${key}${escapeValue(value)}`;
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
if (attributes.edge) {
|
|
22
30
|
for (const [key, value] of Object.entries(attributes.edge)) {
|
|
23
|
-
|
|
24
|
-
else yield `-E${key}="${value}"`;
|
|
31
|
+
yield `-E${key}${escapeValue(value)}`;
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
if (typeof scale === 'number' && !Number.isNaN(scale)) yield `-s${scale}`;
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
+
function escapeValue(value) {
|
|
2
|
+
if (value !== true) {
|
|
3
|
+
if (typeof value === 'string' && /\s/g.test(value)) {
|
|
4
|
+
return `="${value}"`;
|
|
5
|
+
} else {
|
|
6
|
+
return `=${value}`;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
1
11
|
function* args(options) {
|
|
2
12
|
const { suppressWarnings = true, format = 'svg', attributes = {}, library = [], y = false, scale } = options;
|
|
3
13
|
if (suppressWarnings) yield '-q';
|
|
4
14
|
yield `-T${format}`;
|
|
5
15
|
if (attributes.graph) {
|
|
6
16
|
for (const [key, value] of Object.entries(attributes.graph)) {
|
|
7
|
-
|
|
8
|
-
else yield `-G${key}="${value}"`;
|
|
17
|
+
yield `-G${key}${escapeValue(value)}`;
|
|
9
18
|
}
|
|
10
19
|
}
|
|
11
20
|
if (attributes.node) {
|
|
12
21
|
for (const [key, value] of Object.entries(attributes.node)) {
|
|
13
|
-
|
|
14
|
-
else yield `-N${key}="${value}"`;
|
|
22
|
+
yield `-N${key}${escapeValue(value)}`;
|
|
15
23
|
}
|
|
16
24
|
}
|
|
17
25
|
if (attributes.edge) {
|
|
18
26
|
for (const [key, value] of Object.entries(attributes.edge)) {
|
|
19
|
-
|
|
20
|
-
else yield `-E${key}="${value}"`;
|
|
27
|
+
yield `-E${key}${escapeValue(value)}`;
|
|
21
28
|
}
|
|
22
29
|
}
|
|
23
30
|
if (typeof scale === 'number' && !Number.isNaN(scale)) yield `-s${scale}`;
|
package/package.json
CHANGED