Apparently, they think that you cannot sort out the store because it has “rare” data, but it is not. You can currently do the following.
if(store.buffered) {
store.data.forEach(function(record, recordIdx) {
}, this);
} else {
store.each(function(record) {
}, this);
}
IMPORTANT
Take care that the structure of the store may change in the future, which will probably slow down your code.
In addition, I firmly believe that if the right design patterns were used, I eachhad to take care of the cycle without worrying about the structure.
OPTIMIZATION
What I usually do when I initialize the repository is the following:
if(store.buffered) {
store.iterate = store.data.forEach;
} else {
store.iterate = store.each;
}
:
store.iterate(fn, scope);
, if-