summaryrefslogtreecommitdiff
path: root/node_modules/negotiator
diff options
context:
space:
mode:
authorMarvin Borner2018-11-07 22:11:20 +0100
committerMarvin Borner2018-11-07 22:11:20 +0100
commit641ed66837dd4bd45c977978609fb38cbeac9319 (patch)
treeeec4e367844a7059d29aa2aae086e6c064c03380 /node_modules/negotiator
parent954583f3d56fbfb60321725f13ad092e536e3737 (diff)
Didn't remove node_modules correctly..
Diffstat (limited to 'node_modules/negotiator')
-rw-r--r--node_modules/negotiator/HISTORY.md98
-rw-r--r--node_modules/negotiator/LICENSE24
-rw-r--r--node_modules/negotiator/README.md203
-rw-r--r--node_modules/negotiator/index.js124
-rw-r--r--node_modules/negotiator/lib/charset.js169
-rw-r--r--node_modules/negotiator/lib/encoding.js184
-rw-r--r--node_modules/negotiator/lib/language.js179
-rw-r--r--node_modules/negotiator/lib/mediaType.js294
-rw-r--r--node_modules/negotiator/package.json81
9 files changed, 0 insertions, 1356 deletions
diff --git a/node_modules/negotiator/HISTORY.md b/node_modules/negotiator/HISTORY.md
deleted file mode 100644
index 10b6917..0000000
--- a/node_modules/negotiator/HISTORY.md
+++ /dev/null
@@ -1,98 +0,0 @@
-0.6.1 / 2016-05-02
-==================
-
- * perf: improve `Accept` parsing speed
- * perf: improve `Accept-Charset` parsing speed
- * perf: improve `Accept-Encoding` parsing speed
- * perf: improve `Accept-Language` parsing speed
-
-0.6.0 / 2015-09-29
-==================
-
- * Fix including type extensions in parameters in `Accept` parsing
- * Fix parsing `Accept` parameters with quoted equals
- * Fix parsing `Accept` parameters with quoted semicolons
- * Lazy-load modules from main entry point
- * perf: delay type concatenation until needed
- * perf: enable strict mode
- * perf: hoist regular expressions
- * perf: remove closures getting spec properties
- * perf: remove a closure from media type parsing
- * perf: remove property delete from media type parsing
-
-0.5.3 / 2015-05-10
-==================
-
- * Fix media type parameter matching to be case-insensitive
-
-0.5.2 / 2015-05-06
-==================
-
- * Fix comparing media types with quoted values
- * Fix splitting media types with quoted commas
-
-0.5.1 / 2015-02-14
-==================
-
- * Fix preference sorting to be stable for long acceptable lists
-
-0.5.0 / 2014-12-18
-==================
-
- * Fix list return order when large accepted list
- * Fix missing identity encoding when q=0 exists
- * Remove dynamic building of Negotiator class
-
-0.4.9 / 2014-10-14
-==================
-
- * Fix error when media type has invalid parameter
-
-0.4.8 / 2014-09-28
-==================
-
- * Fix all negotiations to be case-insensitive
- * Stable sort preferences of same quality according to client order
- * Support Node.js 0.6
-
-0.4.7 / 2014-06-24
-==================
-
- * Handle invalid provided languages
- * Handle invalid provided media types
-
-0.4.6 / 2014-06-11
-==================
-
- * Order by specificity when quality is the same
-
-0.4.5 / 2014-05-29
-==================
-
- * Fix regression in empty header handling
-
-0.4.4 / 2014-05-29
-==================
-
- * Fix behaviors when headers are not present
-
-0.4.3 / 2014-04-16
-==================
-
- * Handle slashes on media params correctly
-
-0.4.2 / 2014-02-28
-==================
-
- * Fix media type sorting
- * Handle media types params strictly
-
-0.4.1 / 2014-01-16
-==================
-
- * Use most specific matches
-
-0.4.0 / 2014-01-09
-==================
-
- * Remove preferred prefix from methods
diff --git a/node_modules/negotiator/LICENSE b/node_modules/negotiator/LICENSE
deleted file mode 100644
index ea6b9e2..0000000
--- a/node_modules/negotiator/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2012-2014 Federico Romero
-Copyright (c) 2012-2014 Isaac Z. Schlueter
-Copyright (c) 2014-2015 Douglas Christopher Wilson
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/negotiator/README.md b/node_modules/negotiator/README.md
deleted file mode 100644
index 04a67ff..0000000
--- a/node_modules/negotiator/README.md
+++ /dev/null
@@ -1,203 +0,0 @@
-# negotiator
-
-[![NPM Version][npm-image]][npm-url]
-[![NPM Downloads][downloads-image]][downloads-url]
-[![Node.js Version][node-version-image]][node-version-url]
-[![Build Status][travis-image]][travis-url]
-[![Test Coverage][coveralls-image]][coveralls-url]
-
-An HTTP content negotiator for Node.js
-
-## Installation
-
-```sh
-$ npm install negotiator
-```
-
-## API
-
-```js
-var Negotiator = require('negotiator')
-```
-
-### Accept Negotiation
-
-```js
-availableMediaTypes = ['text/html', 'text/plain', 'application/json']
-
-// The negotiator constructor receives a request object
-negotiator = new Negotiator(request)
-
-// Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8'
-
-negotiator.mediaTypes()
-// -> ['text/html', 'image/jpeg', 'application/*']
-
-negotiator.mediaTypes(availableMediaTypes)
-// -> ['text/html', 'application/json']
-
-negotiator.mediaType(availableMediaTypes)
-// -> 'text/html'
-```
-
-You can check a working example at `examples/accept.js`.
-
-#### Methods
-
-##### mediaType()
-
-Returns the most preferred media type from the client.
-
-##### mediaType(availableMediaType)
-
-Returns the most preferred media type from a list of available media types.
-
-##### mediaTypes()
-
-Returns an array of preferred media types ordered by the client preference.
-
-##### mediaTypes(availableMediaTypes)
-
-Returns an array of preferred media types ordered by priority from a list of
-available media types.
-
-### Accept-Language Negotiation
-
-```js
-negotiator = new Negotiator(request)
-
-availableLanguages = ['en', 'es', 'fr']
-
-// Let's say Accept-Language header is 'en;q=0.8, es, pt'
-
-negotiator.languages()
-// -> ['es', 'pt', 'en']
-
-negotiator.languages(availableLanguages)
-// -> ['es', 'en']
-
-language = negotiator.language(availableLanguages)
-// -> 'es'
-```
-
-You can check a working example at `examples/language.js`.
-
-#### Methods
-
-##### language()
-
-Returns the most preferred language from the client.
-
-##### language(availableLanguages)
-
-Returns the most preferred language from a list of available languages.
-
-##### languages()
-
-Returns an array of preferred languages ordered by the client preference.
-
-##### languages(availableLanguages)
-
-Returns an array of preferred languages ordered by priority from a list of
-available languages.
-
-### Accept-Charset Negotiation
-
-```js
-availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5']
-
-negotiator = new Negotiator(request)
-
-// Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2'
-
-negotiator.charsets()
-// -> ['utf-8', 'iso-8859-1', 'utf-7']
-
-negotiator.charsets(availableCharsets)
-// -> ['utf-8', 'iso-8859-1']
-
-negotiator.charset(availableCharsets)
-// -> 'utf-8'
-```
-
-You can check a working example at `examples/charset.js`.
-
-#### Methods
-
-##### charset()
-
-Returns the most preferred charset from the client.
-
-##### charset(availableCharsets)
-
-Returns the most preferred charset from a list of available charsets.
-
-##### charsets()
-
-Returns an array of preferred charsets ordered by the client preference.
-
-##### charsets(availableCharsets)
-
-Returns an array of preferred charsets ordered by priority from a list of
-available charsets.
-
-### Accept-Encoding Negotiation
-
-```js
-availableEncodings = ['identity', 'gzip']
-
-negotiator = new Negotiator(request)
-
-// Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5'
-
-negotiator.encodings()
-// -> ['gzip', 'identity', 'compress']
-
-negotiator.encodings(availableEncodings)
-// -> ['gzip', 'identity']
-
-negotiator.encoding(availableEncodings)
-// -> 'gzip'
-```
-
-You can check a working example at `examples/encoding.js`.
-
-#### Methods
-
-##### encoding()
-
-Returns the most preferred encoding from the client.
-
-##### encoding(availableEncodings)
-
-Returns the most preferred encoding from a list of available encodings.
-
-##### encodings()
-
-Returns an array of preferred encodings ordered by the client preference.
-
-##### encodings(availableEncodings)
-
-Returns an array of preferred encodings ordered by priority from a list of
-available encodings.
-
-## See Also
-
-The [accepts](https://npmjs.org/package/accepts#readme) module builds on
-this module and provides an alternative interface, mime type validation,
-and more.
-
-## License
-
-[MIT](LICENSE)
-
-[npm-image]: https://img.shields.io/npm/v/negotiator.svg
-[npm-url]: https://npmjs.org/package/negotiator
-[node-version-image]: https://img.shields.io/node/v/negotiator.svg
-[node-version-url]: https://nodejs.org/en/download/
-[travis-image]: https://img.shields.io/travis/jshttp/negotiator/master.svg
-[travis-url]: https://travis-ci.org/jshttp/negotiator
-[coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg
-[coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master
-[downloads-image]: https://img.shields.io/npm/dm/negotiator.svg
-[downloads-url]: https://npmjs.org/package/negotiator
diff --git a/node_modules/negotiator/index.js b/node_modules/negotiator/index.js
deleted file mode 100644
index 8d4f6a2..0000000
--- a/node_modules/negotiator/index.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/*!
- * negotiator
- * Copyright(c) 2012 Federico Romero
- * Copyright(c) 2012-2014 Isaac Z. Schlueter
- * Copyright(c) 2015 Douglas Christopher Wilson
- * MIT Licensed
- */
-
-'use strict';
-
-/**
- * Cached loaded submodules.
- * @private
- */
-
-var modules = Object.create(null);
-
-/**
- * Module exports.
- * @public
- */
-
-module.exports = Negotiator;
-module.exports.Negotiator = Negotiator;
-
-/**
- * Create a Negotiator instance from a request.
- * @param {object} request
- * @public
- */
-
-function Negotiator(request) {
- if (!(this instanceof Negotiator)) {
- return new Negotiator(request);
- }
-
- this.request = request;
-}
-
-Negotiator.prototype.charset = function charset(available) {
- var set = this.charsets(available);
- return set && set[0];
-};
-
-Negotiator.prototype.charsets = function charsets(available) {
- var preferredCharsets = loadModule('charset').preferredCharsets;
- return preferredCharsets(this.request.headers['accept-charset'], available);
-};
-
-Negotiator.prototype.encoding = function encoding(available) {
- var set = this.encodings(available);
- return set && set[0];
-};
-
-Negotiator.prototype.encodings = function encodings(available) {
- var preferredEncodings = loadModule('encoding').preferredEncodings;
- return preferredEncodings(this.request.headers['accept-encoding'], available);
-};
-
-Negotiator.prototype.language = function language(available) {
- var set = this.languages(available);
- return set && set[0];
-};
-
-Negotiator.prototype.languages = function languages(available) {
- var preferredLanguages = loadModule('language').preferredLanguages;
- return preferredLanguages(this.request.headers['accept-language'], available);
-};
-
-Negotiator.prototype.mediaType = function mediaType(available) {
- var set = this.mediaTypes(available);
- return set && set[0];
-};
-
-Negotiator.prototype.mediaTypes = function mediaTypes(available) {
- var preferredMediaTypes = loadModule('mediaType').preferredMediaTypes;
- return preferredMediaTypes(this.request.headers.accept, available);
-};
-
-// Backwards compatibility
-Negotiator.prototype.preferredCharset = Negotiator.prototype.charset;
-Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets;
-Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding;
-Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings;
-Negotiator.prototype.preferredLanguage = Negotiator.prototype.language;
-Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages;
-Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType;
-Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes;
-
-/**
- * Load the given module.
- * @private
- */
-
-function loadModule(moduleName) {
- var module = modules[moduleName];
-
- if (module !== undefined) {
- return module;
- }
-
- // This uses a switch for static require analysis
- switch (moduleName) {
- case 'charset':
- module = require('./lib/charset');
- break;
- case 'encoding':
- module = require('./lib/encoding');
- break;
- case 'language':
- module = require('./lib/language');
- break;
- case 'mediaType':
- module = require('./lib/mediaType');
- break;
- default:
- throw new Error('Cannot find module \'' + moduleName + '\'');
- }
-
- // Store to prevent invoking require()
- modules[moduleName] = module;
-
- return module;
-}
diff --git a/node_modules/negotiator/lib/charset.js b/node_modules/negotiator/lib/charset.js
deleted file mode 100644
index ac4217b..0000000
--- a/node_modules/negotiator/lib/charset.js
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * negotiator
- * Copyright(c) 2012 Isaac Z. Schlueter
- * Copyright(c) 2014 Federico Romero
- * Copyright(c) 2014-2015 Douglas Christopher Wilson
- * MIT Licensed
- */
-
-'use strict';
-
-/**
- * Module exports.
- * @public
- */
-
-module.exports = preferredCharsets;
-module.exports.preferredCharsets = preferredCharsets;
-
-/**
- * Module variables.
- * @private
- */
-
-var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
-
-/**
- * Parse the Accept-Charset header.
- * @private
- */
-
-function parseAcceptCharset(accept) {
- var accepts = accept.split(',');
-
- for (var i = 0, j = 0; i < accepts.length; i++) {
- var charset = parseCharset(accepts[i].trim(), i);
-
- if (charset) {
- accepts[j++] = charset;
- }
- }
-
- // trim accepts
- accepts.length = j;
-
- return accepts;
-}
-
-/**
- * Parse a charset from the Accept-Charset header.
- * @private
- */
-
-function parseCharset(str, i) {
- var match = simpleCharsetRegExp.exec(str);
- if (!match) return null;
-
- var charset = match[1];
- var q = 1;
- if (match[2]) {
- var params = match[2].split(';')
- for (var i = 0; i < params.length; i ++) {
- var p = params[i].trim().split('=');
- if (p[0] === 'q') {
- q = parseFloat(p[1]);
- break;
- }
- }
- }
-
- return {
- charset: charset,
- q: q,
- i: i
- };
-}
-
-/**
- * Get the priority of a charset.
- * @private
- */
-
-function getCharsetPriority(charset, accepted, index) {
- var priority = {o: -1, q: 0, s: 0};
-
- for (var i = 0; i < accepted.length; i++) {
- var spec = specify(charset, accepted[i], index);
-
- if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
- priority = spec;
- }
- }
-
- return priority;
-}
-
-/**
- * Get the specificity of the charset.
- * @private
- */
-
-function specify(charset, spec, index) {
- var s = 0;
- if(spec.charset.toLowerCase() === charset.toLowerCase()){
- s |= 1;
- } else if (spec.charset !== '*' ) {
- return null
- }
-
- return {
- i: index,
- o: spec.i,
- q: spec.q,
- s: s
- }
-}
-
-/**
- * Get the preferred charsets from an Accept-Charset header.
- * @public
- */
-
-function preferredCharsets(accept, provided) {
- // RFC 2616 sec 14.2: no header = *
- var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || '');
-
- if (!provided) {
- // sorted list of all charsets
- return accepts
- .filter(isQuality)
- .sort(compareSpecs)
- .map(getFullCharset);
- }
-
- var priorities = provided.map(function getPriority(type, index) {
- return getCharsetPriority(type, accepts, index);
- });
-
- // sorted list of accepted charsets
- return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) {
- return provided[priorities.indexOf(priority)];
- });
-}
-
-/**
- * Compare two specs.
- * @private
- */
-
-function compareSpecs(a, b) {
- return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
-}
-
-/**
- * Get full charset string.
- * @private
- */
-
-function getFullCharset(spec) {
- return spec.charset;
-}
-
-/**
- * Check if a spec has any quality.
- * @private
- */
-
-function isQuality(spec) {
- return spec.q > 0;
-}
diff --git a/node_modules/negotiator/lib/encoding.js b/node_modules/negotiator/lib/encoding.js
deleted file mode 100644
index 70ac3de..0000000
--- a/node_modules/negotiator/lib/encoding.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- * negotiator
- * Copyright(c) 2012 Isaac Z. Schlueter
- * Copyright(c) 2014 Federico Romero
- * Copyright(c) 2014-2015 Douglas Christopher Wilson
- * MIT Licensed
- */
-
-'use strict';
-
-/**
- * Module exports.
- * @public
- */
-
-module.exports = preferredEncodings;
-module.exports.preferredEncodings = preferredEncodings;
-
-/**
- * Module variables.
- * @private
- */
-
-var simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
-
-/**
- * Parse the Accept-Encoding header.
- * @private
- */
-
-function parseAcceptEncoding(accept) {
- var accepts = accept.split(',');
- var hasIdentity = false;
- var minQuality = 1;
-
- for (var i = 0, j = 0; i < accepts.length; i++) {
- var encoding = parseEncoding(accepts[i].trim(), i);
-
- if (encoding) {
- accepts[j++] = encoding;
- hasIdentity = hasIdentity || specify('identity', encoding);
- minQuality = Math.min(minQuality, encoding.q || 1);
- }
- }
-
- if (!hasIdentity) {
- /*
- * If identity doesn't explicitly appear in the accept-encoding header,
- * it's added to the list of acceptable encoding with the lowest q
- */
- accepts[j++] = {
- encoding: 'identity',
- q: minQuality,
- i: i
- };
- }
-
- // trim accepts
- accepts.length = j;
-
- return accepts;
-}
-
-/**
- * Parse an encoding from the Accept-Encoding header.
- * @private
- */
-
-function parseEncoding(str, i) {
- var match = simpleEncodingRegExp.exec(str);
- if (!match) return null;
-
- var encoding = match[1];
- var q = 1;
- if (match[2]) {
- var params = match[2].split(';');
- for (var i = 0; i < params.length; i ++) {
- var p = params[i].trim().split('=');
- if (p[0] === 'q') {
- q = parseFloat(p[1]);
- break;
- }
- }
- }
-
- return {
- encoding: encoding,
- q: q,
- i: i
- };
-}
-
-/**
- * Get the priority of an encoding.
- * @private
- */
-
-function getEncodingPriority(encoding, accepted, index) {
- var priority = {o: -1, q: 0, s: 0};
-
- for (var i = 0; i < accepted.length; i++) {
- var spec = specify(encoding, accepted[i], index);
-
- if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
- priority = spec;
- }
- }
-
- return priority;
-}
-
-/**
- * Get the specificity of the encoding.
- * @private
- */
-
-function specify(encoding, spec, index) {
- var s = 0;
- if(spec.encoding.toLowerCase() === encoding.toLowerCase()){
- s |= 1;
- } else if (spec.encoding !== '*' ) {
- return null
- }
-
- return {
- i: index,
- o: spec.i,
- q: spec.q,
- s: s
- }
-};
-
-/**
- * Get the preferred encodings from an Accept-Encoding header.
- * @public
- */
-
-function preferredEncodings(accept, provided) {
- var accepts = parseAcceptEncoding(accept || '');
-
- if (!provided) {
- // sorted list of all encodings
- return accepts
- .filter(isQuality)
- .sort(compareSpecs)
- .map(getFullEncoding);
- }
-
- var priorities = provided.map(function getPriority(type, index) {
- return getEncodingPriority(type, accepts, index);
- });
-
- // sorted list of accepted encodings
- return priorities.filter(isQuality).sort(compareSpecs).map(function getEncoding(priority) {
- return provided[priorities.indexOf(priority)];
- });
-}
-
-/**
- * Compare two specs.
- * @private
- */
-
-function compareSpecs(a, b) {
- return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
-}
-
-/**
- * Get full encoding string.
- * @private
- */
-
-function getFullEncoding(spec) {
- return spec.encoding;
-}
-
-/**
- * Check if a spec has any quality.
- * @private
- */
-
-function isQuality(spec) {
- return spec.q > 0;
-}
diff --git a/node_modules/negotiator/lib/language.js b/node_modules/negotiator/lib/language.js
deleted file mode 100644
index 1bd2d0e..0000000
--- a/node_modules/negotiator/lib/language.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * negotiator
- * Copyright(c) 2012 Isaac Z. Schlueter
- * Copyright(c) 2014 Federico Romero
- * Copyright(c) 2014-2015 Douglas Christopher Wilson
- * MIT Licensed
- */
-
-'use strict';
-
-/**
- * Module exports.
- * @public
- */
-
-module.exports = preferredLanguages;
-module.exports.preferredLanguages = preferredLanguages;
-
-/**
- * Module variables.
- * @private
- */
-
-var simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
-
-/**
- * Parse the Accept-Language header.
- * @private
- */
-
-function parseAcceptLanguage(accept) {
- var accepts = accept.split(',');
-
- for (var i = 0, j = 0; i < accepts.length; i++) {
- var langauge = parseLanguage(accepts[i].trim(), i);
-
- if (langauge) {
- accepts[j++] = langauge;
- }
- }
-
- // trim accepts
- accepts.length = j;
-
- return accepts;
-}
-
-/**
- * Parse a language from the Accept-Language header.
- * @private
- */
-
-function parseLanguage(str, i) {
- var match = simpleLanguageRegExp.exec(str);
- if (!match) return null;
-
- var prefix = match[1],
- suffix = match[2],
- full = prefix;
-
- if (suffix) full += "-" + suffix;
-
- var q = 1;
- if (match[3]) {
- var params = match[3].split(';')
- for (var i = 0; i < params.length; i ++) {
- var p = params[i].split('=');
- if (p[0] === 'q') q = parseFloat(p[1]);
- }
- }
-
- return {
- prefix: prefix,
- suffix: suffix,
- q: q,
- i: i,
- full: full
- };
-}
-
-/**
- * Get the priority of a language.
- * @private
- */
-
-function getLanguagePriority(language, accepted, index) {
- var priority = {o: -1, q: 0, s: 0};
-
- for (var i = 0; i < accepted.length; i++) {
- var spec = specify(language, accepted[i], index);
-
- if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
- priority = spec;
- }
- }
-
- return priority;
-}
-
-/**
- * Get the specificity of the language.
- * @private
- */
-
-function specify(language, spec, index) {
- var p = parseLanguage(language)
- if (!p) return null;
- var s = 0;
- if(spec.full.toLowerCase() === p.full.toLowerCase()){
- s |= 4;
- } else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) {
- s |= 2;
- } else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) {
- s |= 1;
- } else if (spec.full !== '*' ) {
- return null
- }
-
- return {
- i: index,
- o: spec.i,
- q: spec.q,
- s: s
- }
-};
-
-/**
- * Get the preferred languages from an Accept-Language header.
- * @public
- */
-
-function preferredLanguages(accept, provided) {
- // RFC 2616 sec 14.4: no header = *
- var accepts = parseAcceptLanguage(accept === undefined ? '*' : accept || '');
-
- if (!provided) {
- // sorted list of all languages
- return accepts
- .filter(isQuality)
- .sort(compareSpecs)
- .map(getFullLanguage);
- }
-
- var priorities = provided.map(function getPriority(type, index) {
- return getLanguagePriority(type, accepts, index);
- });
-
- // sorted list of accepted languages
- return priorities.filter(isQuality).sort(compareSpecs).map(function getLanguage(priority) {
- return provided[priorities.indexOf(priority)];
- });
-}
-
-/**
- * Compare two specs.
- * @private
- */
-
-function compareSpecs(a, b) {
- return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
-}
-
-/**
- * Get full language string.
- * @private
- */
-
-function getFullLanguage(spec) {
- return spec.full;
-}
-
-/**
- * Check if a spec has any quality.
- * @private
- */
-
-function isQuality(spec) {
- return spec.q > 0;
-}
diff --git a/node_modules/negotiator/lib/mediaType.js b/node_modules/negotiator/lib/mediaType.js
deleted file mode 100644
index 67309dd..0000000
--- a/node_modules/negotiator/lib/mediaType.js
+++ /dev/null
@@ -1,294 +0,0 @@
-/**
- * negotiator
- * Copyright(c) 2012 Isaac Z. Schlueter
- * Copyright(c) 2014 Federico Romero
- * Copyright(c) 2014-2015 Douglas Christopher Wilson
- * MIT Licensed
- */
-
-'use strict';
-
-/**
- * Module exports.
- * @public
- */
-
-module.exports = preferredMediaTypes;
-module.exports.preferredMediaTypes = preferredMediaTypes;
-
-/**
- * Module variables.
- * @private
- */
-
-var simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;
-
-/**
- * Parse the Accept header.
- * @private
- */
-
-function parseAccept(accept) {
- var accepts = splitMediaTypes(accept);
-
- for (var i = 0, j = 0; i < accepts.length; i++) {
- var mediaType = parseMediaType(accepts[i].trim(), i);
-
- if (mediaType) {
- accepts[j++] = mediaType;
- }
- }
-
- // trim accepts
- accepts.length = j;
-
- return accepts;
-}
-
-/**
- * Parse a media type from the Accept header.
- * @private
- */
-
-function parseMediaType(str, i) {
- var match = simpleMediaTypeRegExp.exec(str);
- if (!match) return null;
-
- var params = Object.create(null);
- var q = 1;
- var subtype = match[2];
- var type = match[1];
-
- if (match[3]) {
- var kvps = splitParameters(match[3]).map(splitKeyValuePair);
-
- for (var j = 0; j < kvps.length; j++) {
- var pair = kvps[j];
- var key = pair[0].toLowerCase();
- var val = pair[1];
-
- // get the value, unwrapping quotes
- var value = val && val[0] === '"' && val[val.length - 1] === '"'
- ? val.substr(1, val.length - 2)
- : val;
-
- if (key === 'q') {
- q = parseFloat(value);
- break;
- }
-
- // store parameter
- params[key] = value;
- }
- }
-
- return {
- type: type,
- subtype: subtype,
- params: params,
- q: q,
- i: i
- };
-}
-
-/**
- * Get the priority of a media type.
- * @private
- */
-
-function getMediaTypePriority(type, accepted, index) {
- var priority = {o: -1, q: 0, s: 0};
-
- for (var i = 0; i < accepted.length; i++) {
- var spec = specify(type, accepted[i], index);
-
- if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
- priority = spec;
- }
- }
-
- return priority;
-}
-
-/**
- * Get the specificity of the media type.
- * @private
- */
-
-function specify(type, spec, index) {
- var p = parseMediaType(type);
- var s = 0;
-
- if (!p) {
- return null;
- }
-
- if(spec.type.toLowerCase() == p.type.toLowerCase()) {
- s |= 4
- } else if(spec.type != '*') {
- return null;
- }
-
- if(spec.subtype.toLowerCase() == p.subtype.toLowerCase()) {
- s |= 2
- } else if(spec.subtype != '*') {
- return null;
- }
-
- var keys = Object.keys(spec.params);
- if (keys.length > 0) {
- if (keys.every(function (k) {
- return spec.params[k] == '*' || (spec.params[k] || '').toLowerCase() == (p.params[k] || '').toLowerCase();
- })) {
- s |= 1
- } else {
- return null
- }
- }
-
- return {
- i: index,
- o: spec.i,
- q: spec.q,
- s: s,
- }
-}
-
-/**
- * Get the preferred media types from an Accept header.
- * @public
- */
-
-function preferredMediaTypes(accept, provided) {
- // RFC 2616 sec 14.2: no header = */*
- var accepts = parseAccept(accept === undefined ? '*/*' : accept || '');
-
- if (!provided) {
- // sorted list of all types
- return accepts
- .filter(isQuality)
- .sort(compareSpecs)
- .map(getFullType);
- }
-
- var priorities = provided.map(function getPriority(type, index) {
- return getMediaTypePriority(type, accepts, index);
- });
-
- // sorted list of accepted types
- return priorities.filter(isQuality).sort(compareSpecs).map(function getType(priority) {
- return provided[priorities.indexOf(priority)];
- });
-}
-
-/**
- * Compare two specs.
- * @private
- */
-
-function compareSpecs(a, b) {
- return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
-}
-
-/**
- * Get full type string.
- * @private
- */
-
-function getFullType(spec) {
- return spec.type + '/' + spec.subtype;
-}
-
-/**
- * Check if a spec has any quality.
- * @private
- */
-
-function isQuality(spec) {
- return spec.q > 0;
-}
-
-/**
- * Count the number of quotes in a string.
- * @private
- */
-
-function quoteCount(string) {
- var count = 0;
- var index = 0;
-
- while ((index = string.indexOf('"', index)) !== -1) {
- count++;
- index++;
- }
-
- return count;
-}
-
-/**
- * Split a key value pair.
- * @private
- */
-
-function splitKeyValuePair(str) {
- var index = str.indexOf('=');
- var key;
- var val;
-
- if (index === -1) {
- key = str;
- } else {
- key = str.substr(0, index);
- val = str.substr(index + 1);
- }
-
- return [key, val];
-}
-
-/**
- * Split an Accept header into media types.
- * @private
- */
-
-function splitMediaTypes(accept) {
- var accepts = accept.split(',');
-
- for (var i = 1, j = 0; i < accepts.length; i++) {
- if (quoteCount(accepts[j]) % 2 == 0) {
- accepts[++j] = accepts[i];
- } else {
- accepts[j] += ',' + accepts[i];
- }
- }
-
- // trim accepts
- accepts.length = j + 1;
-
- return accepts;
-}
-
-/**
- * Split a string of parameters.
- * @private
- */
-
-function splitParameters(str) {
- var parameters = str.split(';');
-
- for (var i = 1, j = 0; i < parameters.length; i++) {
- if (quoteCount(parameters[j]) % 2 == 0) {
- parameters[++j] = parameters[i];
- } else {
- parameters[j] += ';' + parameters[i];
- }
- }
-
- // trim parameters
- parameters.length = j + 1;
-
- for (var i = 0; i < parameters.length; i++) {
- parameters[i] = parameters[i].trim();
- }
-
- return parameters;
-}
diff --git a/node_modules/negotiator/package.json b/node_modules/negotiator/package.json
deleted file mode 100644
index b2382d5..0000000
--- a/node_modules/negotiator/package.json
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "_from": "negotiator@0.6.1",
- "_id": "negotiator@0.6.1",
- "_inBundle": false,
- "_integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=",
- "_location": "/negotiator",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "negotiator@0.6.1",
- "name": "negotiator",
- "escapedName": "negotiator",
- "rawSpec": "0.6.1",
- "saveSpec": null,
- "fetchSpec": "0.6.1"
- },
- "_requiredBy": [
- "/accepts"
- ],
- "_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
- "_shasum": "2b327184e8992101177b28563fb5e7102acd0ca9",
- "_spec": "negotiator@0.6.1",
- "_where": "/home/marvin/IdeaProjects/untitled/node_modules/accepts",
- "bugs": {
- "url": "https://github.com/jshttp/negotiator/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Douglas Christopher Wilson",
- "email": "doug@somethingdoug.com"
- },
- {
- "name": "Federico Romero",
- "email": "federico.romero@outboxlabs.com"
- },
- {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me",
- "url": "http://blog.izs.me/"
- }
- ],
- "deprecated": false,
- "description": "HTTP content negotiation",
- "devDependencies": {
- "istanbul": "0.4.3",
- "mocha": "~1.21.5"
- },
- "engines": {
- "node": ">= 0.6"
- },
- "files": [
- "lib/",
- "HISTORY.md",
- "LICENSE",
- "index.js",
- "README.md"
- ],
- "homepage": "https://github.com/jshttp/negotiator#readme",
- "keywords": [
- "http",
- "content negotiation",
- "accept",
- "accept-language",
- "accept-encoding",
- "accept-charset"
- ],
- "license": "MIT",
- "name": "negotiator",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/jshttp/negotiator.git"
- },
- "scripts": {
- "test": "mocha --reporter spec --check-leaks --bail test/",
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
- "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
- },
- "version": "0.6.1"
-}