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

accept-language-parser

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accept-language-parser - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

6

index.js

@@ -43,4 +43,8 @@ var regex = /((([a-zA-Z]+(-[a-zA-Z]+)?)|\*)(;q=[0-1](\.[0-9]+)?)?)*/g;

var lang = accept[i];
var langCode = lang.code.toLowerCase();
var langRegion = lang.region ? lang.region.toLowerCase() : lang.region;
for (var j = 0; j < supported.length; j++) {
if (lang.code === supported[j].code && (!lang.region || lang.region === supported[j].region)) {
var supportedCode = supported[j].code.toLowerCase();
var supportedRegion = supported[j].region ? supported[j].region.toLowerCase() : supported[j].region;
if (langCode === supportedCode && (!langRegion || langRegion === supportedRegion)) {
return supportedLanguages[j];

@@ -47,0 +51,0 @@ }

4

package.json
{
"name": "accept-language-parser",
"version": "1.1.1",
"version": "1.1.2",
"description": "Parse the accept-language header from a HTTP request",

@@ -28,5 +28,5 @@ "main": "index.js",

"grunt-mocha-test": "^0.10.0",
"should": "^3.2.0",
"should": "^9.0.0",
"grunt-contrib-jshint": "^0.9.2"
}
}

@@ -81,2 +81,7 @@ var parser = require("../index.js");

it('should pick proper language regardless of casing', function(){
var result = parser.pick(['eN-Us', 'Fr-cA'], 'fR-Ca,fr;q=0.2,en-US;q=0.6,en;q=0.4,*;q=0.5');
assert.equal(result.toLowerCase(), 'fr-ca');
});
it('should pick a specific language', function(){

@@ -83,0 +88,0 @@ var result = parser.pick(['en', 'fr-CA'], 'ja-JP,ja;1=0.5,en;q=0.2');

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