This commit is contained in:
David Marshall 2023-04-19 22:30:52 -04:00
parent c8e306d4f4
commit 3acbe2f744
2 changed files with 3 additions and 3 deletions

View file

@ -4,7 +4,7 @@
* @license Apache-2.0
*/
import YAML from 'yaml'
import YAML from "yaml";
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
@ -37,7 +37,7 @@ class JSONToYAML extends Operation {
const doc = new YAML.Document();
try {
doc.contents = JSON.parse(input.replace(/(\w+):/gm, `"$1":`));
return doc.toString()
return doc.toString();
} catch (err) {
throw new OperationError("Unable to parse JSON to YAML: " + err.toString());
}

View file

@ -4,7 +4,7 @@
* @license Apache-2.0
*/
import YAML from 'yaml'
import YAML from "yaml";
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";