Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accept-language

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accept-language - npm Package Compare versions

Comparing version 3.0.16 to 3.0.17

56

Build/Source/AcceptLanguage.js

@@ -64,15 +64,16 @@ "use strict";

// Continue fast.
if (!requestedLangTag[prop]) {
var definedLanguagePropertValue = definedLangTag[prop];
if (!definedLanguagePropertValue) {
continue;
}
// Filter out more 'narrower' requested languages first. If someone requests 'zh-Hant'
// and my defined language is 'zh'. Then I cannot match 'zh-Hant', because 'zh' is
// wider than 'zh-Hant'.
if (requestedLangTag[prop] && !definedLangTag[prop]) {
// Filter out wider requested languages first. If someone requests 'zh'
// and my defined language is 'zh-Hant'. I cannot match 'zh-Hant', because
// 'zh' is wider than 'zh-Hant'.
var requestedLanguagePropertyValue = requestedLangTag[prop];
if (definedLanguagePropertValue && !requestedLanguagePropertyValue) {
continue middle;
}
// Filter out 'narrower' requested languages.
if (requestedLangTag[prop] instanceof Array) {
for (var i = 0; i < requestedLangTag[prop].length; i++) {
if (!deepEqual(requestedLangTag[prop][i], definedLangTag[prop][i])) {
else if (prop === 'privateuse' || prop === 'variant') {
for (var i = 0; i < definedLanguagePropertValue.length; i++) {
if (definedLanguagePropertValue[i] !== requestedLanguagePropertyValue[i]) {
continue middle;

@@ -82,3 +83,16 @@ }

}
else if (requestedLangTag[prop] && definedLangTag[prop] !== requestedLangTag[prop]) {
else if (prop === 'extension') {
for (var i = 0; i < definedLanguagePropertValue.length; i++) {
var extensions = definedLanguagePropertValue[i].extension;
for (var ei = 0; ei < extensions.length; ei++) {
if (!requestedLanguagePropertyValue[i]) {
continue middle;
}
if (extensions[ei] !== requestedLanguagePropertyValue[i].extension[ei]) {
continue middle;
}
}
}
}
else if (definedLanguagePropertValue !== requestedLanguagePropertyValue) {
continue middle;

@@ -116,24 +130,2 @@ }

}());
function deepEqual(x, y) {
if ((typeof x === 'object' && x !== null) && (typeof y === 'object' && y !== null)) {
if (Object.keys(x).length !== Object.keys(y).length) {
return false;
}
for (var prop in x) {
if (y.hasOwnProperty(prop)) {
if (!deepEqual(x[prop], y[prop])) {
return false;
}
}
else {
return false;
}
}
return true;
}
else if (x !== y) {
return false;
}
return true;
}
function create() {

@@ -140,0 +132,0 @@ var al = new AcceptLanguage();

@@ -7,4 +7,3 @@

/**
* Define your supported languages. The first language will be acted as the default language
* in case of no match.
* Define your supported languages. The first language will be your default language.
*/

@@ -14,3 +13,3 @@ languages(languages: string[]): void;

/**
* Get matched languages. If no match, the default language will be returned.
* Get matched language. If no match, the default language will be returned.
*/

@@ -17,0 +16,0 @@ get(priorityList: string | null | undefined): string | null;

{
"name": "accept-language",
"version": "3.0.16",
"version": "3.0.17",
"description": "Accept-Language parser for nodejs",

@@ -5,0 +5,0 @@ "main": "Build/Source/AcceptLanguage.js",

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