How to use the yaml/types.strOptions.fold function in yaml

To help you get started, we’ve selected a few yaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mermade / openapi-filter / openapi-filter.js View on Github external
.default('lineWidth',-1)
    .number('maxAliasCount')
    .default('maxAliasCount',100)
    .describe('maxAliasCount','maximum YAML aliases allowed')
    .help()
    .version()
    .argv;

let s = fs.readFileSync(argv.infile,'utf8');
let obj = yaml.parse(s, {maxAliasCount: argv.maxAliasCount});
let res = openapiFilter.filter(obj,argv);
if (argv.infile.indexOf('.json')>=0) {
    s = JSON.stringify(res,null,2);
}
else {
    strOptions.fold.lineWidth = argv.lineWidth;
    s = yaml.stringify(res);
}
if (argv.outfile) {
    fs.writeFileSync(argv.outfile,s,'utf8');
}
else {
    console.log(s);
}
github graphprotocol / graph-cli / src / subgraph.js View on Github external
static dump(manifest) {
    strOptions.fold.lineWidth = 90
    strOptions.defaultType = 'PLAIN'

    return yaml.stringify(manifest.toJS())
  }