Merge pull request #887 from Larry850806/master

[FIX] Make description and example better
This commit is contained in:
Angelos Chalaris
2018-12-04 08:51:21 +02:00
committed by GitHub

View File

@ -1,13 +1,13 @@
### isValidJSON
Checks if the provided argument is a valid JSON.
Checks if the provided string is a valid JSON.
Use `JSON.parse()` and a `try... catch` block to check if the provided argument is a valid JSON.
Use `JSON.parse()` and a `try... catch` block to check if the provided string is a valid JSON.
```js
const isValidJSON = obj => {
const isValidJSON = str => {
try {
JSON.parse(obj);
JSON.parse(str);
return true;
} catch (e) {
return false;