lib/transcode.js
function stringYAML2YAML (doc, compact = false) {
  if (!doc || typeof doc !== 'string') {
    throw new TypeError('Argument must be a string or object, and not empty: ' + doc)
  }

  let obj = yaml.safeLoad(doc)

  if (!obj || typeof obj !== 'object') {
    throw new TypeError('Argument must be in yaml format: ' + doc)
  }

  return yaml.safeDump(obj, compact ? { 'flowLevel': 0 } : undefined)
}
function stringYAML2YAML (doc, compact = false) {
  if (!doc || typeof doc !== 'string') {
    throw new TypeError('Argument must be a string or object, and not empty: ' + doc)
  }

  let obj = yaml.safeLoad(doc)

  if (!obj || typeof obj !== 'object') {
    throw new TypeError('Argument must be in yaml format: ' + doc)
  }

  return yaml.safeDump(obj, compact ? { 'flowLevel': 0 } : undefined)
}
function stringYAML2YAML ( doc , compact = false ) { if ( ! doc || typeof doc !== 'string' ) { throw new TypeError ( 'Argument must be a string or object, and not empty: ' + doc ) } let obj = yaml . safeLoad ( doc ) if ( ! obj || typeof obj !== 'object' ) { throw new TypeError ( 'Argument must be in yaml format: ' + doc ) } return yaml . safeDump ( obj , compact ? { 'flowLevel' : 0 } : undefined ) }
Transcode YAML to YAML string.

@param {string} doc
@param {boolean} [compact]
@return {string}
@api public
Transcode YAML to YAML string .