accept-language
Advanced tools
Comparing version 3.0.15 to 3.0.16
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var bcp47 = require("bcp47"); | ||
var stable = require("stable"); | ||
var AcceptLanguage = (function () { | ||
@@ -88,3 +90,3 @@ function AcceptLanguage() { | ||
function parseAndSortLanguageTags(languagePriorityList) { | ||
return languagePriorityList.split(',').map(function (weightedLanguageRange) { | ||
return stable(languagePriorityList.split(',').map(function (weightedLanguageRange) { | ||
var components = weightedLanguageRange.replace(/\s+/, '').split(';'); | ||
@@ -105,3 +107,4 @@ return { | ||
}) | ||
.sort(function (a, b) { | ||
// Sort by quality | ||
, function (a, b) { | ||
return b.quality - a.quality; | ||
@@ -144,3 +147,2 @@ }); | ||
module.exports.default = create(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = create(); |
{ | ||
"name": "accept-language", | ||
"version": "3.0.15", | ||
"version": "3.0.16", | ||
"description": "Accept-Language parser for nodejs", | ||
@@ -32,4 +32,5 @@ "main": "Build/Source/AcceptLanguage.js", | ||
"dependencies": { | ||
"bcp47": "^1.1.2" | ||
"bcp47": "^1.1.2", | ||
"stable": "^0.1.6" | ||
} | ||
} |
@@ -33,3 +33,3 @@ accept-language [![Build Status](https://travis-ci.org/tinganho/node-accept-language.png)](https://travis-ci.org/tinganho/node-accept-language) | ||
#### acceptLanguage.languages(Array languageTags); | ||
Define your language tags ordered in highest priority comes first fashion. The first language will act as a default language in case of no match. The language tags must comply with [BCP47][] standard. | ||
Define your language tags ordered in highest priority comes first fashion. The language tags must comply with [BCP47][] standard. | ||
@@ -41,3 +41,3 @@ ```javascript | ||
#### acceptLanguage.get(String acceptLanguageString); | ||
Get a matched language given an `Accept-Language` string. In case of no match, the default language or `null` will be returned. | ||
Get the most likely language given an `Accept-Language` string. In order for it to work you must set all your languages first. | ||
```javascript | ||
@@ -44,0 +44,0 @@ acceptLanguage.get('en-GB,en;q=0.8,sv'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10261
166
2
+ Addedstable@^0.1.6
+ Addedstable@0.1.8(transitive)