update to remove un-needed replace
This commit is contained in:
parent
73c979b7aa
commit
01e4f9bb2f
2
package-lock.json
generated
2
package-lock.json
generated
@ -96,7 +96,7 @@
|
||||
"vkbeautify": "^0.99.3",
|
||||
"xpath": "0.0.34",
|
||||
"xregexp": "^5.1.1",
|
||||
"yaml": "^2.2.1",
|
||||
"yaml": "^2.7.0",
|
||||
"zlibjs": "^0.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -181,7 +181,7 @@
|
||||
"vkbeautify": "^0.99.3",
|
||||
"xpath": "0.0.34",
|
||||
"xregexp": "^5.1.1",
|
||||
"yaml": "^2.2.1",
|
||||
"yaml": "^2.7.0",
|
||||
"zlibjs": "^0.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@ -36,8 +36,8 @@ class JSONToYAML extends Operation {
|
||||
run(input, args) {
|
||||
const doc = new YAML.Document();
|
||||
try {
|
||||
doc.contents = JSON.parse(input.replace(/(\w+):/gm, `"$1":`));
|
||||
return doc.toString();
|
||||
doc.contents = YAML.stringify(JSON.parse(input));
|
||||
return doc.toString().replace(/^\|\n/, "");
|
||||
} catch (err) {
|
||||
throw new OperationError("Unable to parse JSON to YAML: " + err.toString());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user