Files
docx-js/src/export/formatter.ts

15 lines
495 B
TypeScript
Raw Normal View History

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 = { stack: [] } as unknown as IContext): IXmlableObject {
2021-03-11 01:06:55 +00:00
const output = input.prepForXml(context);
if (output) {
return output;
} else {
throw Error("XMLComponent did not format correctly");
}
2016-03-28 00:53:24 +01:00
}
}