add isArrayLike and isValidJSON
This commit is contained in:
21
snippets/isValidJSON.md
Normal file
21
snippets/isValidJSON.md
Normal file
@ -0,0 +1,21 @@
|
||||
### isValidJSON
|
||||
|
||||
Checks if the provided argument is an valid JSON.
|
||||
|
||||
|
||||
|
||||
```js
|
||||
const arr = (obj) => {
|
||||
try{
|
||||
JSON.parse(obj);
|
||||
return true;
|
||||
}
|
||||
catch(e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user