I've recently discovered the usefulness of YAML. I've used a package on npm that allows for the importation of .yaml files, and it works really well. But I think there should be some notation that allows for YAML code directly in a JS file. Consider this:
const json = {
"hello": "world",
"foo1": {
"bar": true,
"baz": false
},
"foo2": {
"bar": true,
"baz": false
},
"blockquote": "Hello World\n\t—The Computer"
}
/* In YAML, it would look like this */
// three hyphens to begin YAML
const yaml = ---
hello: world
foo1: &foo
bar: true
baz: false
foo2: *foo
blockquote: |
Hello World
—The Computer
...
// three dots to end YAML
These two variables are identical.