Detailansicht verbessert
This commit is contained in:
		
							
								
								
									
										70
									
								
								express-server/node_modules/strip-json-comments/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								express-server/node_modules/strip-json-comments/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var singleComment = 1;
 | 
			
		||||
var multiComment = 2;
 | 
			
		||||
 | 
			
		||||
function stripWithoutWhitespace() {
 | 
			
		||||
	return '';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function stripWithWhitespace(str, start, end) {
 | 
			
		||||
	return str.slice(start, end).replace(/\S/g, ' ');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = function (str, opts) {
 | 
			
		||||
	opts = opts || {};
 | 
			
		||||
 | 
			
		||||
	var currentChar;
 | 
			
		||||
	var nextChar;
 | 
			
		||||
	var insideString = false;
 | 
			
		||||
	var insideComment = false;
 | 
			
		||||
	var offset = 0;
 | 
			
		||||
	var ret = '';
 | 
			
		||||
	var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
 | 
			
		||||
 | 
			
		||||
	for (var i = 0; i < str.length; i++) {
 | 
			
		||||
		currentChar = str[i];
 | 
			
		||||
		nextChar = str[i + 1];
 | 
			
		||||
 | 
			
		||||
		if (!insideComment && currentChar === '"') {
 | 
			
		||||
			var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
 | 
			
		||||
			if (!escaped) {
 | 
			
		||||
				insideString = !insideString;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (insideString) {
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!insideComment && currentChar + nextChar === '//') {
 | 
			
		||||
			ret += str.slice(offset, i);
 | 
			
		||||
			offset = i;
 | 
			
		||||
			insideComment = singleComment;
 | 
			
		||||
			i++;
 | 
			
		||||
		} else if (insideComment === singleComment && currentChar + nextChar === '\r\n') {
 | 
			
		||||
			i++;
 | 
			
		||||
			insideComment = false;
 | 
			
		||||
			ret += strip(str, offset, i);
 | 
			
		||||
			offset = i;
 | 
			
		||||
			continue;
 | 
			
		||||
		} else if (insideComment === singleComment && currentChar === '\n') {
 | 
			
		||||
			insideComment = false;
 | 
			
		||||
			ret += strip(str, offset, i);
 | 
			
		||||
			offset = i;
 | 
			
		||||
		} else if (!insideComment && currentChar + nextChar === '/*') {
 | 
			
		||||
			ret += str.slice(offset, i);
 | 
			
		||||
			offset = i;
 | 
			
		||||
			insideComment = multiComment;
 | 
			
		||||
			i++;
 | 
			
		||||
			continue;
 | 
			
		||||
		} else if (insideComment === multiComment && currentChar + nextChar === '*/') {
 | 
			
		||||
			i++;
 | 
			
		||||
			insideComment = false;
 | 
			
		||||
			ret += strip(str, offset, i + 1);
 | 
			
		||||
			offset = i + 1;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										21
									
								
								express-server/node_modules/strip-json-comments/license
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								express-server/node_modules/strip-json-comments/license
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
							
								
								
									
										74
									
								
								express-server/node_modules/strip-json-comments/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								express-server/node_modules/strip-json-comments/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
{
 | 
			
		||||
  "_from": "strip-json-comments@~2.0.1",
 | 
			
		||||
  "_id": "strip-json-comments@2.0.1",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
 | 
			
		||||
  "_location": "/strip-json-comments",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "range",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "strip-json-comments@~2.0.1",
 | 
			
		||||
    "name": "strip-json-comments",
 | 
			
		||||
    "escapedName": "strip-json-comments",
 | 
			
		||||
    "rawSpec": "~2.0.1",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "~2.0.1"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/rc"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
 | 
			
		||||
  "_shasum": "3c531942e908c2697c0ec344858c286c7ca0a60a",
 | 
			
		||||
  "_spec": "strip-json-comments@~2.0.1",
 | 
			
		||||
  "_where": "D:\\5CHITM\\Diplomarbeit\\SmartShopper\\SmartShopper\\express-server\\node_modules\\rc",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Sindre Sorhus",
 | 
			
		||||
    "email": "sindresorhus@gmail.com",
 | 
			
		||||
    "url": "sindresorhus.com"
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/sindresorhus/strip-json-comments/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "bundleDependencies": false,
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "Strip comments from JSON. Lets you use comments in your JSON files!",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "ava": "*",
 | 
			
		||||
    "xo": "*"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=0.10.0"
 | 
			
		||||
  },
 | 
			
		||||
  "files": [
 | 
			
		||||
    "index.js"
 | 
			
		||||
  ],
 | 
			
		||||
  "homepage": "https://github.com/sindresorhus/strip-json-comments#readme",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "json",
 | 
			
		||||
    "strip",
 | 
			
		||||
    "remove",
 | 
			
		||||
    "delete",
 | 
			
		||||
    "trim",
 | 
			
		||||
    "comments",
 | 
			
		||||
    "multiline",
 | 
			
		||||
    "parse",
 | 
			
		||||
    "config",
 | 
			
		||||
    "configuration",
 | 
			
		||||
    "conf",
 | 
			
		||||
    "settings",
 | 
			
		||||
    "util",
 | 
			
		||||
    "env",
 | 
			
		||||
    "environment"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "name": "strip-json-comments",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://github.com/sindresorhus/strip-json-comments.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "xo && ava"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "2.0.1"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										64
									
								
								express-server/node_modules/strip-json-comments/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								express-server/node_modules/strip-json-comments/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
# strip-json-comments [](https://travis-ci.org/sindresorhus/strip-json-comments)
 | 
			
		||||
 | 
			
		||||
> Strip comments from JSON. Lets you use comments in your JSON files!
 | 
			
		||||
 | 
			
		||||
This is now possible:
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
{
 | 
			
		||||
	// rainbows
 | 
			
		||||
	"unicorn": /* ❤ */ "cake"
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
It will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source.
 | 
			
		||||
 | 
			
		||||
Also available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ npm install --save strip-json-comments
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
const json = '{/*rainbows*/"unicorn":"cake"}';
 | 
			
		||||
 | 
			
		||||
JSON.parse(stripJsonComments(json));
 | 
			
		||||
//=> {unicorn: 'cake'}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## API
 | 
			
		||||
 | 
			
		||||
### stripJsonComments(input, [options])
 | 
			
		||||
 | 
			
		||||
#### input
 | 
			
		||||
 | 
			
		||||
Type: `string`
 | 
			
		||||
 | 
			
		||||
Accepts a string with JSON and returns a string without comments.
 | 
			
		||||
 | 
			
		||||
#### options
 | 
			
		||||
 | 
			
		||||
##### whitespace
 | 
			
		||||
 | 
			
		||||
Type: `boolean`  
 | 
			
		||||
Default: `true`
 | 
			
		||||
 | 
			
		||||
Replace comments with whitespace instead of stripping them entirely.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Related
 | 
			
		||||
 | 
			
		||||
- [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module
 | 
			
		||||
- [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
 | 
			
		||||
		Reference in New Issue
	
	Block a user