Add yaml parse+mutate+reserialize test

This commit is contained in:
Dragory 2020-10-19 20:10:16 +03:00
parent 76f7658763
commit a8b105bdec
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 39 additions and 2 deletions

View file

@ -0,0 +1,22 @@
import YAML from "yawn-yaml/cjs";
import { load } from "js-yaml";
const src = `
prefix: '!'
plugins:
myplugin:
config:
can_do_thing: true
# Lol
can_do_other_thing: false
`;
const json = load(src);
const yaml = new YAML(src);
json.plugins.myplugin.config.can_do_thing = false;
yaml.json = json;
console.log(yaml.yaml);