@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 CHANGED
@@ -5,7 +5,8 @@ module.exports = {
5
5
  'mocha': true
6
6
  },
7
7
  'parserOptions': {
8
- 'ecmaVersion': 2017
8
+ 'ecmaVersion': 2017,
9
+ 'sourceType': 'module'
9
10
  },
10
11
  'extends': 'eslint:recommended',
11
12
  'rules': {
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 } = require('@trenskow/localization-data');
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
- exports.entities = (identifier) => entities(expand(identifier));
155
- exports.expand = expand;
156
- exports.collapse = collapse;
157
- exports.match = match;
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(exports, 'all', {
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.2",
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.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.0"
26
+ "@trenskow/localization-data": "^1.3.1"
26
27
  }
27
28
  }
package/test/index.js CHANGED
@@ -1,10 +1,5 @@
1
- 'use strict';
2
-
3
- const
4
- { expect } = require('chai');
5
-
6
- const
7
- language = require('../');
1
+ import { expect } from 'chai';
2
+ import language from '../index.js';
8
3
 
9
4
  describe('language', () => {
10
5
  it ('should come back with all.', () => {