1
0
CompleteNodeJS/notes-app/node_modules/validator/lib/isJSON.js

25 lines
863 B
JavaScript
Raw Normal View History

2019-08-11 18:15:16 +00:00
'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'];