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

accepts

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accepts - npm Package Compare versions

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

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