https://project.mdnd-it.cc/work_packages/94
This commit is contained in:
2025-08-23 04:25:28 +02:00
parent 725516ad6c
commit 19cfa031d0
25823 changed files with 1095587 additions and 2801760 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
unreleased
1.0.0 / 2024-08-31
==================
* Drop support for node <18
* Added an option preferred encodings array #59
0.6.3 / 2022-01-22
+2 -2
View File
@@ -172,7 +172,7 @@ Returns the most preferred encoding from the client.
Returns the most preferred encoding from a list of available encodings.
##### encoding(availableEncodings, preferred)
##### encoding(availableEncodings, { preferred })
Returns the most preferred encoding from a list of available encodings, while prioritizing based on `preferred` array between same-quality encodings.
@@ -185,7 +185,7 @@ Returns an array of preferred encodings ordered by the client preference.
Returns an array of preferred encodings ordered by priority from a list of
available encodings.
##### encodings(availableEncodings, preferred)
##### encodings(availableEncodings, { preferred })
Returns an array of preferred encodings ordered by priority from a list of
available encodings, while prioritizing based on `preferred` array between same-quality encodings.
+5 -4
View File
@@ -44,13 +44,14 @@ Negotiator.prototype.charsets = function charsets(available) {
return preferredCharsets(this.request.headers['accept-charset'], available);
};
Negotiator.prototype.encoding = function encoding(available, preferred) {
var set = this.encodings(available, preferred);
Negotiator.prototype.encoding = function encoding(available, opts) {
var set = this.encodings(available, opts);
return set && set[0];
};
Negotiator.prototype.encodings = function encodings(available, preferred) {
return preferredEncodings(this.request.headers['accept-encoding'], available, preferred);
Negotiator.prototype.encodings = function encodings(available, options) {
var opts = options || {};
return preferredEncodings(this.request.headers['accept-encoding'], available, opts.preferred);
};
Negotiator.prototype.language = function language(available) {
+2 -1
View File
@@ -1,7 +1,7 @@
{
"name": "negotiator",
"description": "HTTP content negotiation",
"version": "0.6.4",
"version": "1.0.0",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
"Federico Romero <federico.romero@outboxlabs.com>",
@@ -36,6 +36,7 @@
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test:debug": "mocha --reporter spec --check-leaks --inspect --inspect-brk test/",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}