code: function stringJSON2YAML (doc, compact = false) {
    if (!doc || (typeof doc !== 'string' && typeof doc !== 'object')) {
      throw new TypeError('Argument must be a string or object, and not empty: ' + doc)
    }
  
    let obj = doc
    if (typeof doc === 'string') {
      obj = JSON.parse(doc)
    }
  
    return yaml.safeDump(obj, compact ? { 'flowLevel': 0 } : undefined)
  }
docs: Transcode JSON to YAML string.
  
  @param {string|Object} doc
  @param {boolean} [compact]
  @return {string}
  @api public