move break up higher in order, to use the simpler push instead of splice

This commit is contained in:
Tom Hunkapiller
2021-05-22 05:00:30 +03:00
parent 2611e0c74f
commit fcc393aca2

View File

@ -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());
}
}
}
}