@formatjs/intl-localematcher 0.5.3 → 0.5.4

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/utils.js CHANGED
@@ -149,10 +149,11 @@ function findBestMatch(requestedLocales, supportedLocales, threshold) {
149
149
  if (!result.distances[desired]) {
150
150
  result.distances[desired] = {};
151
151
  }
152
- supportedLocales.forEach(function (supported, j) {
152
+ supportedLocales.forEach(function (supported) {
153
153
  // Add some weight to the distance based on the order of the supported locales
154
- // Add penalty for the order of the requested locales
155
- var distance = findMatchingDistance(desired, supported) + j + i * 40;
154
+ // Add penalty for the order of the requested locales, which currently is 0 since ECMA-402
155
+ // doesn't really have room for weighted locales like `en; q=0.1`
156
+ var distance = findMatchingDistance(desired, supported) + 0 + i * 40;
156
157
  result.distances[desired][supported] = distance;
157
158
  if (distance < lowestDistance) {
158
159
  lowestDistance = distance;
@@ -144,10 +144,11 @@ export function findBestMatch(requestedLocales, supportedLocales, threshold) {
144
144
  if (!result.distances[desired]) {
145
145
  result.distances[desired] = {};
146
146
  }
147
- supportedLocales.forEach(function (supported, j) {
147
+ supportedLocales.forEach(function (supported) {
148
148
  // Add some weight to the distance based on the order of the supported locales
149
- // Add penalty for the order of the requested locales
150
- var distance = findMatchingDistance(desired, supported) + j + i * 40;
149
+ // Add penalty for the order of the requested locales, which currently is 0 since ECMA-402
150
+ // doesn't really have room for weighted locales like `en; q=0.1`
151
+ var distance = findMatchingDistance(desired, supported) + 0 + i * 40;
151
152
  result.distances[desired][supported] = distance;
152
153
  if (distance < lowestDistance) {
153
154
  lowestDistance = distance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-localematcher",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Intl.LocaleMatcher ponyfill",
5
5
  "keywords": [
6
6
  "intl",