function parseLanguage(str, i) {
  const match = simpleLanguageRegExp.exec(str);
  if (!match) return null;
  const prefix = match[1];
  const suffix = match[2];
  let full = prefix;
  if (suffix) full += "-" + suffix;
  let q = 1;
  if (match[3]) {
    const params = match[3].split(";");
    for (let j = 0; j < params.length; j++) {
      const p = params[j].split("=");
      if (p[0] === "q") q = parseFloat(p[1]);
    }
  }
  return {
    prefix,
    suffix,
    q,
    i,
    full,
  };
}
/**
 * Parse a language from the Accept-Language header.
 */
Parse a language from the Accept-Language header.
Parse a language from the Accept - Language header .
function parseLanguage(str, i) {
  const match = simpleLanguageRegExp.exec(str);
  if (!match) return null;
  const prefix = match[1];
  const suffix = match[2];
  let full = prefix;
  if (suffix) full += "-" + suffix;
  let q = 1;
  if (match[3]) {
    const params = match[3].split(";");
    for (let j = 0; j < params.length; j++) {
      const p = params[j].split("=");
      if (p[0] === "q") q = parseFloat(p[1]);
    }
  }
  return {
    prefix,
    suffix,
    q,
    i,
    full,
  };
}
function parseLanguage ( str , i ) { const match = simpleLanguageRegExp . exec ( str ) ; if ( ! match ) return null ; const prefix = match [ 1 ] ; const suffix = match [ 2 ] ; let full = prefix ; if ( suffix ) full += "-" + suffix ; let q = 1 ; if ( match [ 3 ] ) { const params = match [ 3 ] . split ( ";" ) ; for ( let j = 0 ; j < params . length ; j ++ ) { const p = params [ j ] . split ( "=" ) ; if ( p [ 0 ] === "q" ) q = parseFloat ( p [ 1 ] ) ; } } return { prefix , suffix , q , i , full , } ; }
Parse a language from the Accept-Language header.
Parse a language from the Accept - Language header .