Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LanguageHeader

A parsed language header. Delivers a more direct access to the individual elements of the header it represents

Hierarchy

  • LanguageHeader

Implements

Index

Properties

Static Readonly DEFAULT_WEIGHT

DEFAULT_WEIGHT: number

If no "q" parameter is present, the default weight is 1.

Methods

isMatchedBy

  • Test if this header is matched by matchTry header

    Parameters

    Returns boolean

isPermitted

  • isPermitted(): boolean
  • Is this an allowed operation as specified by the corresponding header?

    Returns boolean

parameter

  • parameter(key: string): string | null
  • The value of the parameter specified by this key. Each is one of 3 things:

    1. null <- That key was not specified
    2. ParsedHeaderValue.EMPTY (tested using ==) <- The value was not specified
    3. [Other] <- The value of the parameter
    Note: The q parameter is never present.

    Parameters

    • key: string

    Returns string | null

parameters

  • parameters(): {}
  • The parameters specified in this header value. Note: The q parameter is never present.

    Returns {}

    • [key: string]: string

rawValue

  • rawValue(): string
  • Contains the raw value that was received from the user agent

    Returns string

subtag

  • subtag(): string | null
  • subtag(level: number): string | null
  • The subtag of the language as specified by rfc7231#section-3.1.3.1.
    Equivalent to

    Returns string | null

  • A subtag of this language header.

    Parameters

    • level: number

    Returns string | null

subtagCount

  • subtagCount(): number
  • Returns number

tag

  • tag(): string
  • The tag of the language as specified by rfc7231#section-3.1.3.1.
    Equivalent to

    Returns string

value

  • value(): string
  • Holds the unparsed value of the header.
    For the most part, this is the content before the semi-colon (";")

    Returns string

weight

  • weight(): number
  • Holds the weight specified in the "q" parameter of the header.
    If the parameter is not specified, 1.0 is assumed according to rfc7231

    Returns number

weightedOrder

  • weightedOrder(): number
  • An integer that represents the absolute order position of this header

    Returns number

Generated using TypeDoc