@ai-sdk-tool/rxml 0.1.2-canary.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -211,14 +211,15 @@ function unescapeXml(text) {
|
|
|
211
211
|
|
|
212
212
|
// src/builders/stringify.ts
|
|
213
213
|
function stringify(rootTag, obj, options = {}) {
|
|
214
|
-
var _a, _b, _c, _d;
|
|
214
|
+
var _a, _b, _c, _d, _e;
|
|
215
215
|
try {
|
|
216
216
|
const format = (_a = options.format) != null ? _a : true;
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
const
|
|
217
|
+
const declaration = (_b = options.declaration) != null ? _b : false;
|
|
218
|
+
const minimalEscaping = (_c = options.minimalEscaping) != null ? _c : false;
|
|
219
|
+
const suppressEmptyNode = (_d = options.suppressEmptyNode) != null ? _d : false;
|
|
220
|
+
const strictBooleanAttributes = (_e = options.strictBooleanAttributes) != null ? _e : false;
|
|
220
221
|
let result = "";
|
|
221
|
-
if (
|
|
222
|
+
if (declaration) {
|
|
222
223
|
result += '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
223
224
|
}
|
|
224
225
|
result += stringifyValue(rootTag, obj, {
|
|
@@ -228,6 +229,9 @@ function stringify(rootTag, obj, options = {}) {
|
|
|
228
229
|
minimalEscaping,
|
|
229
230
|
strictBooleanAttributes
|
|
230
231
|
});
|
|
232
|
+
if (result.endsWith("\n")) {
|
|
233
|
+
return result.slice(0, -1);
|
|
234
|
+
}
|
|
231
235
|
return result;
|
|
232
236
|
} catch (error) {
|
|
233
237
|
throw new RXMLStringifyError("Failed to stringify XML", error);
|