Lokalized JavaScript — Version 1.0.0
    Preparing search index...

    Function parseLanguageRanges

    • Parse an Accept-Language field value or language range into a frozen array of weighted ranges, expanded using the pinned IANA equivalence data.

      Ranges are lowercase and sorted by descending weight, preserving input order for equal weights. The first occurrence of a range or its equivalent wins. For example, iw;q=0.9,he;q=0.4 produces iw and he, both at weight 0.9. ASCII spaces are removed throughout the input; tabs are not removed. Malformed ranges or invalid weights throw RangeError.

      Parameters

      • header: string

        an Accept-Language field value, or a single language range

      Returns readonly Readonly<{ range: string; weight: number }>[]

      parsed ranges, in descending weight order

      if a range or weight is invalid