Socket
Socket
Sign inDemoInstall

i18next-http-middleware

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-http-middleware - npm Package Compare versions

Comparing version 3.0.4 to 3.0.5

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## [v3.0.5](https://github.com/i18next/i18next-http-middleware/compare/v3.0.4...v3.0.5)
- introduce ignoreCase option
## [v3.0.4](https://github.com/i18next/i18next-http-middleware/compare/v3.0.3...v3.0.4)

@@ -2,0 +5,0 @@ - fix language detection algorithm to handle fallbackLng correctly

@@ -97,3 +97,13 @@ "use strict";

found = _this.services.languageUtils.getBestMatchFromCodes(detections);
if (found && detections.indexOf(found) < 0) found = undefined;
if (found) {
if (_this.options.ignoreCase) {
if (detections.map(function (d) {
return d.toLowerCase();
}).indexOf(found.toLowerCase()) < 0) found = undefined;
} else {
if (detections.indexOf(found) < 0) found = undefined;
}
}
if (found) req.i18nextLookupName = detectorName;

@@ -100,0 +110,0 @@ } else {

2

cjs/languageLookups/cookie.js

@@ -83,3 +83,3 @@ "use strict";

var cookies = options.getCookies(req);
found = cookies[options.lookupCookie];
if (cookies) found = cookies[options.lookupCookie];
}

@@ -86,0 +86,0 @@

@@ -76,3 +76,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

found = _this.services.languageUtils.getBestMatchFromCodes(detections);
if (found && detections.indexOf(found) < 0) found = undefined;
if (found) {
if (_this.options.ignoreCase) {
if (detections.map(function (d) {
return d.toLowerCase();
}).indexOf(found.toLowerCase()) < 0) found = undefined;
} else {
if (detections.indexOf(found) < 0) found = undefined;
}
}
if (found) req.i18nextLookupName = detectorName;

@@ -79,0 +89,0 @@ } else {

@@ -77,3 +77,3 @@ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;

var cookies = options.getCookies(req);
found = cookies[options.lookupCookie];
if (cookies) found = cookies[options.lookupCookie];
}

@@ -80,0 +80,0 @@

@@ -64,3 +64,9 @@ import * as utils from './utils.js'

found = this.services.languageUtils.getBestMatchFromCodes(detections)
if (found && detections.indexOf(found) < 0) found = undefined
if (found) {
if (this.options.ignoreCase) {
if (detections.map(d => d.toLowerCase()).indexOf(found.toLowerCase()) < 0) found = undefined
} else {
if (detections.indexOf(found) < 0) found = undefined
}
}
if (found) req.i18nextLookupName = detectorName

@@ -67,0 +73,0 @@ } else {

@@ -64,3 +64,3 @@ // eslint-disable-next-line no-control-regex

const cookies = options.getCookies(req)
found = cookies[options.lookupCookie]
if (cookies) found = cookies[options.lookupCookie]
}

@@ -67,0 +67,0 @@

{
"name": "i18next-http-middleware",
"version": "3.0.4",
"version": "3.0.5",
"private": false,

@@ -5,0 +5,0 @@ "type": "module",

@@ -299,2 +299,4 @@ # Introduction

ignoreCase: false, // ignore case of detected language
// optional expire and domain for set cookie

@@ -301,0 +303,0 @@ cookieExpirationDate: new Date(),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc