bilderhic
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "bilderhic", | ||
"version": " 1.2.0", | ||
"version": " 1.2.1", | ||
"description": "Bilderhic (bhic) is a smart and simple command tool for automatization.", | ||
@@ -70,3 +70,3 @@ "preferGlobal": true, | ||
"colors": "^1.4.0", | ||
"fast-xml-parser": "^3.20.3", | ||
"fast-xml-parser": "^4.2.4", | ||
"fs-extra": "^8.1.0", | ||
@@ -81,2 +81,2 @@ "glob": "^8.0.2", | ||
} | ||
} | ||
} |
const fs = require("fs"); | ||
const parser = require("fast-xml-parser"); | ||
const { XMLParser, XMLBuilder } = require("fast-xml-parser"); | ||
const ObjectEditor = require("./base/object-editor"); | ||
const XmlHelper = require("./helpers/xml.helper"); | ||
const JsonToXmlParser = parser.j2xParser; | ||
const defaultOptions = { | ||
@@ -40,3 +38,4 @@ ignoreAttributes: false, | ||
else { | ||
this.object = parser.parse(content, this.options); | ||
const parser = new XMLParser(this.options); | ||
this.object = parser.parse(content); | ||
} | ||
@@ -52,3 +51,4 @@ } | ||
else { | ||
this.object = parser.parse(content, this.options); | ||
const parser = new XMLParser(this.options); | ||
this.object = parser.parse(content); | ||
} | ||
@@ -94,10 +94,12 @@ } | ||
configure(key, value) { | ||
let parsedValue = value; | ||
if (value === "true") { | ||
value = true; | ||
parsedValue = true; | ||
} | ||
else if (value === "false") { | ||
value = false; | ||
parsedValue = false; | ||
} | ||
super.configure(key, value); | ||
super.configure(key, parsedValue); | ||
} | ||
@@ -155,2 +157,3 @@ | ||
// eslint-disable-next-line eqeqeq | ||
if (this.options.selfClosingTagsIgnores && this.options.selfClosingTagsIgnores != "") { | ||
@@ -167,4 +170,4 @@ ignores = this.options.selfClosingTagsIgnores.trim().split(","); | ||
serialize() { | ||
const jsonParser = new JsonToXmlParser(this.options); | ||
const finalContent = this.declaration + jsonParser.parse(this.object); | ||
const builder = new XMLBuilder(); | ||
const finalContent = this.declaration + builder.build(this.object); | ||
return finalContent; | ||
@@ -171,0 +174,0 @@ } |
@@ -0,0 +0,0 @@ const path = require("path"); |
144190
3714
+ Addedfast-xml-parser@4.3.6(transitive)
- Removedfast-xml-parser@3.21.1(transitive)
- Removedyaml@2.4.2(transitive)
Updatedfast-xml-parser@^4.2.4