homeassistant-js-yaml-schema
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

homeassistant-js-yaml-schema

Coverage Status

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.

Package Sidebar

Install

npm i homeassistant-js-yaml-schema

Weekly Downloads

7

Version

1.1.1

License

MIT

Unpacked Size

6.77 kB

Total Files

11

Last publish

Collaborators

  • pascalre