function format({ type, parameters }) {
  if (!type || typeof type !== "string" || !TOKEN_REGEXP.test(type)) {
    throw new TypeError("invalid type");
  }
  // start with normalized type
  let string = String(type).toLowerCase();
  // append parameters
  if (parameters && typeof parameters === "object") {
    let param;
    const params = Object.keys(parameters).sort();
    for (let i = 0; i < params.length; i++) {
      param = params[i];
      const val = param.substr(-1) === "*"
        ? uString(parameters[param])
        : qString(parameters[param]);
      string += "; " + param + "=" + val;
    }
  }
  return string;
}
/**
 * Format object to Content-Disposition header.
 *
 * @param {object} obj
 * @param {string} obj.type
 * @param {object} [obj.parameters]
 * @return {string}
 * @private
 */
Format object to Content-Disposition header.
Format object to Content - Disposition header .
function format({ type, parameters }) {
  if (!type || typeof type !== "string" || !TOKEN_REGEXP.test(type)) {
    throw new TypeError("invalid type");
  }
  let string = String(type).toLowerCase();
  if (parameters && typeof parameters === "object") {
    let param;
    const params = Object.keys(parameters).sort();
    for (let i = 0; i < params.length; i++) {
      param = params[i];
      const val = param.substr(-1) === "*"
        ? uString(parameters[param])
        : qString(parameters[param]);
      string += "; " + param + "=" + val;
    }
  }
  return string;
}
function format ( { type , parameters } ) { if ( ! type || typeof type !== "string" || ! TOKEN_REGEXP . test ( type ) ) { throw new TypeError ( "invalid type" ) ; } let string = String ( type ) . toLowerCase ( ) ; if ( parameters && typeof parameters === "object" ) { let param ; const params = Object . keys ( parameters ) . sort ( ) ; for ( let i = 0 ; i < params . length ; i ++ ) { param = params [ i ] ; const val = param . substr ( - 1 ) === "*" ? uString ( parameters [ param ] ) : qString ( parameters [ param ] ) ; string += "; " + param + "=" + val ; } } return string ; }
Format object to Content-Disposition header.
Format object to Content - Disposition header .
// start with normalized type // append parameters