How to use the js-yaml/dist/js-yaml.safeDump function in js-yaml

To help you get started, we’ve selected a few js-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 cruise-automation / webviz / packages / webviz-core / src / util / yaml.js View on Github external
stringify(obj: any, options: any = {}): string {
    // do not quote 'y' and 'yes' for older yaml versions
    return yaml
      .safeDump(obj, { noCompatMode: true, ...options })
      .replace(/^- - /gm, "\n- - ")
      .trim();
  },
};
github mozilla / treeherder / ui / job-view / CustomJobActions.jsx View on Github external
updateSelectedAction = action => {
    const { ajv } = this.state;

    if (action.schema) {
      this.setState({
        schema: jsyaml.safeDump(action.schema),
        payload: jsyaml.safeDump(jsonSchemaDefaults(action.schema)),
        validate: ajv.compile(action.schema),
      });
    } else {
      this.setState({ schema: null, payload: null, validate: null });
    }
  };
github mozilla / treeherder / ui / job-view / CustomJobActions.jsx View on Github external
updateSelectedAction = action => {
    const { ajv } = this.state;

    if (action.schema) {
      this.setState({
        schema: jsyaml.safeDump(action.schema),
        payload: jsyaml.safeDump(jsonSchemaDefaults(action.schema)),
        validate: ajv.compile(action.schema),
      });
    } else {
      this.setState({ schema: null, payload: null, validate: null });
    }
  };