Benjamin Renard commited on 2014-01-12 19:08:27
Showing 1 changed files, with 9 additions and 11 deletions.
| ... | ... |
@@ -28,13 +28,9 @@ function GroupList() {
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
this.export=function() {
|
| 31 |
- ret={};
|
|
| 32 |
- for (el in this) {
|
|
| 33 |
- if (this.isGroup(this[el])) {
|
|
| 34 |
- ret[el]=this[el].export(); |
|
| 35 |
- } |
|
| 36 |
- } |
|
| 37 |
- return ret; |
|
| 31 |
+ return this.each(function(idx,group) {
|
|
| 32 |
+ return group.export(); |
|
| 33 |
+ }); |
|
| 38 | 34 |
} |
| 39 | 35 |
|
| 40 | 36 |
this.import=function(groups) {
|
| ... | ... |
@@ -60,18 +56,20 @@ function GroupList() {
|
| 60 | 56 |
|
| 61 | 57 |
this.each=function(fct) {
|
| 62 | 58 |
var idx=0; |
| 59 |
+ var ret={};
|
|
| 63 | 60 |
for (el in this) {
|
| 64 | 61 |
if(this.isGroup(this[el])) {
|
| 65 |
- fct(idx++,this[el]); |
|
| 62 |
+ ret[el]=fct(idx++,this[el]); |
|
| 66 | 63 |
} |
| 67 | 64 |
} |
| 65 |
+ return ret; |
|
| 68 | 66 |
} |
| 69 | 67 |
|
| 70 | 68 |
this.count=function() {
|
| 71 | 69 |
len=0; |
| 72 |
- for (el in this) {
|
|
| 73 |
- if (this.isGroup(this[el])) len=len+1; |
|
| 74 |
- } |
|
| 70 |
+ this.each(function(idx,group) {
|
|
| 71 |
+ len=len+1; |
|
| 72 |
+ }); |
|
| 75 | 73 |
return len; |
| 76 | 74 |
} |
| 77 | 75 |
|
| 78 | 76 |