Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/comonadd/yml-validate
YML Validator
https://github.com/comonadd/yml-validate
Last synced: 16 days ago
JSON representation
YML Validator
- Host: GitHub
- URL: https://github.com/comonadd/yml-validate
- Owner: comonadd
- Created: 2021-06-25T10:33:04.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-08-20T13:46:52.000Z (about 3 years ago)
- Last Synced: 2024-10-13T22:42:31.507Z (about 1 month ago)
- Language: JavaScript
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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);
```