Detailansicht verbessert
This commit is contained in:
		
							
								
								
									
										94
									
								
								express-server/node_modules/decode-uri-component/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								express-server/node_modules/decode-uri-component/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,94 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var token = '%[a-f0-9]{2}';
 | 
			
		||||
var singleMatcher = new RegExp(token, 'gi');
 | 
			
		||||
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
 | 
			
		||||
 | 
			
		||||
function decodeComponents(components, split) {
 | 
			
		||||
	try {
 | 
			
		||||
		// Try to decode the entire string first
 | 
			
		||||
		return decodeURIComponent(components.join(''));
 | 
			
		||||
	} catch (err) {
 | 
			
		||||
		// Do nothing
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (components.length === 1) {
 | 
			
		||||
		return components;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	split = split || 1;
 | 
			
		||||
 | 
			
		||||
	// Split the array in 2 parts
 | 
			
		||||
	var left = components.slice(0, split);
 | 
			
		||||
	var right = components.slice(split);
 | 
			
		||||
 | 
			
		||||
	return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function decode(input) {
 | 
			
		||||
	try {
 | 
			
		||||
		return decodeURIComponent(input);
 | 
			
		||||
	} catch (err) {
 | 
			
		||||
		var tokens = input.match(singleMatcher);
 | 
			
		||||
 | 
			
		||||
		for (var i = 1; i < tokens.length; i++) {
 | 
			
		||||
			input = decodeComponents(tokens, i).join('');
 | 
			
		||||
 | 
			
		||||
			tokens = input.match(singleMatcher);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return input;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function customDecodeURIComponent(input) {
 | 
			
		||||
	// Keep track of all the replacements and prefill the map with the `BOM`
 | 
			
		||||
	var replaceMap = {
 | 
			
		||||
		'%FE%FF': '\uFFFD\uFFFD',
 | 
			
		||||
		'%FF%FE': '\uFFFD\uFFFD'
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	var match = multiMatcher.exec(input);
 | 
			
		||||
	while (match) {
 | 
			
		||||
		try {
 | 
			
		||||
			// Decode as big chunks as possible
 | 
			
		||||
			replaceMap[match[0]] = decodeURIComponent(match[0]);
 | 
			
		||||
		} catch (err) {
 | 
			
		||||
			var result = decode(match[0]);
 | 
			
		||||
 | 
			
		||||
			if (result !== match[0]) {
 | 
			
		||||
				replaceMap[match[0]] = result;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		match = multiMatcher.exec(input);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
 | 
			
		||||
	replaceMap['%C2'] = '\uFFFD';
 | 
			
		||||
 | 
			
		||||
	var entries = Object.keys(replaceMap);
 | 
			
		||||
 | 
			
		||||
	for (var i = 0; i < entries.length; i++) {
 | 
			
		||||
		// Replace all decoded components
 | 
			
		||||
		var key = entries[i];
 | 
			
		||||
		input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return input;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = function (encodedURI) {
 | 
			
		||||
	if (typeof encodedURI !== 'string') {
 | 
			
		||||
		throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	try {
 | 
			
		||||
		encodedURI = encodedURI.replace(/\+/g, ' ');
 | 
			
		||||
 | 
			
		||||
		// Try the built in decoder first
 | 
			
		||||
		return decodeURIComponent(encodedURI);
 | 
			
		||||
	} catch (err) {
 | 
			
		||||
		// Fallback to a more advanced decoder
 | 
			
		||||
		return customDecodeURIComponent(encodedURI);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										21
									
								
								express-server/node_modules/decode-uri-component/license
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								express-server/node_modules/decode-uri-component/license
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) Sam Verschueren <sam.verschueren@gmail.com> (github.com/SamVerschueren)
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
							
								
								
									
										69
									
								
								express-server/node_modules/decode-uri-component/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								express-server/node_modules/decode-uri-component/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
			
		||||
{
 | 
			
		||||
  "_from": "decode-uri-component@^0.2.0",
 | 
			
		||||
  "_id": "decode-uri-component@0.2.0",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
 | 
			
		||||
  "_location": "/decode-uri-component",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "range",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "decode-uri-component@^0.2.0",
 | 
			
		||||
    "name": "decode-uri-component",
 | 
			
		||||
    "escapedName": "decode-uri-component",
 | 
			
		||||
    "rawSpec": "^0.2.0",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "^0.2.0"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/source-map-resolve"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
 | 
			
		||||
  "_shasum": "eb3913333458775cb84cd1a1fae062106bb87545",
 | 
			
		||||
  "_spec": "decode-uri-component@^0.2.0",
 | 
			
		||||
  "_where": "D:\\5CHITM\\Diplomarbeit\\SmartShopper\\SmartShopper\\express-server\\node_modules\\source-map-resolve",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Sam Verschueren",
 | 
			
		||||
    "email": "sam.verschueren@gmail.com",
 | 
			
		||||
    "url": "github.com/SamVerschueren"
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/SamVerschueren/decode-uri-component/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "bundleDependencies": false,
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "A better decodeURIComponent",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "ava": "^0.17.0",
 | 
			
		||||
    "coveralls": "^2.13.1",
 | 
			
		||||
    "nyc": "^10.3.2",
 | 
			
		||||
    "xo": "^0.16.0"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=0.10"
 | 
			
		||||
  },
 | 
			
		||||
  "files": [
 | 
			
		||||
    "index.js"
 | 
			
		||||
  ],
 | 
			
		||||
  "homepage": "https://github.com/SamVerschueren/decode-uri-component#readme",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "decode",
 | 
			
		||||
    "uri",
 | 
			
		||||
    "component",
 | 
			
		||||
    "decodeuricomponent",
 | 
			
		||||
    "components",
 | 
			
		||||
    "decoder",
 | 
			
		||||
    "url"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "name": "decode-uri-component",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://github.com/SamVerschueren/decode-uri-component.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "coveralls": "nyc report --reporter=text-lcov | coveralls",
 | 
			
		||||
    "test": "xo && nyc ava"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "0.2.0"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										70
									
								
								express-server/node_modules/decode-uri-component/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								express-server/node_modules/decode-uri-component/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
# decode-uri-component
 | 
			
		||||
 | 
			
		||||
[](https://travis-ci.org/SamVerschueren/decode-uri-component) [](https://coveralls.io/github/SamVerschueren/decode-uri-component?branch=master)
 | 
			
		||||
 | 
			
		||||
> A better [decodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Why?
 | 
			
		||||
 | 
			
		||||
- Decodes `+` to a space.
 | 
			
		||||
- Converts the [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) to a [replacement character](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) `<60>`.
 | 
			
		||||
- Does not throw with invalid encoded input.
 | 
			
		||||
- Decodes as much of the string as possible.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ npm install --save decode-uri-component
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
const decodeUriComponent = require('decode-uri-component');
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%25');
 | 
			
		||||
//=> '%'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%');
 | 
			
		||||
//=> '%'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('st%C3%A5le');
 | 
			
		||||
//=> 'ståle'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%st%C3%A5le%');
 | 
			
		||||
//=> '%ståle%'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%%7Bst%C3%A5le%7D%');
 | 
			
		||||
//=> '%{ståle}%'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%7B%ab%%7C%de%%7D');
 | 
			
		||||
//=> '{%ab%|%de%}'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%FE%FF');
 | 
			
		||||
//=> '\uFFFD\uFFFD'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%C2');
 | 
			
		||||
//=> '\uFFFD'
 | 
			
		||||
 | 
			
		||||
decodeUriComponent('%C2%B5');
 | 
			
		||||
//=> 'µ'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## API
 | 
			
		||||
 | 
			
		||||
### decodeUriComponent(encodedURI)
 | 
			
		||||
 | 
			
		||||
#### encodedURI
 | 
			
		||||
 | 
			
		||||
Type: `string`
 | 
			
		||||
 | 
			
		||||
An encoded component of a Uniform Resource Identifier.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
MIT © [Sam Verschueren](https://github.com/SamVerschueren)
 | 
			
		||||
		Reference in New Issue
	
	Block a user