bugsplat
Version:
error reporting for js
21 lines • 820 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateResponseBody = validateResponseBody;
const isObject = (val) => typeof val === 'object' && val !== null;
const isString = (val) => typeof val === 'string';
const isNumber = (val) => typeof val === 'number';
const isUndefined = (val) => val === undefined;
function validateResponseBody(response) {
if (!isObject(response)) {
return false;
}
const conditions = [
['success', 'fail'].includes(response['status']),
isNumber(response['current_server_time']),
isString(response['message']),
isString(response['url']) || isUndefined(response['url']),
isNumber(response['crash_id']),
];
return conditions.every(Boolean);
}
//# sourceMappingURL=bugsplat-response.js.map