ilib-localematcher 1.3.0 → 1.3.2
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 +12 -1
- package/docs/LocaleMatcher.html +1 -1
- package/docs/LocaleMatcher.js.html +4 -6
- package/docs/index.html +1 -1
- package/lib/LocaleMatcher.js +1 -1
- package/lib/LocaleMatcher.js.map +1 -1
- package/lib/localematch.js +1 -1
- package/lib/localematch.js.map +1 -1
- package/package.json +32 -22
- package/src/LocaleMatcher.js +3 -5
- package/src/localematch.js +878 -872
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ilib-localematcher",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"main": "./lib/LocaleMatcher.js",
|
|
5
5
|
"module": "./src/LocaleMatcher.js",
|
|
6
6
|
"exports": {
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"require": "./lib/LocaleMatcher.js"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=12 <23"
|
|
14
|
+
},
|
|
12
15
|
"description": "A locale matcher to resolve partial locales or find fallback locales. iLib is a cross-engine library of internationalization (i18n) classes written in pure JS",
|
|
13
16
|
"keywords": [
|
|
14
17
|
"internationalization",
|
|
@@ -61,44 +64,51 @@
|
|
|
61
64
|
"build:pkg": "echo '{\"type\": \"commonjs\"}' > lib/package.json",
|
|
62
65
|
"build:data": "node scripts/genlikelyloc.js",
|
|
63
66
|
"dist": "npm-run-all build:data doc doc:html build:prod build:pkg; npm pack",
|
|
64
|
-
"test": "npm run test:
|
|
65
|
-
"test:cli": "LANG=en_US.UTF8 npm run build:dev ;
|
|
66
|
-
"test:web": "
|
|
67
|
-
"test:
|
|
68
|
-
"
|
|
67
|
+
"test": "npm run test:all",
|
|
68
|
+
"test:cli": "LANG=en_US.UTF8 npm run build:dev ; node --experimental-vm-modules node_modules/.bin/jest --testEnvironment node",
|
|
69
|
+
"test:web": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/karma/bin/karma start --reporters dots --single-run",
|
|
70
|
+
"test:watch": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/.bin/jest --testEnvironment node --watch",
|
|
71
|
+
"test:all": "npm-run-all test:cli test:web",
|
|
72
|
+
"debug": "npm run build:dev ; node --experimental-vm-modules --inspect-brk node_modules/.bin/jest --testEnvironment node -i",
|
|
73
|
+
"debug:web": "LANG=en_US.UTF8 node --experimental-vm-modules node_modules/karma/bin/karma start --reporters dots",
|
|
69
74
|
"clean": "git clean -f -d src test; rm -rf lib/*",
|
|
70
75
|
"doc": "mkdir -p docs ; jsdoc2md -c jsdoc.json --separators --source src/* -m table > docs/ilibLocaleMatcher.md",
|
|
71
76
|
"doc:html": "jsdoc -c jsdoc.json"
|
|
72
77
|
},
|
|
73
78
|
"devDependencies": {
|
|
74
|
-
"@babel/core": "^7.
|
|
75
|
-
"@babel/preset-env": "^7.
|
|
76
|
-
"@babel/register": "^7.
|
|
77
|
-
"@babel/runtime": "^7.
|
|
78
|
-
"
|
|
79
|
-
"babel-loader": "^9.1.3",
|
|
79
|
+
"@babel/core": "^7.28.5",
|
|
80
|
+
"@babel/preset-env": "^7.28.5",
|
|
81
|
+
"@babel/register": "^7.28.3",
|
|
82
|
+
"@babel/runtime": "^7.28.4",
|
|
83
|
+
"babel-loader": "^8.4.1",
|
|
80
84
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
81
|
-
"babel-plugin-module-resolver": "^5.0.
|
|
82
|
-
"cldr-core": "^44.0
|
|
85
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
86
|
+
"cldr-core": "^44.1.0",
|
|
83
87
|
"docdash": "^2.0.2",
|
|
88
|
+
"expect": "^29.7.0",
|
|
84
89
|
"grunt": "^1.6.1",
|
|
85
90
|
"grunt-babel": "^8.0.0",
|
|
86
|
-
"grunt-cli": "^1.
|
|
91
|
+
"grunt-cli": "^1.5.0",
|
|
87
92
|
"grunt-contrib-clean": "^2.0.1",
|
|
88
93
|
"grunt-contrib-jshint": "^3.2.0",
|
|
89
94
|
"grunt-contrib-nodeunit": "^5.0.0",
|
|
90
95
|
"grunt-contrib-uglify": "^5.2.2",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
96
|
+
"jest": "^26.6.3",
|
|
97
|
+
"jest-mock": "^29.7.0",
|
|
98
|
+
"jsdoc": "^4.0.5",
|
|
99
|
+
"jsdoc-to-markdown": "^8.0.3",
|
|
100
|
+
"karma": "^6.4.4",
|
|
101
|
+
"karma-assert": "^1.0.1",
|
|
102
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
103
|
+
"karma-jasmine": "^5.1.0",
|
|
104
|
+
"karma-webpack": "5.0.0",
|
|
93
105
|
"load-grunt-tasks": "^5.1.0",
|
|
94
|
-
"nodeunit": "^0.11.3",
|
|
95
106
|
"npm-run-all": "^4.1.5",
|
|
96
|
-
"
|
|
97
|
-
"webpack": "^5.89.0",
|
|
107
|
+
"webpack": "^5.102.1",
|
|
98
108
|
"webpack-cli": "^5.1.4"
|
|
99
109
|
},
|
|
100
110
|
"dependencies": {
|
|
101
|
-
"ilib-common": "^1.1.
|
|
102
|
-
"ilib-locale": "^1.2.
|
|
111
|
+
"ilib-common": "^1.1.6",
|
|
112
|
+
"ilib-locale": "^1.2.4"
|
|
103
113
|
}
|
|
104
114
|
}
|
package/src/LocaleMatcher.js
CHANGED
|
@@ -294,8 +294,8 @@ class LocaleMatcher {
|
|
|
294
294
|
} else {
|
|
295
295
|
// check for containment
|
|
296
296
|
const containers = matchdata.territoryContainmentReverse[this.locale.region] || [];
|
|
297
|
-
// end at 1 because
|
|
298
|
-
for (i = containers.length-1; i
|
|
297
|
+
// end at length-1 because the end is "001" which is "the whole world" -- which is not useful
|
|
298
|
+
for (i = 0; i < containers.length-1; i++) {
|
|
299
299
|
const container = matchdata.territoryContainment[containers[i]];
|
|
300
300
|
if (container && container.indexOf(other.region) > -1) {
|
|
301
301
|
// same area only accounts for 20% of the region score
|
|
@@ -379,9 +379,7 @@ class LocaleMatcher {
|
|
|
379
379
|
const thisRegions = this._getRegionContainment(thisRegion);
|
|
380
380
|
const otherRegions = this._getRegionContainment(otherRegion);
|
|
381
381
|
|
|
382
|
-
|
|
383
|
-
// at the end of the array
|
|
384
|
-
for (let i = thisRegions.length-1; i > 0; i--) {
|
|
382
|
+
for (let i = 0; i < thisRegions.length; i++) {
|
|
385
383
|
if (otherRegions.indexOf(thisRegions[i]) > -1) {
|
|
386
384
|
return thisRegions[i];
|
|
387
385
|
}
|