mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
update to remove un-needed replace
This commit is contained in:
parent
73c979b7aa
commit
01e4f9bb2f
3 changed files with 4 additions and 4 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -96,7 +96,7 @@
|
||||||
"vkbeautify": "^0.99.3",
|
"vkbeautify": "^0.99.3",
|
||||||
"xpath": "0.0.34",
|
"xpath": "0.0.34",
|
||||||
"xregexp": "^5.1.1",
|
"xregexp": "^5.1.1",
|
||||||
"yaml": "^2.2.1",
|
"yaml": "^2.7.0",
|
||||||
"zlibjs": "^0.3.1"
|
"zlibjs": "^0.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
"vkbeautify": "^0.99.3",
|
"vkbeautify": "^0.99.3",
|
||||||
"xpath": "0.0.34",
|
"xpath": "0.0.34",
|
||||||
"xregexp": "^5.1.1",
|
"xregexp": "^5.1.1",
|
||||||
"yaml": "^2.2.1",
|
"yaml": "^2.7.0",
|
||||||
"zlibjs": "^0.3.1"
|
"zlibjs": "^0.3.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -36,8 +36,8 @@ class JSONToYAML extends Operation {
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const doc = new YAML.Document();
|
const doc = new YAML.Document();
|
||||||
try {
|
try {
|
||||||
doc.contents = JSON.parse(input.replace(/(\w+):/gm, `"$1":`));
|
doc.contents = YAML.stringify(JSON.parse(input));
|
||||||
return doc.toString();
|
return doc.toString().replace(/^\|\n/, "");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new OperationError("Unable to parse JSON to YAML: " + err.toString());
|
throw new OperationError("Unable to parse JSON to YAML: " + err.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue