@formatjs/intl-localematcher 0.5.4 → 0.5.6
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/abstract/BestAvailableLocale.js +1 -2
- package/abstract/BestFitMatcher.js +1 -2
- package/abstract/CanonicalizeLocaleList.js +1 -2
- package/abstract/LookupMatcher.js +1 -2
- package/abstract/LookupSupportedLocales.js +1 -2
- package/abstract/ResolveLocale.js +1 -2
- package/abstract/UnicodeExtensionValue.js +1 -2
- package/abstract/utils.js +4 -4
- package/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BestAvailableLocale =
|
|
3
|
+
exports.BestAvailableLocale = BestAvailableLocale;
|
|
4
4
|
/**
|
|
5
5
|
* https://tc39.es/ecma402/#sec-bestavailablelocale
|
|
6
6
|
* @param availableLocales
|
|
@@ -22,4 +22,3 @@ function BestAvailableLocale(availableLocales, locale) {
|
|
|
22
22
|
candidate = candidate.slice(0, pos);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.BestAvailableLocale = BestAvailableLocale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BestFitMatcher =
|
|
3
|
+
exports.BestFitMatcher = BestFitMatcher;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
/**
|
|
6
6
|
* https://tc39.es/ecma402/#sec-bestfitmatcher
|
|
@@ -32,4 +32,3 @@ function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
|
32
32
|
extension: extension,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
exports.BestFitMatcher = BestFitMatcher;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CanonicalizeLocaleList =
|
|
3
|
+
exports.CanonicalizeLocaleList = CanonicalizeLocaleList;
|
|
4
4
|
/**
|
|
5
5
|
* http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
|
|
6
6
|
* @param locales
|
|
@@ -9,4 +9,3 @@ function CanonicalizeLocaleList(locales) {
|
|
|
9
9
|
// TODO
|
|
10
10
|
return Intl.getCanonicalLocales(locales);
|
|
11
11
|
}
|
|
12
|
-
exports.CanonicalizeLocaleList = CanonicalizeLocaleList;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LookupMatcher =
|
|
3
|
+
exports.LookupMatcher = LookupMatcher;
|
|
4
4
|
var BestAvailableLocale_1 = require("./BestAvailableLocale");
|
|
5
5
|
var utils_1 = require("./utils");
|
|
6
6
|
/**
|
|
@@ -26,4 +26,3 @@ function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
|
26
26
|
result.locale = getDefaultLocale();
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
|
-
exports.LookupMatcher = LookupMatcher;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LookupSupportedLocales =
|
|
3
|
+
exports.LookupSupportedLocales = LookupSupportedLocales;
|
|
4
4
|
var BestAvailableLocale_1 = require("./BestAvailableLocale");
|
|
5
5
|
var utils_1 = require("./utils");
|
|
6
6
|
/**
|
|
@@ -20,4 +20,3 @@ function LookupSupportedLocales(availableLocales, requestedLocales) {
|
|
|
20
20
|
}
|
|
21
21
|
return subset;
|
|
22
22
|
}
|
|
23
|
-
exports.LookupSupportedLocales = LookupSupportedLocales;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResolveLocale =
|
|
3
|
+
exports.ResolveLocale = ResolveLocale;
|
|
4
4
|
var BestFitMatcher_1 = require("./BestFitMatcher");
|
|
5
5
|
var LookupMatcher_1 = require("./LookupMatcher");
|
|
6
6
|
var UnicodeExtensionValue_1 = require("./UnicodeExtensionValue");
|
|
@@ -75,4 +75,3 @@ function ResolveLocale(availableLocales, requestedLocales, options, relevantExte
|
|
|
75
75
|
result.locale = foundLocale;
|
|
76
76
|
return result;
|
|
77
77
|
}
|
|
78
|
-
exports.ResolveLocale = ResolveLocale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnicodeExtensionValue =
|
|
3
|
+
exports.UnicodeExtensionValue = UnicodeExtensionValue;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
/**
|
|
6
6
|
* https://tc39.es/ecma402/#sec-unicodeextensionvalue
|
|
@@ -47,4 +47,3 @@ function UnicodeExtensionValue(extension, key) {
|
|
|
47
47
|
}
|
|
48
48
|
return undefined;
|
|
49
49
|
}
|
|
50
|
-
exports.UnicodeExtensionValue = UnicodeExtensionValue;
|
package/abstract/utils.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
|
|
4
|
+
exports.invariant = invariant;
|
|
5
|
+
exports.findMatchingDistance = findMatchingDistance;
|
|
6
|
+
exports.findBestMatch = findBestMatch;
|
|
4
7
|
var tslib_1 = require("tslib");
|
|
5
8
|
var languageMatching_1 = require("./languageMatching");
|
|
6
9
|
var regions_generated_1 = require("./regions.generated");
|
|
@@ -11,7 +14,6 @@ function invariant(condition, message, Err) {
|
|
|
11
14
|
throw new Err(message);
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
|
-
exports.invariant = invariant;
|
|
15
17
|
// This is effectively 2 languages in 2 different regions in the same cluster
|
|
16
18
|
var DEFAULT_MATCHING_THRESHOLD = 838;
|
|
17
19
|
var PROCESSED_DATA;
|
|
@@ -137,7 +139,6 @@ function findMatchingDistance(desired, supported) {
|
|
|
137
139
|
}
|
|
138
140
|
return matchingDistance;
|
|
139
141
|
}
|
|
140
|
-
exports.findMatchingDistance = findMatchingDistance;
|
|
141
142
|
function findBestMatch(requestedLocales, supportedLocales, threshold) {
|
|
142
143
|
if (threshold === void 0) { threshold = DEFAULT_MATCHING_THRESHOLD; }
|
|
143
144
|
var lowestDistance = Infinity;
|
|
@@ -168,4 +169,3 @@ function findBestMatch(requestedLocales, supportedLocales, threshold) {
|
|
|
168
169
|
}
|
|
169
170
|
return result;
|
|
170
171
|
}
|
|
171
|
-
exports.findBestMatch = findBestMatch;
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResolveLocale = exports.LookupSupportedLocales =
|
|
3
|
+
exports.ResolveLocale = exports.LookupSupportedLocales = void 0;
|
|
4
|
+
exports.match = match;
|
|
4
5
|
var CanonicalizeLocaleList_1 = require("./abstract/CanonicalizeLocaleList");
|
|
5
6
|
var ResolveLocale_1 = require("./abstract/ResolveLocale");
|
|
6
7
|
function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
@@ -8,7 +9,6 @@ function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
|
8
9
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || 'best fit',
|
|
9
10
|
}, [], {}, function () { return defaultLocale; }).locale;
|
|
10
11
|
}
|
|
11
|
-
exports.match = match;
|
|
12
12
|
var LookupSupportedLocales_1 = require("./abstract/LookupSupportedLocales");
|
|
13
13
|
Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function () { return LookupSupportedLocales_1.LookupSupportedLocales; } });
|
|
14
14
|
var ResolveLocale_2 = require("./abstract/ResolveLocale");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-localematcher",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Intl.LocaleMatcher ponyfill",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"url": "https://github.com/formatjs/formatjs/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"tslib": "
|
|
28
|
+
"tslib": "2"
|
|
29
29
|
}
|
|
30
30
|
}
|