resolve-accept-language
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -41,5 +41,3 @@ "use strict"; | ||
var localeLanguagesByQuality = new language_quality_list_1.default(); | ||
var directives = acceptLanguageHeader | ||
.split(',') | ||
.map(function (directive) { return directive.trim(); }); | ||
var directives = acceptLanguageHeader.split(',').map(function (directive) { return directive.trim(); }); | ||
for (var _i = 0, directives_1 = directives; _i < directives_1.length; _i++) { | ||
@@ -62,4 +60,3 @@ var directive = directives_1[_i]; | ||
// If the locale is not supported, but the locale's language is, add to locale language preference. | ||
if (!localeList.locales.includes(locale) && | ||
localeList.languages.includes(languageCode)) { | ||
if (!localeList.locales.includes(locale) && localeList.languages.includes(languageCode)) { | ||
localeLanguagesByQuality.add(quality, languageCode); | ||
@@ -66,0 +63,0 @@ continue; |
{ | ||
"name": "resolve-accept-language", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"description": "Resolve the preferred locale based on the value of an `Accept-Language` HTTP header.", | ||
@@ -5,0 +5,0 @@ "main": "lib/resolve-accept-language.js", |
@@ -35,3 +35,3 @@ # resolve-accept-language | ||
One of the main challenge is that BCP47 language tags can be either overly simple or too complex. This is one of the problem this | ||
One of the main challenge is that BCP 47 language tags can be either overly simple or too complex. This is one of the problem this | ||
library will try to address by focusing on locales identifier using the `language`-`country` format instead of trying to provide | ||
@@ -52,4 +52,4 @@ full BCP 47 language tags support. The main reasons for this: | ||
1. Try exact BCP 47 locale code match. | ||
2. Try the language code match from the HTTP header, related to the BCP47 locale codes specified. | ||
2. Try the language code match from the HTTP header, related to the BCP 47 locale codes specified. | ||
3. As a last resort, extract the languages from the specified locales and check if there is a match with the header's locales. | ||
4. Uses the specified default locale. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22754
423