resolve-accept-language 1.1.41 → 1.1.43
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/lib/lookup-list.js +4 -2
- package/package.json +27 -26
package/lib/lookup-list.js
CHANGED
|
@@ -28,8 +28,9 @@ var LookupList = /** @class */ (function () {
|
|
|
28
28
|
for (var _i = 0, directiveStrings_1 = directiveStrings; _i < directiveStrings_1.length; _i++) {
|
|
29
29
|
var directiveString = directiveStrings_1[_i];
|
|
30
30
|
var directive = this.getDirective(directiveString);
|
|
31
|
-
if (directive === undefined)
|
|
31
|
+
if (directive === undefined) {
|
|
32
32
|
continue; // No match for this directive.
|
|
33
|
+
}
|
|
33
34
|
var locale = directive.locale, languageCode = directive.languageCode, quality = directive.quality;
|
|
34
35
|
// If the language is not supported, skip to the next match.
|
|
35
36
|
if (!this.localeList.languages.has(languageCode)) {
|
|
@@ -138,8 +139,9 @@ var LookupList = /** @class */ (function () {
|
|
|
138
139
|
* - A quality value equivalent to "0", as per RFC 2616 (section 3.9), should be considered as "not acceptable".
|
|
139
140
|
*/
|
|
140
141
|
var directiveMatch = directiveString.match(/^((?<matchedLanguageCode>([a-z]{2}))(-(?<matchedCountryCode>[a-z]{2}))?)(;q=(?<matchedQuality>(1(\.0{0,3})?)|(0(\.\d{0,3})?)))?$/i);
|
|
141
|
-
if (!(directiveMatch === null || directiveMatch === void 0 ? void 0 : directiveMatch.groups))
|
|
142
|
+
if (!(directiveMatch === null || directiveMatch === void 0 ? void 0 : directiveMatch.groups)) {
|
|
142
143
|
return undefined; // No regular expression match.
|
|
144
|
+
}
|
|
143
145
|
var _a = directiveMatch.groups, matchedLanguageCode = _a.matchedLanguageCode, matchedCountryCode = _a.matchedCountryCode, matchedQuality = _a.matchedQuality;
|
|
144
146
|
var languageCode = matchedLanguageCode.toLowerCase();
|
|
145
147
|
var countryCode = matchedCountryCode ? matchedCountryCode.toUpperCase() : undefined;
|
package/package.json
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resolve-accept-language",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.43",
|
|
4
4
|
"description": "Resolve the preferred locale based on the value of an `Accept-Language` HTTP header.",
|
|
5
|
-
"author": "Avansai (https://avansai.com)",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/Avansai/resolve-accept-language.git"
|
|
9
|
-
},
|
|
10
|
-
"main": "lib/resolve-accept-language.js",
|
|
11
|
-
"types": "lib/resolve-accept-language.d.ts",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "npm run prettier && npm run lint-fix && rm -Rf ./lib && tsc && npm run test",
|
|
14
|
-
"lint-fix": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --fix .",
|
|
15
|
-
"lint-check": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx .",
|
|
16
|
-
"lint-print-config": "eslint --print-config ./eslintrc.yaml",
|
|
17
|
-
"prettier": "prettier --write .",
|
|
18
|
-
"test": "jest --coverage",
|
|
19
|
-
"release": "dotenv -- release-it --only-version"
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"files": [
|
|
23
|
-
"lib"
|
|
24
|
-
],
|
|
25
5
|
"keywords": [
|
|
26
6
|
"accept-language",
|
|
27
7
|
"RFC 4647",
|
|
@@ -36,24 +16,45 @@
|
|
|
36
16
|
"i18n",
|
|
37
17
|
"internationalization"
|
|
38
18
|
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Avansai/resolve-accept-language.git"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "Avansai (https://avansai.com)",
|
|
25
|
+
"main": "lib/resolve-accept-language.js",
|
|
26
|
+
"types": "lib/resolve-accept-language.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"lib"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "npm run prettier && npm run lint-fix && rm -Rf ./lib && tsc && npm run test",
|
|
32
|
+
"lint-check": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json .",
|
|
33
|
+
"lint-fix": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json --fix .",
|
|
34
|
+
"lint-print-config": "eslint --print-config ./eslintrc.yaml",
|
|
35
|
+
"prettier": "prettier --write .",
|
|
36
|
+
"release": "dotenv -- release-it --only-version",
|
|
37
|
+
"test": "jest --coverage"
|
|
38
|
+
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@release-it/conventional-changelog": "^5.1.1",
|
|
41
41
|
"@types/jest": "^29.4.0",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
43
|
-
"@typescript-eslint/parser": "^5.
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
|
43
|
+
"@typescript-eslint/parser": "^5.52.0",
|
|
44
44
|
"dotenv-cli": "^7.0.0",
|
|
45
|
-
"eslint": "^8.
|
|
45
|
+
"eslint": "^8.34.0",
|
|
46
46
|
"eslint-config-prettier": "^8.6.0",
|
|
47
47
|
"eslint-import-resolver-node": "^0.3.7",
|
|
48
48
|
"eslint-import-resolver-typescript": "^3.5.3",
|
|
49
49
|
"eslint-plugin-import": "^2.27.5",
|
|
50
50
|
"eslint-plugin-jest": "^27.2.1",
|
|
51
|
+
"eslint-plugin-json-files": "^2.1.0",
|
|
51
52
|
"eslint-plugin-prefer-arrow-functions": "^3.1.4",
|
|
52
53
|
"eslint-plugin-prettier": "^4.2.1",
|
|
53
54
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
54
55
|
"eslint-plugin-unicorn": "^45.0.2",
|
|
55
|
-
"jest": "^29.4.
|
|
56
|
-
"prettier": "^2.8.
|
|
56
|
+
"jest": "^29.4.3",
|
|
57
|
+
"prettier": "^2.8.4",
|
|
57
58
|
"prettier-plugin-organize-imports": "^3.2.2",
|
|
58
59
|
"prettier-plugin-sh": "^0.12.8",
|
|
59
60
|
"release-it": "^15.6.0",
|