Remove filtering of nodes.

This commit is contained in:
Paulo Gustavo Veiga 2022-02-21 07:17:43 -08:00
parent 2c57631ce6
commit 69f7881e0e

View File

@ -40,9 +40,8 @@ class TxtExporter extends Exporter {
private traverseBranch(indent: string, prefix: string, branches: INodeModel[]) { private traverseBranch(indent: string, prefix: string, branches: INodeModel[]) {
let result = ''; let result = '';
branches branches
.filter((n) => n.getText() !== undefined)
.forEach((node, index) => { .forEach((node, index) => {
result = `${result}${indent}${prefix}${index + 1} ${node.getText()}`; result = `${result}${indent}${prefix}${index + 1} ${node.getText() !== undefined ? node.getText() : ''}`;
node.getFeatures().forEach((f) => { node.getFeatures().forEach((f) => {
const type = f.getType(); const type = f.getType();
if (type === 'link') { if (type === 'link') {
@ -54,9 +53,7 @@ class TxtExporter extends Exporter {
}); });
result = `${result}\n`; result = `${result}\n`;
if (node.getChildren().filter((n) => n.getText() !== undefined).length > 0) {
result += this.traverseBranch(`\t${indent}`, `${prefix}${index + 1}.`, node.getChildren()); result += this.traverseBranch(`\t${indent}`, `${prefix}${index + 1}.`, node.getChildren());
}
}); });
return result; return result;
} }