How to use the stringify function from yamljs

Find comprehensive JavaScript yamljs.stringify code examples handpicked from public code repositorys.

90
91
92
93
94
95
96
97
98
99
  var xml = builder.buildObject(JSON.parse(data));
  done(null, xml);
};

var convertJsonToYml = function(data, options, done) {
  var results = YAML.stringify(JSON.parse(data), options.inline, options.indent);
  done(null, results);
};

var convertJsonToPlist = function(data, options, done) {
fork icon9
star icon0
watch icon2

3
4
5
6
7
8
9
module.exports = async function parseApibFile(fileName, outputFormat, sourceMapsEnabled, debugMode, languageServerMode, contextOptions = {}) {
  const result = (await Crafter.parseFile(fileName, { sourceMapsEnabled, debugMode, languageServerMode, ...contextOptions }))[0];
  if (outputFormat === 'json') {
    return JSON.stringify(result.toRefract(sourceMapsEnabled), null, 2);
  }
  return yaml.stringify(result.toRefract(sourceMapsEnabled), Infinity, 2);
};
fork icon0
star icon9
watch icon11

352
353
354
355
356
357
358
359
360
361
}

logger.trace("json is " + JSON.stringify(json));

// now convert the json back to yaml
// return yamljs.stringify(json, 4, 2, {});
return jsyaml.safeDump(json, {
    schema: jsyaml.FAILSAFE_SCHEMA,
    noCompatMode: true,
    sortKeys: true,
fork icon0
star icon0
watch icon3

+ 4 other calls in file