2021-03-11 01:06:55 +00:00
|
|
|
import { BaseXmlComponent, IContext, IXmlableObject } from "file/xml-components";
|
2016-03-28 00:53:24 +01:00
|
|
|
|
|
|
|
export class Formatter {
|
2021-03-11 01:06:55 +00:00
|
|
|
// tslint:disable-next-line: no-object-literal-type-assertion
|
|
|
|
public format(input: BaseXmlComponent, context: IContext = {} as IContext): IXmlableObject {
|
|
|
|
const output = input.prepForXml(context);
|
2018-09-20 00:41:57 +01:00
|
|
|
|
|
|
|
if (output) {
|
|
|
|
return output;
|
|
|
|
} else {
|
|
|
|
throw Error("XMLComponent did not format correctly");
|
|
|
|
}
|
2016-03-28 00:53:24 +01:00
|
|
|
}
|
2017-03-09 20:49:14 +01:00
|
|
|
}
|