• Tries to match the given type to the given preferences. In case there are multiple matches the most specific one will be chosen as per RFC 7231.

    Parameters

    • type: string

      Type for which the matching weight is needed.

    • preferred: ValuePreferences

      Preferences to match the type to.

    Returns number

    The corresponding weight from the preferences or 0 if there is no match.