25 lines
863 B
JavaScript
25 lines
863 B
JavaScript
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
|
||
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||
|
|
||
|
exports.default = isJSON;
|
||
|
|
||
|
var _assertString = require('./util/assertString');
|
||
|
|
||
|
var _assertString2 = _interopRequireDefault(_assertString);
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
function isJSON(str) {
|
||
|
(0, _assertString2.default)(str);
|
||
|
try {
|
||
|
var obj = JSON.parse(str);
|
||
|
return !!obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
|
||
|
} catch (e) {/* ignore */}
|
||
|
return false;
|
||
|
}
|
||
|
module.exports = exports['default'];
|