@arizeai/phoenix-client
Version:
A client for the Phoenix API
18 lines • 485 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.safelyParseJSON = safelyParseJSON;
/**
* Safely parse a JSON string
*
* @param str - The string to parse
* @returns An object containing both the parsed JSON and the error if there was one
*/
function safelyParseJSON(str) {
try {
return { json: JSON.parse(str) };
}
catch (e) {
return { json: null, parseError: e };
}
}
//# sourceMappingURL=safelyParseJSON.js.map