i18next-http-middleware 3.1.0 → 3.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [v3.1.1](https://github.com/i18next/i18next-http-middleware/compare/v3.1.0...v3.1.1)
2
+ - make sure no undefined language is detected
3
+
1
4
  ## [v3.1.0](https://github.com/i18next/i18next-http-middleware/compare/v3.0.6...v3.1.0)
2
5
  - added types
3
6
 
@@ -92,6 +92,9 @@ var LanguageDetector = function () {
92
92
 
93
93
  if (!detections) return;
94
94
  if (!Array.isArray(detections)) detections = [detections];
95
+ detections = detections.filter(function (d) {
96
+ return d !== undefined && d !== null;
97
+ });
95
98
 
96
99
  if (_this.services.languageUtils.getBestMatchFromCodes) {
97
100
  found = _this.services.languageUtils.getBestMatchFromCodes(detections);
@@ -71,6 +71,9 @@ var LanguageDetector = function () {
71
71
 
72
72
  if (!detections) return;
73
73
  if (!Array.isArray(detections)) detections = [detections];
74
+ detections = detections.filter(function (d) {
75
+ return d !== undefined && d !== null;
76
+ });
74
77
 
75
78
  if (_this.services.languageUtils.getBestMatchFromCodes) {
76
79
  found = _this.services.languageUtils.getBestMatchFromCodes(detections);
@@ -60,6 +60,8 @@ class LanguageDetector {
60
60
  if (!detections) return
61
61
  if (!Array.isArray(detections)) detections = [detections]
62
62
 
63
+ detections = detections.filter((d) => d !== undefined && d !== null)
64
+
63
65
  if (this.services.languageUtils.getBestMatchFromCodes) { // new i18next v19.5.0
64
66
  found = this.services.languageUtils.getBestMatchFromCodes(detections)
65
67
  if (found) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-http-middleware",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./cjs/index.js",