1.0.5 • Published 1 year ago

@yaml-tools/visit-operator v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

@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 ...
});