Add node modules and compiled JavaScript from main (#57)
Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
parent
d893f27da9
commit
7f7e5ba5ea
6750 changed files with 1745644 additions and 10860 deletions
50
node_modules/parse-json/index.js
generated
vendored
Normal file
50
node_modules/parse-json/index.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
'use strict';
|
||||
const errorEx = require('error-ex');
|
||||
const fallback = require('json-parse-even-better-errors');
|
||||
const {default: LinesAndColumns} = require('lines-and-columns');
|
||||
const {codeFrameColumns} = require('@babel/code-frame');
|
||||
|
||||
const JSONError = errorEx('JSONError', {
|
||||
fileName: errorEx.append('in %s'),
|
||||
codeFrame: errorEx.append('\n\n%s\n')
|
||||
});
|
||||
|
||||
module.exports = (string, reviver, filename) => {
|
||||
if (typeof reviver === 'string') {
|
||||
filename = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
return JSON.parse(string, reviver);
|
||||
} catch (error) {
|
||||
fallback(string, reviver);
|
||||
throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
error.message = error.message.replace(/\n/g, '');
|
||||
const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
|
||||
|
||||
const jsonError = new JSONError(error);
|
||||
if (filename) {
|
||||
jsonError.fileName = filename;
|
||||
}
|
||||
|
||||
if (indexMatch && indexMatch.length > 0) {
|
||||
const lines = new LinesAndColumns(string);
|
||||
const index = Number(indexMatch[1]);
|
||||
const location = lines.locationForIndex(index);
|
||||
|
||||
const codeFrame = codeFrameColumns(
|
||||
string,
|
||||
{start: {line: location.line + 1, column: location.column + 1}},
|
||||
{highlightCode: true}
|
||||
);
|
||||
|
||||
jsonError.codeFrame = codeFrame;
|
||||
}
|
||||
|
||||
throw jsonError;
|
||||
}
|
||||
};
|
9
node_modules/parse-json/license
generated
vendored
Normal file
9
node_modules/parse-json/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
45
node_modules/parse-json/package.json
generated
vendored
Normal file
45
node_modules/parse-json/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "parse-json",
|
||||
"version": "5.1.0",
|
||||
"description": "Parse JSON with more helpful errors",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/parse-json",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"vendor"
|
||||
],
|
||||
"keywords": [
|
||||
"parse",
|
||||
"json",
|
||||
"graceful",
|
||||
"error",
|
||||
"message",
|
||||
"humanize",
|
||||
"friendly",
|
||||
"helpful",
|
||||
"string"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"error-ex": "^1.3.1",
|
||||
"json-parse-even-better-errors": "^2.3.0",
|
||||
"lines-and-columns": "^1.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"nyc": "^14.1.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
98
node_modules/parse-json/readme.md
generated
vendored
Normal file
98
node_modules/parse-json/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
# parse-json [](https://travis-ci.com/github/sindresorhus/parse-json)
|
||||
|
||||
> Parse JSON with more helpful errors
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install parse-json
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const parseJson = require('parse-json');
|
||||
|
||||
const json = '{\n\t"foo": true,\n}';
|
||||
|
||||
|
||||
JSON.parse(json);
|
||||
/*
|
||||
undefined:3
|
||||
}
|
||||
^
|
||||
SyntaxError: Unexpected token }
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json);
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}'
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json, 'foo.json');
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' in foo.json
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
|
||||
|
||||
// You can also add the filename at a later point
|
||||
try {
|
||||
parseJson(json);
|
||||
} catch (error) {
|
||||
error.fileName = 'foo.json';
|
||||
throw error;
|
||||
}
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' in foo.json
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parseJson(string, reviver?, filename?)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### reviver
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Prescribes how the value originally produced by parsing is transformed, before being returned. See [`JSON.parse` docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter
|
||||
) for more.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename displayed in the error message.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-parse-json?utm_source=npm-parse-json&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue