resolve-accept-language 1.0.36 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,7 +43,7 @@ library will try to address by focusing on locales identifier using the `languag
43
43
  full BCP 47 language tags support. The main reasons for this:
44
44
 
45
45
  - Using 2 letter language codes is rarely sufficient. Without being explicit about the targeted country for a given language, it is impossible to provide the right format for some content such as dates and numbers. Also, while languages are similar across countries, there are different ways to say the same thing. Our hypothesis is that by better targeting the audience, the user experience will improve.
46
- - About 99% of all cases can be covered using the `language`-`country` format. We could possibly extend script support in the future but one the approach being this library is to keep it as simple as possible, while providing the best match.
46
+ - About 99% of all cases can be covered using the `language`-`country` format. We could possibly extend script support in the future given a valid use case, but in the meantime our goal is to keep this library as simple as possible, while providing the best matches.
47
47
 
48
48
  ## How does the resolver work?
49
49
 
package/lib/locale.js CHANGED
@@ -10,12 +10,12 @@ var Locale = /** @class */ (function () {
10
10
  */
11
11
  function Locale(identifier) {
12
12
  if (!Locale.isLocale(identifier, false)) {
13
- throw new Error("invalid locale identifier '" + identifier + "'");
13
+ throw new Error("invalid locale identifier '".concat(identifier, "'"));
14
14
  }
15
15
  var _a = identifier.split('-'), languageCode = _a[0], countryCode = _a[1];
16
16
  this.languageCode = languageCode.toLowerCase();
17
17
  this.countryCode = countryCode.toUpperCase();
18
- this.identifier = this.languageCode + "-" + this.countryCode;
18
+ this.identifier = "".concat(this.languageCode, "-").concat(this.countryCode);
19
19
  }
20
20
  /**
21
21
  * Is a given string a locale identifier using the `language`-`country` format.
@@ -18,7 +18,7 @@ var LookupList = /** @class */ (function () {
18
18
  */
19
19
  LookupList.prototype.addLocale = function (quality, identifier) {
20
20
  if (!locale_1.default.isLocale(identifier)) {
21
- throw new Error("invalid locale identifier '" + identifier + "'");
21
+ throw new Error("invalid locale identifier '".concat(identifier, "'"));
22
22
  }
23
23
  if (!this.localesAndLanguagesByQuality[quality]) {
24
24
  this.localesAndLanguagesByQuality[quality] = new Set();
@@ -33,7 +33,7 @@ var LookupList = /** @class */ (function () {
33
33
  */
34
34
  LookupList.prototype.addLanguage = function (quality, languageCode) {
35
35
  if (!locale_1.default.isLanguageCode(languageCode)) {
36
- throw new Error("invalid ISO 639-1 alpha-2 language code '" + languageCode + "'");
36
+ throw new Error("invalid ISO 639-1 alpha-2 language code '".concat(languageCode, "'"));
37
37
  }
38
38
  if (!this.localesAndLanguagesByQuality[quality]) {
39
39
  this.localesAndLanguagesByQuality[quality] = new Set();
@@ -48,7 +48,7 @@ var LookupList = /** @class */ (function () {
48
48
  */
49
49
  LookupList.prototype.addUnsupportedLocaleLanguage = function (quality, languageCode) {
50
50
  if (!locale_1.default.isLanguageCode(languageCode)) {
51
- throw new Error("invalid ISO 639-1 alpha-2 language code '" + languageCode + "'");
51
+ throw new Error("invalid ISO 639-1 alpha-2 language code '".concat(languageCode, "'"));
52
52
  }
53
53
  if (!this.unsupportedLocaleLanguagesByQuality[quality]) {
54
54
  this.unsupportedLocaleLanguagesByQuality[quality] = new Set();
@@ -83,6 +83,6 @@ function getDirectiveDetails(directiveMatch) {
83
83
  var languageCode = matchedLanguageCode.toLowerCase();
84
84
  var countryCode = matchedCountryCode ? matchedCountryCode.toUpperCase() : undefined;
85
85
  var quality = matchedQuality === undefined ? '1' : parseFloat(matchedQuality).toString(); // Remove trailing zeros.
86
- var locale = countryCode ? languageCode + "-" + countryCode : undefined;
86
+ var locale = countryCode ? "".concat(languageCode, "-").concat(countryCode) : undefined;
87
87
  return { locale: locale, languageCode: languageCode, quality: quality };
88
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolve-accept-language",
3
- "version": "1.0.36",
3
+ "version": "1.0.40",
4
4
  "description": "Resolve the preferred locale based on the value of an `Accept-Language` HTTP header.",
5
5
  "author": "Avansai (https://avansai.com)",
6
6
  "repository": {
@@ -37,18 +37,18 @@
37
37
  ],
38
38
  "devDependencies": {
39
39
  "@release-it/conventional-changelog": "^3.3.0",
40
- "@types/jest": "^27.0.2",
41
- "@typescript-eslint/eslint-plugin": "^5.0.0",
42
- "@typescript-eslint/parser": "^5.0.0",
43
- "dotenv-cli": "^4.0.0",
44
- "eslint": "^8.0.1",
40
+ "@types/jest": "^27.0.3",
41
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
42
+ "@typescript-eslint/parser": "^5.4.0",
43
+ "dotenv-cli": "^4.1.0",
44
+ "eslint": "^8.3.0",
45
45
  "eslint-config-prettier": "^8.3.0",
46
- "eslint-plugin-jest": "^25.2.2",
47
- "jest": "^27.3.0",
48
- "prettier": "2.4.1",
49
- "release-it": "^14.11.6",
46
+ "eslint-plugin-jest": "^25.3.0",
47
+ "jest": "^27.3.1",
48
+ "prettier": "2.5.0",
49
+ "release-it": "^14.11.8",
50
50
  "ts-jest": "^27.0.7",
51
- "ts-node": "^10.3.0",
52
- "typescript": "^4.4.4"
51
+ "ts-node": "^10.4.0",
52
+ "typescript": "^4.5.2"
53
53
  }
54
54
  }