Skip to content

Commit

Permalink
Fix sometime missing newline
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaitanLyss committed Aug 13, 2024
1 parent 6022a04 commit ff7ac8e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@selenite/commons",
"version": "0.18.19",
"version": "0.18.20",
"repository": "github:ShaitanLyss/selenite-commons",
"license": "MIT",
"keywords": [
Expand Down
4 changes: 3 additions & 1 deletion src/lib/utils/xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ export function buildXml({
newLine: true
});
}
return wu(res)
let xml = wu(res)
.map(({ xml, newLine }) => (newLine ? xml + '\n' : xml))
.reduce((a, b) => a + (a ? '\n' : '') + b, '');
if (!xml.endsWith("\n")) xml += "\n";
return xml;
}

export function getElementFromParsedXml(xml: Record<string, unknown>): string | null {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/xsd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class XmlSchema {
for (const { name: parentName, children } of this.complexTypes.values()) {
if (!children) continue;
for (const c of children) {
res.get(c.type)!.push(parentName);
res.get(c.type)?.push(parentName);
}
}
return res;
Expand Down

0 comments on commit ff7ac8e

Please sign in to comment.