29 lines
790 B
TypeScript
29 lines
790 B
TypeScript
import * as _ from "lodash";
|
|
import { BaseXmlComponent } from "./base";
|
|
|
|
export abstract class XmlComponent extends BaseXmlComponent {
|
|
protected root: Array<BaseXmlComponent | string>;
|
|
|
|
constructor(rootKey: string) {
|
|
super(rootKey);
|
|
this.root = new Array<BaseXmlComponent>();
|
|
}
|
|
|
|
public replaceKey(): void {
|
|
// console.log(this.rootKey);
|
|
// console.log(this.root);
|
|
if (this.root !== undefined) {
|
|
this.root.forEach((root) => {
|
|
if (root && root instanceof BaseXmlComponent) {
|
|
root.replaceKey();
|
|
}
|
|
});
|
|
this[this.rootKey] = this.root;
|
|
delete this.root;
|
|
}
|
|
}
|
|
}
|
|
|
|
export * from "./attributes"
|
|
export * from "./default-attributes";
|