code: function parse(string) {
    if (!string) {
      throw new TypeError('argument string is required')
    }
  
    if (typeof string === 'object') {
      // support req/res-like objects as argument
      string = getcontenttype(string)
  
      if (typeof string !== 'string') {
        throw new TypeError('content-type header is missing from object');
      }
    }
  
    if (typeof string !== 'string') {
      throw new TypeError('argument string is required to be a string')
    }
  
    var index = string.indexOf(';')
    var type = index !== -1
      ? string.substr(0, index).trim()
      : string.trim()
  
    if (!typeRegExp.test(type)) {
      throw new TypeError('invalid media type')
    }
  
    var key
    var match
    var obj = new ContentType(type.toLowerCase())
    var value
  
    paramRegExp.lastIndex = index
  
    while (match = paramRegExp.exec(string)) {
      if (match.index !== index) {
        throw new TypeError('invalid parameter format')
      }
  
      index += match[0].length
      key = match[1].toLowerCase()
      value = match[2]
  
      if (value[0] === '"') {
        // remove quotes and escapes
        value = value
          .substr(1, value.length - 2)
          .replace(qescRegExp, '$1')
      }
  
      obj.parameters[key] = value
    }
  
    if (index !== -1 && index !== string.length) {
      throw new TypeError('invalid parameter format')
    }
  
    return obj
  }
docs: Parse media type to object.
  
  @param {string|object} string
  @return {Object}
  @public