This commit is contained in:
eric sciple 2020-01-24 12:30:26 -05:00
parent 00c3b50fca
commit ae5dcb46c8
7331 changed files with 1784502 additions and 0 deletions

46
node_modules/json-parse-better-errors/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,46 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.2"></a>
## [1.0.2](https://github.com/zkat/json-parse-better-errors/compare/v1.0.1...v1.0.2) (2018-03-30)
### Bug Fixes
* **messages:** More friendly messages for non-string ([#1](https://github.com/zkat/json-parse-better-errors/issues/1)) ([a476d42](https://github.com/zkat/json-parse-better-errors/commit/a476d42))
<a name="1.0.1"></a>
## [1.0.1](https://github.com/zkat/json-parse-better-errors/compare/v1.0.0...v1.0.1) (2017-08-16)
### Bug Fixes
* **license:** oops. Forgot to update license.md ([efe2958](https://github.com/zkat/json-parse-better-errors/commit/efe2958))
<a name="1.0.0"></a>
# 1.0.0 (2017-08-15)
### Features
* **init:** Initial Commit ([562c977](https://github.com/zkat/json-parse-better-errors/commit/562c977))
### BREAKING CHANGES
* **init:** This is the first commit!
<a name="0.1.0"></a>
# 0.1.0 (2017-08-15)
### Features
* **init:** Initial Commit ([9dd1a19](https://github.com/zkat/json-parse-better-errors/commit/9dd1a19))

7
node_modules/json-parse-better-errors/LICENSE.md generated vendored Normal file
View file

@ -0,0 +1,7 @@
Copyright 2017 Kat Marchán
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.

46
node_modules/json-parse-better-errors/README.md generated vendored Normal file
View file

@ -0,0 +1,46 @@
# json-parse-better-errors [![npm version](https://img.shields.io/npm/v/json-parse-better-errors.svg)](https://npm.im/json-parse-better-errors) [![license](https://img.shields.io/npm/l/json-parse-better-errors.svg)](https://npm.im/json-parse-better-errors) [![Travis](https://img.shields.io/travis/zkat/json-parse-better-errors.svg)](https://travis-ci.org/zkat/json-parse-better-errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/json-parse-better-errors?svg=true)](https://ci.appveyor.com/project/zkat/json-parse-better-errors) [![Coverage Status](https://coveralls.io/repos/github/zkat/json-parse-better-errors/badge.svg?branch=latest)](https://coveralls.io/github/zkat/json-parse-better-errors?branch=latest)
[`json-parse-better-errors`](https://github.com/zkat/json-parse-better-errors) is a Node.js library for
getting nicer errors out of `JSON.parse()`, including context and position of the parse errors.
## Install
`$ npm install --save json-parse-better-errors`
## Table of Contents
* [Example](#example)
* [Features](#features)
* [Contributing](#contributing)
* [API](#api)
* [`parse`](#parse)
### Example
```javascript
const parseJson = require('json-parse-better-errors')
parseJson('"foo"')
parseJson('garbage') // more useful error message
```
### Features
* Like JSON.parse, but the errors are better.
### Contributing
The npm team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The [Contributor Guide](CONTRIBUTING.md) has all the information you need for everything from reporting bugs to contributing entire new features. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.
All participants and maintainers in this project are expected to follow [Code of Conduct](CODE_OF_CONDUCT.md), and just generally be excellent to each other.
Please refer to the [Changelog](CHANGELOG.md) for project history details, too.
Happy hacking!
### API
#### <a name="parse"></a> `> parse(txt, ?reviver, ?context=20)`
Works just like `JSON.parse`, but will include a bit more information when an
error happens.

38
node_modules/json-parse-better-errors/index.js generated vendored Normal file
View file

@ -0,0 +1,38 @@
'use strict'
module.exports = parseJson
function parseJson (txt, reviver, context) {
context = context || 20
try {
return JSON.parse(txt, reviver)
} catch (e) {
if (typeof txt !== 'string') {
const isEmptyArray = Array.isArray(txt) && txt.length === 0
const errorMessage = 'Cannot parse ' +
(isEmptyArray ? 'an empty array' : String(txt))
throw new TypeError(errorMessage)
}
const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i)
const errIdx = syntaxErr
? +syntaxErr[1]
: e.message.match(/^Unexpected end of JSON.*/i)
? txt.length - 1
: null
if (errIdx != null) {
const start = errIdx <= context
? 0
: errIdx - context
const end = errIdx + context >= txt.length
? txt.length
: errIdx + context
e.message += ` while parsing near '${
start === 0 ? '' : '...'
}${txt.slice(start, end)}${
end === txt.length ? '' : '...'
}'`
} else {
e.message += ` while parsing '${txt.slice(0, context * 2)}'`
}
throw e
}
}

49
node_modules/json-parse-better-errors/package.json generated vendored Normal file
View file

@ -0,0 +1,49 @@
{
"name": "json-parse-better-errors",
"version": "1.0.2",
"description": "JSON.parse with context information on error",
"main": "index.js",
"files": [
"*.js"
],
"scripts": {
"prerelease": "npm t",
"postrelease": "npm publish && git push --follow-tags",
"pretest": "standard",
"release": "standard-version -s",
"test": "tap -J --coverage test/*.js",
"update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
"update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
},
"repository": "https://github.com/zkat/json-parse-better-errors",
"keywords": [
"JSON",
"parser"
],
"author": {
"name": "Kat Marchán",
"email": "kzm@zkat.tech",
"twitter": "maybekatz"
},
"license": "MIT",
"devDependencies": {
"nyc": "^10.3.2",
"standard": "^9.0.2",
"standard-version": "^4.1.0",
"tap": "^10.3.3",
"weallbehave": "^1.2.0",
"weallcontribute": "^1.0.8"
},
"config": {
"nyc": {
"exclude": [
"node_modules/**",
"test/**"
]
}
}
,"_resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz"
,"_integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
,"_from": "json-parse-better-errors@1.0.2"
}