提交 bcb8af78 编写于 作者: B baiy 提交者: ninecents

代码优化

上级 d2c4a58b
...@@ -4,7 +4,7 @@ import phpSerialize from "serialize-php" ...@@ -4,7 +4,7 @@ import phpSerialize from "serialize-php"
import propertiesToJSON from "properties-to-json" import propertiesToJSON from "properties-to-json"
import jsonToPropertiesParser from "json-to-properties/src/scripts/parser" import jsonToPropertiesParser from "json-to-properties/src/scripts/parser"
import yaml from "js-yaml" import yaml from "js-yaml"
import xmlFormatter from "xml-formatter" import formatter from "./formatter"
import X2JS from "x2js" import X2JS from "x2js"
export const TYPE = ["json", "xml", "yaml", "phpArray", "phpSerialize", "properties"]; export const TYPE = ["json", "xml", "yaml", "phpArray", "phpSerialize", "properties"];
...@@ -75,11 +75,7 @@ class serializeConversion { ...@@ -75,11 +75,7 @@ class serializeConversion {
getXml() { getXml() {
let x2js = new X2JS(); let x2js = new X2JS();
this.input = Object.keys(this.input).length > 1 ? {default_root:this.input} : this.input; this.input = Object.keys(this.input).length > 1 ? {default_root:this.input} : this.input;
return xmlFormatter(x2js.json2xml_str(this.input), { return formatter(x2js.json2xml_str(this.input),'xml');
indentation: ' ',
collapseContent: true,
lineSeparator: '\n'
});
} }
getYaml() { getYaml() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册