homeassistant-js-yaml-schema
v1.1.1
Published
Schema to allow js-yaml to process YAML formatted Home Assistent templates that use Home Assistent specific local tags while parsing or dumping.
Downloads
48
Maintainers
Readme
homeassistant-js-yaml-schema
Schema to allow js-yaml to process YAML formatted Home Assistent templates that use Home Assistent specific local tags while parsing or dumping, for example: !env_var
, !include_dir_named
.
See tags.json for currently supported local tags.
Usage
const jsyaml = require('js-yaml');
const fs = require('fs');
import { HOMEASSISTANT_SCHEMA } from "homeassistant-js-yaml-schema"
let doc = yaml.load(fs.readFileSync('/path/to/file.yml', 'utf8'));
let body = jsyaml.load(doc, { schema: HOMEASSISTANT_SCHEMA });
console.log(JSON.stringify(body, null, 2));
body = jsyaml.dump(body, { schema: HOMEASSISTANT_SCHEMA });
console.log(body);
See usage in vscode-yaml-sort.
License
homeassistant-js-yaml-schema is licensed under the MIT License.