move break up higher in order, to use the simpler push
instead of splice
This commit is contained in:
@ -29,6 +29,12 @@ export class Run extends XmlComponent {
|
||||
this.properties = new RunProperties(options);
|
||||
this.root.push(this.properties);
|
||||
|
||||
if (options.break) {
|
||||
for (let i = 0; i < options.break; i++) {
|
||||
this.root.push(new Break());
|
||||
}
|
||||
}
|
||||
|
||||
if (options.children) {
|
||||
for (const child of options.children) {
|
||||
if (typeof child === "string") {
|
||||
@ -63,11 +69,5 @@ export class Run extends XmlComponent {
|
||||
} else if (options.text) {
|
||||
this.root.push(new Text(options.text));
|
||||
}
|
||||
|
||||
if (options.break) {
|
||||
for (let i = 0; i < options.break; i++) {
|
||||
this.root.splice(1, 0, new Break());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user