Comparing version 1.0.0 to 1.0.1
16
index.js
@@ -61,6 +61,6 @@ var Negotiator = require('negotiator') | ||
var n = this.negotiator; | ||
if (!types.length) return n.preferredMediaTypes(); | ||
if (!types.length) return n.mediaTypes(); | ||
if (!this.headers.accept) return types[0]; | ||
var mimes = types.map(extToMime); | ||
var accepts = n.preferredMediaTypes(mimes); | ||
var accepts = n.mediaTypes(mimes); | ||
var first = accepts[0]; | ||
@@ -88,4 +88,4 @@ if (!first) return false; | ||
var n = this.negotiator; | ||
if (!encodings.length) return n.preferredEncodings(); | ||
return n.preferredEncodings(encodings)[0] || 'identity'; | ||
if (!encodings.length) return n.encodings(); | ||
return n.encodings(encodings)[0] || false; | ||
} | ||
@@ -110,5 +110,5 @@ | ||
var n = this.negotiator; | ||
if (!charsets.length) return n.preferredCharsets(); | ||
if (!charsets.length) return n.charsets(); | ||
if (!this.headers['accept-charset']) return charsets[0]; | ||
return n.preferredCharsets(charsets)[0] || false; | ||
return n.charsets(charsets)[0] || false; | ||
} | ||
@@ -135,5 +135,5 @@ | ||
var n = this.negotiator; | ||
if (!langs.length) return n.preferredLanguages(); | ||
if (!langs.length) return n.languages(); | ||
if (!this.headers['accept-language']) return langs[0]; | ||
return n.preferredLanguages(langs)[0] || false; | ||
return n.languages(langs)[0] || false; | ||
} | ||
@@ -140,0 +140,0 @@ |
{ | ||
"name": "accepts", | ||
"description": "Higher-level content negotiation", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -22,3 +22,3 @@ "name": "Jonathan Ong", | ||
"mime": "~1.2.11", | ||
"negotiator": "~0.3.0" | ||
"negotiator": "~0.4.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
@@ -55,3 +55,3 @@ # Accepts [![Build Status](https://travis-ci.org/expressjs/accepts.png)](https://travis-ci.org/expressjs/accepts) | ||
If the client does not accept any `values`, `false` will be returned. | ||
If the client accepts any `values`, a filtered list of accepted `values` will be return in descending priority. | ||
If the client accepts any `values`, the preferred `value` will be return. | ||
@@ -58,0 +58,0 @@ For `accept.types()`, shorthand mime types are allowed. |
Sorry, the diff of this file is not supported yet
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
7915
6
134
+ Addednegotiator@0.4.9(transitive)
- Removednegotiator@0.3.0(transitive)
Updatednegotiator@~0.4.0