code: function parse (string) {
    if (!string) {
      throw new TypeError('argument string is required')
    }
  
    // support req/res-like objects as argument
    var header = typeof string === 'object'
      ? getcontenttype(string)
      : string
  
    if (typeof header !== 'string') {
      throw new TypeError('argument string is required to be a string')
    }
  
    var index = header.indexOf(';')
    var type = index !== -1
      ? header.substr(0, index).trim()
      : header.trim()
  
    if (!TYPE_REGEXP.test(type)) {
      throw new TypeError('invalid media type')
    }
  
    var obj = new ContentType(type.toLowerCase())
  
    // parse parameters
    if (index !== -1) {
      var key
      var match
      var value
  
      PARAM_REGEXP.lastIndex = index
  
      while ((match = PARAM_REGEXP.exec(header))) {
        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(QESC_REGEXP, '$1')
        }
  
        obj.parameters[key] = value
      }
  
      if (index !== header.length) {
        throw new TypeError('invalid parameter format')
      }
    }
  
    return obj
  }
docs: Parse media type to object.
  
  @param {string|object} string
  @return {Object}
  @public