New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nuxt-i18n

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-i18n - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="2.6.0"></a>
# [2.6.0](https://github.com/nuxt-community/nuxt-i18n/compare/v2.5.1...v2.6.0) (2018-03-10)
### Features
* Add useRedirectCookie option ([6d6aad0](https://github.com/nuxt-community/nuxt-i18n/commit/6d6aad0))
<a name="2.5.1"></a>

@@ -7,0 +17,0 @@ ## [2.5.1](https://github.com/nuxt-community/nuxt-i18n/compare/v2.5.0...v2.5.1) (2018-03-10)

3

lib/module.js

@@ -15,3 +15,4 @@ const { resolve } = require('path')

detectBrowserLanguage: false,
redirectCookieKey: 'redirected'
redirectCookieKey: 'redirected',
useRedirectCookie: true
}

@@ -18,0 +19,0 @@ const options = merge(defaults, moduleOptions, this.options.i18n)

import cookie from 'cookie'
import { has } from 'lodash'
import middleware from './middleware'

@@ -22,14 +21,16 @@

if (<%= options.detectBrowserLanguage %> && req && route.name) {
const cookieKey = '<%= options.redirectCookieKey %>';
const cookies = has(req, 'headers.cookie') ? cookie.parse(req.headers.cookie) : {};
const useRedirectCookie = <%= options.useRedirectCookie %>
const cookieKey = '<%= options.redirectCookieKey %>'
const cookies = req.headers && req.headers.cookies ?
cookie.parse(req.headers.cookie) : {}
// Redirect only if cookie not set yet
if (!cookies[cookieKey]) {
if (!cookies[cookieKey] || !useRedirectCookie) {
const browserLocale = req.headers['accept-language'].split(',')[0].toLocaleLowerCase().substring(0, 2)
// Set cookie
if (res) {
const date = new Date();
if (useRedirectCookie && res) {
const date = new Date()
const redirectCookie = cookie.serialize(cookieKey, 1, {
expires: new Date(date.setDate(date.getDate() + 365))
})
res.setHeader('Set-Cookie', redirectCookie);
res.setHeader('Set-Cookie', redirectCookie)
}

@@ -41,3 +42,3 @@ // Redirect

name: app.getRouteBaseName()
})));
})))
}

@@ -44,0 +45,0 @@ }

{
"name": "nuxt-i18n",
"version": "2.5.1",
"version": "2.6.0",
"description": "i18n for Nuxt",

@@ -5,0 +5,0 @@ "license": "MIT",

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