mirror of
https://github.com/r0adkll/sign-android-release
synced 2026-09-30 00:28:38 +00:00
bump jest and make tests pass
This commit is contained in:
+35
-20
@@ -1,19 +1,18 @@
|
||||
# parse-json [](https://travis-ci.org/sindresorhus/parse-json)
|
||||
# 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}';
|
||||
|
||||
|
||||
@@ -28,39 +27,48 @@ SyntaxError: Unexpected token }
|
||||
|
||||
parseJson(json);
|
||||
/*
|
||||
JSONError: Trailing comma in object at 3:1
|
||||
}
|
||||
^
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}'
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json, 'foo.json');
|
||||
/*
|
||||
JSONError: Trailing comma in object in foo.json:3:1
|
||||
}
|
||||
^
|
||||
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 (err) {
|
||||
err.fileName = 'foo.json';
|
||||
throw err;
|
||||
} catch (error) {
|
||||
error.fileName = 'foo.json';
|
||||
throw error;
|
||||
}
|
||||
/*
|
||||
JSONError: Trailing comma in object in foo.json:3:1
|
||||
}
|
||||
^
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' in foo.json
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parseJson(input, [reviver], [filename])
|
||||
### parseJson(string, reviver?, filename?)
|
||||
|
||||
#### input
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
@@ -77,7 +85,14 @@ Type: `string`
|
||||
|
||||
Filename displayed in the error message.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user