Files
docx-js/src/templater/replacer.ts

16 lines
461 B
TypeScript
Raw Normal View History

2023-02-16 20:17:48 +00:00
import { Paragraph, TextRun } from "@file/paragraph";
import { ElementCompact } from "xml-js";
2023-02-17 10:38:03 +00:00
import { IPatch } from "./from-docx";
2023-02-16 20:17:48 +00:00
2023-02-17 10:38:03 +00:00
export const replacer = (json: ElementCompact, options: IPatch): ElementCompact => {
2023-02-16 20:17:48 +00:00
for (const child of options.children) {
if (child instanceof Paragraph) {
console.log("is para");
} else if (child instanceof TextRun) {
console.log("is text");
}
}
return json;
};