Arrays are more appropriate here than strings.
This commit is contained in:
parent
8f0ec95e73
commit
7b5d7bccf8
1 changed files with 3 additions and 3 deletions
|
@ -1039,7 +1039,7 @@ Zotero.Utilities = {
|
||||||
//initialise at first itteration
|
//initialise at first itteration
|
||||||
if(!parentObjects) {
|
if(!parentObjects) {
|
||||||
parentObjects = [arr];
|
parentObjects = [arr];
|
||||||
path = '__ROOT__';
|
path = ['ROOT'];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var item in arr) {
|
for (var item in arr) {
|
||||||
|
@ -1049,7 +1049,7 @@ Zotero.Utilities = {
|
||||||
//check for recursion
|
//check for recursion
|
||||||
var i = parentObjects.indexOf(value);
|
var i = parentObjects.indexOf(value);
|
||||||
if(i != -1) {
|
if(i != -1) {
|
||||||
var parentName = path.split('->').slice(0,i+1).join('->');
|
var parentName = path.slice(0,i+1).join('->');
|
||||||
dumped_text += level_padding + "'" + item + "' => <<Reference to parent object " + parentName + " >>\n";
|
dumped_text += level_padding + "'" + item + "' => <<Reference to parent object " + parentName + " >>\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1064,7 +1064,7 @@ Zotero.Utilities = {
|
||||||
dumped_text += level_padding + "'" + item + "' => " + openBrace;
|
dumped_text += level_padding + "'" + item + "' => " + openBrace;
|
||||||
//only recurse if there's anything in the object, purely cosmetical
|
//only recurse if there's anything in the object, purely cosmetical
|
||||||
for(var i in value) {
|
for(var i in value) {
|
||||||
dumped_text += "\n" + arguments.callee(value,level+1,maxLevel,parentObjects.concat(value),path + '->' + item) + level_padding;
|
dumped_text += "\n" + arguments.callee(value,level+1,maxLevel,parentObjects.concat([value]),path.concat([item])) + level_padding;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dumped_text += closeBrace + "\n";
|
dumped_text += closeBrace + "\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue