1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = isJSON;
|
7 |
|
8 | var _assertString = _interopRequireDefault(require("./util/assertString"));
|
9 |
|
10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11 |
|
12 | function _typeof(obj) { 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); }
|
13 |
|
14 | function isJSON(str) {
|
15 | (0, _assertString.default)(str);
|
16 |
|
17 | try {
|
18 | var obj = JSON.parse(str);
|
19 | return !!obj && _typeof(obj) === 'object';
|
20 | } catch (e) {
|
21 |
|
22 | }
|
23 |
|
24 | return false;
|
25 | }
|
26 |
|
27 | module.exports = exports.default; |
\ | No newline at end of file |