Use toJSON() if available when running Zotero.debug() on objects

This commit is contained in:
Dan Stillman 2019-06-07 21:22:52 -04:00
parent b793c0c406
commit 368b057104

View file

@ -1414,8 +1414,8 @@ Zotero.Utilities = {
return '' + obj; return '' + obj;
} }
} }
else if (type == 'string') { else if (type == 'string' || typeof obj.toJSON == 'function') {
return JSON.stringify(obj); return JSON.stringify(obj, false, ' ');
} }
else if (type == 'function') { else if (type == 'function') {
var funcStr = ('' + obj).trim(); var funcStr = ('' + obj).trim();