How to use the yaml.stringify 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 ory / docs / website / scripts / config.js View on Github external
const description = pathOr('', [...path, 'description'], schema);
  if (description) {
    comments.push(' ' + description.split('\n').join('\n '), '');
  }

  const defaultValue = pathOr('', [...path, 'default'], schema);
  if (defaultValue || defaultValue === false) {
    comments.push(' Default value: ' + defaultValue, '');
  }

  const examples = pathOr('', [...path, 'examples'], schema);
  if (examples) {
    comments.push(
      ' Examples:',
      ...YAML.stringify(examples)
        .split('\n')
        .map(i => ` ${i}`)
    ); // split always returns one empty object so no need for newline
  }

  let hasChildren;
  if (item.value.items) {
    item.value.items.forEach(item => {
      if (item.key) {
        enhance(schema, [...parents, key])(item);
        hasChildren = true;
      }
    });
  }

  if (!hasChildren) {
github graphsense / graphsense-dashboard / src / app.js View on Github external
generateTagpack () {
    return YAML.stringify({
      title: 'Tagpack exported from GraphSense ' + VERSION, // eslint-disable-line no-undef
      creator: this.rest.username,
      lastmod: moment().format('YYYY-MM-DD'),
      tags: this.store.getNotes()
    })
  }
  generateTagsJSON () {
github pauly / lightwaverf-api / scripts / configure.js View on Github external
getRoomAndDevices(config.room, (err, rooms) => {
      if (!err) config.room = rooms
      writeFile(configFile, stringify(config), 'utf8', err => {
        if (err) console.error(err)
        if (!config.calendar) return rl.close()
        rl.question(`Run schedule now? [Y/n]`, input => {
          rl.close()
          if (input.substr(0, 1).toLowerCase() === 'n') return
          runSchedule(err => {
            if (err) return console.error(err)
            console.log(`👍 done!`)
          })
        })
      })
    })
  })
github 44uk / nem2-dev-ui / src / pages / Mosaic / index.tsx View on Github external
function stringifyMosaicData(data: IMosaicData) {
  return YAML.stringify(data)
}
github OceanDataTools / openrvdas / contrib / utils / JSON_YAML_Creator / src / components / JSONYAMLOutput.js View on Github external
function (key, val) {
                  if (key !== 'kwargClass') return val;
                },
                2
              )}
            >
              <button>Copy JSON</button>
            
          
        
      
      <div>
        <div>
          <div>
            <pre>              {YAML.stringify(
                JSON.parse(
                  JSON.stringify(
                    combined,
                    function (key, val) {
                      if (key !== 'kwargClass') return val;
                    },
                    2
                  )
                )
              )}
            </pre>
          </div>
          <div>
            </div></div></div>
github aws / aws-cdk / packages / aws-cdk / lib / serialize.ts View on Github external
export function toYAML(obj: any): string {
  const oldFold = yamlTypes.strOptions.fold.lineWidth;
  try {
    yamlTypes.strOptions.fold.lineWidth = 0;
    return YAML.stringify(obj, { schema: 'yaml-1.1' });
  } finally {
    yamlTypes.strOptions.fold.lineWidth = oldFold;
  }
}
github Mermade / oas-kit / packages / oas-validator / index.js View on Github external
function validateSchema(schema, openapi, options) {
    validateMetaSchema(schema);
    let errors = validateSchema.errors;
    if (errors && errors.length) {
        if (options.prettify) {
            const errorStr = bae(schema, openapi, errors);
            throw (new CLIError(errorStr));
        }
        throw (new JSONSchemaError('Schema invalid:\n'+ yaml.stringify(errors)));
    }
    options.schema = schema;
    return !(errors && errors.length);
}
github ananas-analytics / ananas-desktop / ui / src / common / model / Project.js View on Github external
.then(() => {
        return util.promisify(fs.writeFile)(path.join(this.path, 'triggers.yml'), YAML.stringify(triggers), 'utf8')
      })
  }