added old data
This commit is contained in:
41
project3/node_modules/strip-json-comments/cli.js
generated
vendored
Executable file
41
project3/node_modules/strip-json-comments/cli.js
generated
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
var strip = require('./strip-json-comments');
|
||||
var input = process.argv[2];
|
||||
|
||||
|
||||
function getStdin(cb) {
|
||||
var ret = '';
|
||||
|
||||
process.stdin.setEncoding('utf8');
|
||||
|
||||
process.stdin.on('data', function (data) {
|
||||
ret += data;
|
||||
});
|
||||
|
||||
process.stdin.on('end', function () {
|
||||
cb(ret);
|
||||
});
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) {
|
||||
console.log('strip-json-comments input-file > output-file');
|
||||
console.log('or');
|
||||
console.log('strip-json-comments < input-file > output-file');
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) {
|
||||
console.log(require('./package').version);
|
||||
return;
|
||||
}
|
||||
|
||||
if (input) {
|
||||
process.stdout.write(strip(fs.readFileSync(input, 'utf8')));
|
||||
return;
|
||||
}
|
||||
|
||||
getStdin(function (data) {
|
||||
process.stdout.write(strip(data));
|
||||
});
|
21
project3/node_modules/strip-json-comments/license
generated
vendored
Normal file
21
project3/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.
|
80
project3/node_modules/strip-json-comments/package.json
generated
vendored
Normal file
80
project3/node_modules/strip-json-comments/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "strip-json-comments@1.0.x",
|
||||
"_id": "strip-json-comments@1.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=",
|
||||
"_location": "/strip-json-comments",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "strip-json-comments@1.0.x",
|
||||
"name": "strip-json-comments",
|
||||
"escapedName": "strip-json-comments",
|
||||
"rawSpec": "1.0.x",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.x"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jshint"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz",
|
||||
"_shasum": "1e15fbcac97d3ee99bf2d73b4c656b082bbafb91",
|
||||
"_spec": "strip-json-comments@1.0.x",
|
||||
"_where": "/home/massiveatoms/Desktop/cs142/project3/node_modules/jshint",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bin": {
|
||||
"strip-json-comments": "cli.js"
|
||||
},
|
||||
"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": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"cli.js",
|
||||
"strip-json-comments.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",
|
||||
"cli",
|
||||
"bin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "strip-json-comments",
|
||||
"name": "strip-json-comments",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/strip-json-comments.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --ui tdd"
|
||||
},
|
||||
"version": "1.0.4"
|
||||
}
|
80
project3/node_modules/strip-json-comments/readme.md
generated
vendored
Normal file
80
project3/node_modules/strip-json-comments/readme.md
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# 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 remove single-line comments `//` and multi-line comments `/**/`.
|
||||
|
||||
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.
|
||||
|
||||
-
|
||||
|
||||
*There's also [`json-comments`](https://npmjs.org/package/json-comments), but it's only for Node.js, inefficient, bloated as it also minifies, and comes with a `require` hook, which is :(*
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save strip-json-comments
|
||||
```
|
||||
|
||||
```sh
|
||||
$ bower install --save strip-json-comments
|
||||
```
|
||||
|
||||
```sh
|
||||
$ component install sindresorhus/strip-json-comments
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var json = '{/*rainbows*/"unicorn":"cake"}';
|
||||
JSON.parse(stripJsonComments(json));
|
||||
//=> {unicorn: 'cake'}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### stripJsonComments(input)
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string`
|
||||
|
||||
Accepts a string with JSON and returns a string without comments.
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```sh
|
||||
$ npm install --global strip-json-comments
|
||||
```
|
||||
|
||||
```sh
|
||||
$ strip-json-comments --help
|
||||
|
||||
strip-json-comments input-file > output-file
|
||||
# or
|
||||
strip-json-comments < input-file > output-file
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [`strip-css-comments`](https://github.com/sindresorhus/strip-css-comments)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
73
project3/node_modules/strip-json-comments/strip-json-comments.js
generated
vendored
Normal file
73
project3/node_modules/strip-json-comments/strip-json-comments.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*!
|
||||
strip-json-comments
|
||||
Strip comments from JSON. Lets you use comments in your JSON files!
|
||||
https://github.com/sindresorhus/strip-json-comments
|
||||
by Sindre Sorhus
|
||||
MIT License
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var singleComment = 1;
|
||||
var multiComment = 2;
|
||||
|
||||
function stripJsonComments(str) {
|
||||
var currentChar;
|
||||
var nextChar;
|
||||
var insideString = false;
|
||||
var insideComment = false;
|
||||
var ret = '';
|
||||
|
||||
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 (!insideComment && !escaped && currentChar === '"') {
|
||||
insideString = !insideString;
|
||||
}
|
||||
}
|
||||
|
||||
if (insideString) {
|
||||
ret += currentChar;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!insideComment && currentChar + nextChar === '//') {
|
||||
insideComment = singleComment;
|
||||
i++;
|
||||
} else if (insideComment === singleComment && currentChar + nextChar === '\r\n') {
|
||||
insideComment = false;
|
||||
i++;
|
||||
ret += currentChar;
|
||||
ret += nextChar;
|
||||
continue;
|
||||
} else if (insideComment === singleComment && currentChar === '\n') {
|
||||
insideComment = false;
|
||||
} else if (!insideComment && currentChar + nextChar === '/*') {
|
||||
insideComment = multiComment;
|
||||
i++;
|
||||
continue;
|
||||
} else if (insideComment === multiComment && currentChar + nextChar === '*/') {
|
||||
insideComment = false;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (insideComment) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ret += currentChar;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = stripJsonComments;
|
||||
} else {
|
||||
window.stripJsonComments = stripJsonComments;
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user