phylotree 1.4.2 → 2.0.0
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.
- package/package.json +1 -1
- package/src/formats/newick.js +6 -5
package/package.json
CHANGED
package/src/formats/newick.js
CHANGED
|
@@ -251,14 +251,15 @@ export function getNewick(annotator, root) {
|
|
|
251
251
|
element_array.push(")");
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
if(n.data.name
|
|
255
|
-
const node_label = n.data.name.
|
|
254
|
+
if(n.data.name !== 'root') {
|
|
255
|
+
const node_label = n.data.name.replaceAll("'", "''");
|
|
256
256
|
|
|
257
|
-
//
|
|
258
|
-
|
|
257
|
+
// Surround the entire string with single quotes if it contains any
|
|
258
|
+
// non-alphanumeric characters.
|
|
259
|
+
if (/\W/.test(node_label)) {
|
|
259
260
|
element_array.push("'" + node_label + "'");
|
|
260
261
|
} else {
|
|
261
|
-
element_array.push(
|
|
262
|
+
element_array.push(node_label);
|
|
262
263
|
}
|
|
263
264
|
}
|
|
264
265
|
element_array.push(annotator(n));
|