diff --git a/inc/myco_objects.js b/inc/myco_objects.js index 8ed0340..c05b51f 100644 --- a/inc/myco_objects.js +++ b/inc/myco_objects.js @@ -28,13 +28,9 @@ function GroupList() { } this.export=function() { - ret={}; - for (el in this) { - if (this.isGroup(this[el])) { - ret[el]=this[el].export(); - } - } - return ret; + return this.each(function(idx,group) { + return group.export(); + }); } this.import=function(groups) { @@ -60,18 +56,20 @@ function GroupList() { this.each=function(fct) { var idx=0; + var ret={}; for (el in this) { if(this.isGroup(this[el])) { - fct(idx++,this[el]); + ret[el]=fct(idx++,this[el]); } } + return ret; } this.count=function() { len=0; - for (el in this) { - if (this.isGroup(this[el])) len=len+1; - } + this.each(function(idx,group) { + len=len+1; + }); return len; }