@trenskow/language 1.3.2 → 1.4.1
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/.eslintrc.js +2 -1
- package/index.js +19 -6
- package/package.json +4 -3
- package/test/index.js +2 -7
package/.eslintrc.js
CHANGED
package/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
import localizationData from '@trenskow/localization-data';
|
|
4
|
+
|
|
3
5
|
const
|
|
4
|
-
{ countries, languages, scripts } =
|
|
6
|
+
{ countries, languages, scripts } = localizationData;
|
|
5
7
|
|
|
6
8
|
const lowercaseKeys = (obj) => {
|
|
7
9
|
return Object.keys(obj).map((key) => key.toLowerCase());
|
|
@@ -151,12 +153,23 @@ const match = (identifier, supported, def) => {
|
|
|
151
153
|
|
|
152
154
|
};
|
|
153
155
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
const expandedEntities = (identifier) => entities(expand(identifier));
|
|
157
|
+
|
|
158
|
+
let language = {
|
|
159
|
+
entities: expandedEntities,
|
|
160
|
+
expand,
|
|
161
|
+
collapse,
|
|
162
|
+
match
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export default language;
|
|
166
|
+
|
|
167
|
+
export { expandedEntities as entities };
|
|
168
|
+
export { expand };
|
|
169
|
+
export { collapse };
|
|
170
|
+
export { match };
|
|
158
171
|
|
|
159
|
-
Object.defineProperty(
|
|
172
|
+
Object.defineProperty(language, 'all', {
|
|
160
173
|
get: () => {
|
|
161
174
|
return [].concat(...Object.keys(languages).map((language) => {
|
|
162
175
|
return [].concat(...Object.keys(languages[language].scripts || {}).map((script) => {
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trenskow/language",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "A small library for getting a full language identifier (RFC 5646).",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "./node_modules/mocha/bin/mocha.js test/index.js"
|
|
8
9
|
},
|
|
@@ -17,11 +18,11 @@
|
|
|
17
18
|
},
|
|
18
19
|
"homepage": "https://github.com/trenskow/language#readme",
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"chai": "^5.0.
|
|
21
|
+
"chai": "^5.0.3",
|
|
21
22
|
"eslint": "^8.56.0",
|
|
22
23
|
"mocha": "^10.2.0"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@trenskow/localization-data": "^1.3.
|
|
26
|
+
"@trenskow/localization-data": "^1.3.1"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/test/index.js
CHANGED