yml-validate

1.0.2 • Public • Published

yml-validate

This package implements a configurable YAML validation function. You can see the usage examples in the tests directory.

Example:

  const C = {
    children: {
      foo: { type: VT.STRLIT_ONE_OF, values: ["bar"] },
      something: {
        allowListValues: true,
      },
      wow: {
        type: VT.BLOCK,
        children: {
          well: { type: VT.STRLIT_ONE_OF, values: ["five"] }
        },
      },
    },
  };
  const yaml = `
foo: bar
something:
  - Hello
  - 123
  - Times
  - Three
wow:
  well: five
`;
// this gives an empty array, signaling that there is no validation errors
// in the provided YAML input
const validateYaml(C, yaml);
// or
const validateMyYaml = validateWith(C);
validateMyYaml(yaml);

Package Sidebar

Install

npm i yml-validate

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

25.8 kB

Total Files

6

Last publish

Collaborators

  • gudmitrii