@yaml-tools/visit-operator
v1.0.5
Published
A utility to process special YAML nodes, lets call them operators, with the purpose of making plain YAML a little bit smarter.
Downloads
1
Readme
@yaml-tools/visit-operator
A utility for the yaml package to process special nodes, lets call them operators, with the purpose of making plain YAML a little bit smarter.
With this visitor, you can implement YAML file inclusion or node substitution for example. Visitors can return a new map, sequence, scalar or undefined.
Basic example
+with:
- hello
import visitOperator from `@yaml-tools/visit-operator`;
const newYaml = visitOperator(yaml, '+with', (args, node) => {
// args === []
return ...
});
Arguments example
+with a b c:
- hello
const newYaml = visitOperator(yaml, '+with', (args, node) => {
// args === ['a', 'b', 'c']
return ...
});