From fb606e734b751d7c76f1e0e1e6d421d67fe56ecb Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Mon, 26 Oct 2020 00:44:26 +0000 Subject: [PATCH] fix(core): update --- test/test.ts | 3 ++- ts/index.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/test.ts b/test/test.ts index 3ff91f9..b26a3c3 100644 --- a/test/test.ts +++ b/test/test.ts @@ -17,7 +17,8 @@ tap.test('should create an xml string', async () => { hello: { "@_xlmns:teststring": "hellothere", "@_xlmns:testnumber": 10, - wow: 'test' + wow: 'test', + url: [{loc: 3},{loc: 3}] } }); console.log(xmlResult); diff --git a/ts/index.ts b/ts/index.ts index 1f1a5fc..eb598b5 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -11,9 +11,11 @@ export class SmartXml { public createXmlFromObject(jsObject: any): string { const jsToXmlParser = new plugins.fastXmlParser.j2xParser({ ignoreAttributes: false, - attributeNamePrefix: "@_" + attributeNamePrefix: "@_", + format: true, + indentBy: ' ', }); const xml = jsToXmlParser.parse(jsObject); - return xml; + return '\n' + xml; } } \ No newline at end of file