blob: 17358880d1c89d9172a2752db97542c40980ffc0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import assertString from './util/assertString';
export default function isJSON(str) {
assertString(str);
try {
var obj = JSON.parse(str);
return !!obj && _typeof(obj) === 'object';
} catch (e) {
/* ignore */
}
return false;
}
|