rename toXml -> prepForXml

This commit is contained in:
felipe
2017-03-10 08:23:27 +01:00
parent 50ca71087e
commit c521d0ce63
4 changed files with 8 additions and 11 deletions

View File

@ -10,16 +10,15 @@ export abstract class XmlComponent extends BaseXmlComponent {
this.root = new Array<BaseXmlComponent>();
}
public toXml(): object {
// What does 'ret' stand for? Retain? Return?
const ret = this.root.map((comp) => {
public prepForXml(): object {
const children = this.root.map((comp) => {
if (comp instanceof BaseXmlComponent) {
return comp.toXml();
return comp.prepForXml();
}
return comp;
}).filter((comp) => comp); // Exclude null, undefined, and empty strings
return {
[this.rootKey]: ret,
[this.rootKey]: children,
};
}
}