resolve-accept-language 1.1.44 → 1.1.45-0
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/locale-list.js +14 -13
- package/lib/locale.js +15 -19
- package/lib/lookup-list.js +39 -38
- package/lib/resolve-accept-language.js +28 -35
- package/package.json +4 -2
package/lib/locale-list.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
const locale_1 = __importDefault(require("./locale"));
|
|
7
|
+
class LocaleList {
|
|
5
8
|
/**
|
|
6
9
|
* Create a list of locale identifiers.
|
|
7
10
|
*
|
|
@@ -9,8 +12,7 @@ var LocaleList = /** @class */ (function () {
|
|
|
9
12
|
*
|
|
10
13
|
* @throws Will throw an error if one of the locale's format is invalid.
|
|
11
14
|
*/
|
|
12
|
-
|
|
13
|
-
var _this = this;
|
|
15
|
+
constructor(locales) {
|
|
14
16
|
/** A set of ISO 3166-1 alpha-2 country codes. */
|
|
15
17
|
this.countries = new Set();
|
|
16
18
|
/** A set of ISO 639-1 alpha-2 language codes. */
|
|
@@ -19,16 +21,15 @@ var LocaleList = /** @class */ (function () {
|
|
|
19
21
|
this.locales = new Set();
|
|
20
22
|
/** A list of locale objects. */
|
|
21
23
|
this.objects = [];
|
|
22
|
-
locales.forEach(
|
|
23
|
-
|
|
24
|
-
if (!
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
locales.forEach((locale) => {
|
|
25
|
+
const localeObject = new locale_1.default(locale);
|
|
26
|
+
if (!this.locales.has(localeObject.identifier)) {
|
|
27
|
+
this.objects.push(localeObject);
|
|
28
|
+
this.locales.add(localeObject.identifier);
|
|
29
|
+
this.languages.add(localeObject.languageCode);
|
|
30
|
+
this.countries.add(localeObject.countryCode);
|
|
29
31
|
}
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
}());
|
|
34
|
+
}
|
|
34
35
|
exports.default = LocaleList;
|
package/lib/locale.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/** Class to manage a locale identifier using the BCP 47 `language`-`country` format. */
|
|
4
|
-
|
|
4
|
+
class Locale {
|
|
5
5
|
/**
|
|
6
6
|
* Create a new `Locale` object.
|
|
7
7
|
*
|
|
@@ -9,14 +9,14 @@ var Locale = /** @class */ (function () {
|
|
|
9
9
|
*
|
|
10
10
|
* @throws An error if the `identifier` format is invalid.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
constructor(identifier) {
|
|
13
13
|
if (!Locale.isLocale(identifier, false)) {
|
|
14
|
-
throw new Error(
|
|
14
|
+
throw new Error(`invalid locale identifier '${identifier}'`);
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const [languageCode, countryCode] = identifier.split('-');
|
|
17
17
|
this.languageCode = languageCode.toLowerCase();
|
|
18
18
|
this.countryCode = countryCode.toUpperCase();
|
|
19
|
-
this.identifier =
|
|
19
|
+
this.identifier = `${this.languageCode}-${this.countryCode}`;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Is a given string an ISO 3166-1 alpha-2 country code.
|
|
@@ -24,33 +24,29 @@ var Locale = /** @class */ (function () {
|
|
|
24
24
|
* @param countryCode - An ISO 3166-1 alpha-2 country code.
|
|
25
25
|
* @param caseNormalized - Should we verify if the identifier is using the case-normalized format?
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var regExp = new RegExp(/^[A-Z]{2}$/, caseNormalized ? undefined : 'i');
|
|
27
|
+
static isCountryCode(countryCode, caseNormalized = true) {
|
|
28
|
+
const regExp = new RegExp(/^[A-Z]{2}$/, caseNormalized ? undefined : 'i');
|
|
30
29
|
return regExp.test(countryCode);
|
|
31
|
-
}
|
|
30
|
+
}
|
|
32
31
|
/**
|
|
33
32
|
* Is a given string an ISO 639-1 alpha-2 language code.
|
|
34
33
|
*
|
|
35
34
|
* @param languageCode - An ISO 639-1 alpha-2 language code.
|
|
36
35
|
* @param caseNormalized - Should we verify if the identifier is using the case-normalized format?
|
|
37
36
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var regExp = new RegExp(/^[a-z]{2}$/, caseNormalized ? undefined : 'i');
|
|
37
|
+
static isLanguageCode(languageCode, caseNormalized = true) {
|
|
38
|
+
const regExp = new RegExp(/^[a-z]{2}$/, caseNormalized ? undefined : 'i');
|
|
41
39
|
return regExp.test(languageCode);
|
|
42
|
-
}
|
|
40
|
+
}
|
|
43
41
|
/**
|
|
44
42
|
* Is a given string a locale identifier following the BCP 47 `language`-`country` format.
|
|
45
43
|
*
|
|
46
44
|
* @param identifier - A potential locale identify to verify.
|
|
47
45
|
* @param caseNormalized - Should we verify if the identifier is using the case-normalized format?
|
|
48
46
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var regExp = new RegExp(/^[a-z]{2}-[A-Z]{2}$/, caseNormalized ? undefined : 'i');
|
|
47
|
+
static isLocale(identifier, caseNormalized = true) {
|
|
48
|
+
const regExp = new RegExp(/^[a-z]{2}-[A-Z]{2}$/, caseNormalized ? undefined : 'i');
|
|
52
49
|
return regExp.test(identifier);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
56
52
|
exports.default = Locale;
|
package/lib/lookup-list.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
6
|
+
const locale_list_1 = __importDefault(require("./locale-list"));
|
|
4
7
|
/** Lookup list used to match the preferred locale based on the value of an `Accept-Language` HTTP header. */
|
|
5
|
-
|
|
8
|
+
class LookupList {
|
|
6
9
|
/**
|
|
7
10
|
* Create a new `LookupList` object.
|
|
8
11
|
*
|
|
@@ -10,7 +13,7 @@ var LookupList = /** @class */ (function () {
|
|
|
10
13
|
* @param locales - An array of locale identifiers. The order will be used for matching where the first identifier will be more
|
|
11
14
|
* likely to be matched than the last identifier.
|
|
12
15
|
*/
|
|
13
|
-
|
|
16
|
+
constructor(acceptLanguageHeader, locales) {
|
|
14
17
|
/**
|
|
15
18
|
* Data object where the properties are quality (in string format) and their values a set containing locale
|
|
16
19
|
* identifiers using the `language`-`country` format and ISO 639-1 alpha-2 language code.
|
|
@@ -22,16 +25,15 @@ var LookupList = /** @class */ (function () {
|
|
|
22
25
|
*/
|
|
23
26
|
this.relatedLocaleLanguagesByQuality = {};
|
|
24
27
|
this.localeList = new locale_list_1.default(locales);
|
|
25
|
-
|
|
28
|
+
const directiveStrings = acceptLanguageHeader
|
|
26
29
|
.split(',')
|
|
27
|
-
.map(
|
|
28
|
-
for (
|
|
29
|
-
|
|
30
|
-
var directive = this.getDirective(directiveString);
|
|
30
|
+
.map((directiveString) => directiveString.trim());
|
|
31
|
+
for (const directiveString of directiveStrings) {
|
|
32
|
+
const directive = this.getDirective(directiveString);
|
|
31
33
|
if (directive === undefined) {
|
|
32
34
|
continue; // No match for this directive.
|
|
33
35
|
}
|
|
34
|
-
|
|
36
|
+
const { locale, languageCode, quality } = directive;
|
|
35
37
|
// If the language is not supported, skip to the next match.
|
|
36
38
|
if (!this.localeList.languages.has(languageCode)) {
|
|
37
39
|
continue;
|
|
@@ -57,71 +59,71 @@ var LookupList = /** @class */ (function () {
|
|
|
57
59
|
*
|
|
58
60
|
* @returns The top locale with the specified language.
|
|
59
61
|
*/
|
|
60
|
-
|
|
62
|
+
getTopByLanguage(languageCode) {
|
|
61
63
|
var _a;
|
|
62
|
-
return (_a = this.localeList.objects.find(
|
|
63
|
-
}
|
|
64
|
+
return (_a = this.localeList.objects.find((locale) => locale.languageCode === languageCode)) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
65
|
+
}
|
|
64
66
|
/**
|
|
65
67
|
* Get the top (highest-ranked) locale or language.
|
|
66
68
|
*
|
|
67
69
|
* @returns The top match, which can either be a locale or a language.
|
|
68
70
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
getTopLocaleOrLanguage() {
|
|
72
|
+
const localesAndLanguagesByQuality = Object.entries(this.localesAndLanguagesByQuality);
|
|
71
73
|
if (localesAndLanguagesByQuality.length === 0) {
|
|
72
74
|
return undefined;
|
|
73
75
|
}
|
|
74
76
|
return this.getTop(localesAndLanguagesByQuality);
|
|
75
|
-
}
|
|
77
|
+
}
|
|
76
78
|
/**
|
|
77
79
|
* Get the top (highest-ranked) related locale.
|
|
78
80
|
*
|
|
79
81
|
* @returns The top related locale.
|
|
80
82
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
getTopRelatedLocale() {
|
|
84
|
+
const relatedLocaleLanguagesByQuality = Object.entries(this.relatedLocaleLanguagesByQuality);
|
|
83
85
|
if (relatedLocaleLanguagesByQuality.length === 0) {
|
|
84
86
|
return undefined;
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
const topRelatedLocaleLanguage = this.getTop(relatedLocaleLanguagesByQuality);
|
|
87
89
|
return this.getTopByLanguage(topRelatedLocaleLanguage);
|
|
88
|
-
}
|
|
90
|
+
}
|
|
89
91
|
/**
|
|
90
92
|
* Add a language in the data object matching its quality.
|
|
91
93
|
*
|
|
92
94
|
* @param quality - The HTTP header's quality factor associated with a language.
|
|
93
95
|
* @param languageCode - An ISO 639-1 alpha-2 language code.
|
|
94
96
|
*/
|
|
95
|
-
|
|
97
|
+
addLanguage(quality, languageCode) {
|
|
96
98
|
if (!this.localesAndLanguagesByQuality[quality]) {
|
|
97
99
|
this.localesAndLanguagesByQuality[quality] = new Set();
|
|
98
100
|
}
|
|
99
101
|
this.localesAndLanguagesByQuality[quality].add(languageCode);
|
|
100
|
-
}
|
|
102
|
+
}
|
|
101
103
|
/**
|
|
102
104
|
* Add a locale in the data object matching its quality.
|
|
103
105
|
*
|
|
104
106
|
* @param quality - The HTTP header's quality factor associated with a locale.
|
|
105
107
|
* @param identifier - A locale identifier using the BCP 47 `language`-`country` case-normalized format.
|
|
106
108
|
*/
|
|
107
|
-
|
|
109
|
+
addLocale(quality, identifier) {
|
|
108
110
|
if (!this.localesAndLanguagesByQuality[quality]) {
|
|
109
111
|
this.localesAndLanguagesByQuality[quality] = new Set();
|
|
110
112
|
}
|
|
111
113
|
this.localesAndLanguagesByQuality[quality].add(identifier);
|
|
112
|
-
}
|
|
114
|
+
}
|
|
113
115
|
/**
|
|
114
116
|
* Add a related locale's language in the data object matching its quality.
|
|
115
117
|
*
|
|
116
118
|
* @param quality - The HTTP header's quality factor associated with a related locale's language.
|
|
117
119
|
* @param languageCode - An ISO 639-1 alpha-2 language code.
|
|
118
120
|
*/
|
|
119
|
-
|
|
121
|
+
addRelatedLocaleLanguage(quality, languageCode) {
|
|
120
122
|
if (!this.relatedLocaleLanguagesByQuality[quality]) {
|
|
121
123
|
this.relatedLocaleLanguagesByQuality[quality] = new Set();
|
|
122
124
|
}
|
|
123
125
|
this.relatedLocaleLanguagesByQuality[quality].add(languageCode);
|
|
124
|
-
}
|
|
126
|
+
}
|
|
125
127
|
/**
|
|
126
128
|
* Get a directive object from a directive string.
|
|
127
129
|
*
|
|
@@ -129,7 +131,7 @@ var LookupList = /** @class */ (function () {
|
|
|
129
131
|
*
|
|
130
132
|
* @returns A `Directive` object or `undefined` if the string's format is invalid.
|
|
131
133
|
*/
|
|
132
|
-
|
|
134
|
+
getDirective(directiveString) {
|
|
133
135
|
/**
|
|
134
136
|
* The regular expression is excluding certain directives due to the inability to configure those options in modern
|
|
135
137
|
* browsers today (also those options seem unpractical):
|
|
@@ -138,17 +140,17 @@ var LookupList = /** @class */ (function () {
|
|
|
138
140
|
* - Language tags that starts with a wildcard (e.g. "*-CA") should match the first supported locale of a country.
|
|
139
141
|
* - A quality value equivalent to "0", as per RFC 2616 (section 3.9), should be considered as "not acceptable".
|
|
140
142
|
*/
|
|
141
|
-
|
|
143
|
+
const directiveMatch = directiveString.match(/^((?<matchedLanguageCode>([a-z]{2}))(-(?<matchedCountryCode>[a-z]{2}))?)(;q=(?<matchedQuality>(1(\.0{0,3})?)|(0(\.\d{0,3})?)))?$/i);
|
|
142
144
|
if (!(directiveMatch === null || directiveMatch === void 0 ? void 0 : directiveMatch.groups)) {
|
|
143
145
|
return undefined; // No regular expression match.
|
|
144
146
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return { languageCode
|
|
151
|
-
}
|
|
147
|
+
const { matchedLanguageCode, matchedCountryCode, matchedQuality } = directiveMatch.groups;
|
|
148
|
+
const languageCode = matchedLanguageCode.toLowerCase();
|
|
149
|
+
const countryCode = matchedCountryCode ? matchedCountryCode.toUpperCase() : undefined;
|
|
150
|
+
const quality = matchedQuality === undefined ? '1' : Number.parseFloat(matchedQuality).toString(); // Remove trailing zeros.
|
|
151
|
+
const locale = countryCode ? `${languageCode}-${countryCode}` : undefined;
|
|
152
|
+
return { languageCode, locale, quality };
|
|
153
|
+
}
|
|
152
154
|
/**
|
|
153
155
|
* Get the top (highest-ranked) entry from a dataset object entries.
|
|
154
156
|
*
|
|
@@ -156,9 +158,8 @@ var LookupList = /** @class */ (function () {
|
|
|
156
158
|
*
|
|
157
159
|
* @returns The top entry from a dataset object entries.
|
|
158
160
|
*/
|
|
159
|
-
|
|
161
|
+
getTop(dataObjectEntries) {
|
|
160
162
|
return dataObjectEntries.sort().reverse()[0][1].values().next().value;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
}());
|
|
163
|
+
}
|
|
164
|
+
}
|
|
164
165
|
exports.default = LookupList;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
11
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
6
|
exports.ResolveAcceptLanguage = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const locale_1 = __importDefault(require("./locale"));
|
|
8
|
+
const lookup_list_1 = __importDefault(require("./lookup-list"));
|
|
15
9
|
/** Resolve the preferred locale from an HTTP `Accept-Language` header. */
|
|
16
|
-
|
|
10
|
+
class ResolveAcceptLanguage {
|
|
17
11
|
/**
|
|
18
12
|
* Create a new `ResolveAcceptLanguage` object.
|
|
19
13
|
*
|
|
@@ -23,9 +17,9 @@ var ResolveAcceptLanguage = /** @class */ (function () {
|
|
|
23
17
|
* @param locales - An array of locale identifiers. The order will be used for matching where the first identifier will be more
|
|
24
18
|
* likely to be matched than the last identifier.
|
|
25
19
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
constructor(acceptLanguageHeader, locales) {
|
|
21
|
+
const lookupList = new lookup_list_1.default(acceptLanguageHeader, locales);
|
|
22
|
+
const topLocaleOrLanguage = lookupList.getTopLocaleOrLanguage();
|
|
29
23
|
if (topLocaleOrLanguage === undefined) {
|
|
30
24
|
this.relatedLocaleBasedMatch = lookupList.getTopRelatedLocale();
|
|
31
25
|
}
|
|
@@ -43,52 +37,51 @@ var ResolveAcceptLanguage = /** @class */ (function () {
|
|
|
43
37
|
*
|
|
44
38
|
* @returns True if the best match language-based, otherwise false.
|
|
45
39
|
*/
|
|
46
|
-
|
|
40
|
+
bestMatchIsLanguageBased() {
|
|
47
41
|
return this.languageBasedMatch !== undefined;
|
|
48
|
-
}
|
|
42
|
+
}
|
|
49
43
|
/**
|
|
50
44
|
* Is the best match locale-based?
|
|
51
45
|
*
|
|
52
46
|
* @returns True if the best match locale-based, otherwise false.
|
|
53
47
|
*/
|
|
54
|
-
|
|
48
|
+
bestMatchIsLocaleBased() {
|
|
55
49
|
return this.localeBasedMatch !== undefined;
|
|
56
|
-
}
|
|
50
|
+
}
|
|
57
51
|
/**
|
|
58
52
|
* Is the best match related-locale-based?
|
|
59
53
|
*
|
|
60
54
|
* @returns True if the best match related-locale-based, otherwise false.
|
|
61
55
|
*/
|
|
62
|
-
|
|
56
|
+
bestMatchIsRelatedLocaleBased() {
|
|
63
57
|
return this.relatedLocaleBasedMatch !== undefined;
|
|
64
|
-
}
|
|
58
|
+
}
|
|
65
59
|
/**
|
|
66
60
|
* Get the locale which was the best match.
|
|
67
61
|
*
|
|
68
62
|
* @returns The locale which was the best match.
|
|
69
63
|
*/
|
|
70
|
-
|
|
64
|
+
getBestMatch() {
|
|
71
65
|
var _a, _b;
|
|
72
66
|
return (_b = (_a = this.localeBasedMatch) !== null && _a !== void 0 ? _a : this.languageBasedMatch) !== null && _b !== void 0 ? _b : this.relatedLocaleBasedMatch;
|
|
73
|
-
}
|
|
67
|
+
}
|
|
74
68
|
/**
|
|
75
69
|
* Was a match found when resolving the preferred locale?
|
|
76
70
|
*
|
|
77
71
|
* @returns True when a match is found, otherwise false.
|
|
78
72
|
*/
|
|
79
|
-
|
|
73
|
+
hasMatch() {
|
|
80
74
|
return this.getBestMatch() === undefined ? false : true;
|
|
81
|
-
}
|
|
75
|
+
}
|
|
82
76
|
/**
|
|
83
77
|
* Did the resolution of the preferred locale find no match?
|
|
84
78
|
*
|
|
85
79
|
* @returns True when there is no match, otherwise false.
|
|
86
80
|
*/
|
|
87
|
-
|
|
81
|
+
hasNoMatch() {
|
|
88
82
|
return !this.hasMatch();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
}());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
92
85
|
exports.ResolveAcceptLanguage = ResolveAcceptLanguage;
|
|
93
86
|
/**
|
|
94
87
|
* Resolve the preferred locale from an HTTP `Accept-Language` header.
|
|
@@ -110,24 +103,24 @@ exports.ResolveAcceptLanguage = ResolveAcceptLanguage;
|
|
|
110
103
|
* 'en-US'
|
|
111
104
|
* )
|
|
112
105
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
locales.forEach(
|
|
106
|
+
const resolveAcceptLanguage = (acceptLanguageHeader, locales, defaultLocale) => {
|
|
107
|
+
let localesIncludeDefault = false;
|
|
108
|
+
locales.forEach((locale) => {
|
|
116
109
|
if (!locale_1.default.isLocale(locale, false)) {
|
|
117
|
-
throw new Error(
|
|
110
|
+
throw new Error(`invalid locale identifier '${locale}'`);
|
|
118
111
|
}
|
|
119
112
|
if (locale.toLowerCase() === defaultLocale.toLocaleLowerCase()) {
|
|
120
113
|
localesIncludeDefault = true;
|
|
121
114
|
}
|
|
122
115
|
});
|
|
123
116
|
if (!locale_1.default.isLocale(defaultLocale, false)) {
|
|
124
|
-
throw new Error(
|
|
117
|
+
throw new Error(`invalid default locale identifier '${defaultLocale}'`);
|
|
125
118
|
}
|
|
126
119
|
if (!localesIncludeDefault) {
|
|
127
120
|
throw new Error('the default locale must be included in the locales');
|
|
128
121
|
}
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
const rankedLocales = [defaultLocale, ...locales.filter((locale) => locale !== defaultLocale)];
|
|
123
|
+
const resolveAcceptLanguage = new ResolveAcceptLanguage(acceptLanguageHeader, rankedLocales);
|
|
131
124
|
if (resolveAcceptLanguage.hasMatch()) {
|
|
132
125
|
return resolveAcceptLanguage.getBestMatch();
|
|
133
126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resolve-accept-language",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.45-0",
|
|
4
4
|
"description": "Resolve the preferred locale based on the value of an `Accept-Language` HTTP header.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accept-language",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"author": "Avansai (https://avansai.com)",
|
|
25
|
+
"type": "module",
|
|
25
26
|
"main": "lib/resolve-accept-language.js",
|
|
26
27
|
"types": "lib/resolve-accept-language.d.ts",
|
|
27
28
|
"files": [
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
"lint-check": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json .",
|
|
33
34
|
"lint-fix": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json --fix .",
|
|
34
35
|
"lint-print-config": "eslint --print-config ./eslintrc.yaml",
|
|
36
|
+
"pre-release": "dotenv -- release-it --only-version --preRelease",
|
|
35
37
|
"prettier": "prettier --write .",
|
|
36
38
|
"release": "dotenv -- release-it --only-version",
|
|
37
39
|
"test": "jest --coverage"
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
43
45
|
"@typescript-eslint/parser": "^5.53.0",
|
|
44
46
|
"dotenv-cli": "^7.0.0",
|
|
45
|
-
"eslint": "^8.
|
|
47
|
+
"eslint": "^8.35.0",
|
|
46
48
|
"eslint-config-prettier": "^8.6.0",
|
|
47
49
|
"eslint-import-resolver-node": "^0.3.7",
|
|
48
50
|
"eslint-import-resolver-typescript": "^3.5.3",
|