mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 12:56:01 +00:00
SYNC: Merge pull request #10 from dbgate/feat-chat-compl-api
This commit is contained in:
@@ -386,6 +386,9 @@ export function safeJsonParse(json, defaultValue?, logError = false) {
|
||||
if (_isArray(json) || _isPlainObject(json)) {
|
||||
return json;
|
||||
}
|
||||
if (!json) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(json);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user