Changed Items.get() to return a regularly indexed array instead of one indexed by itemID--nothing actually used the keyed array, and this way it can be used for building trees directly (e.g. Scholar.Items.get(Scholar.Items.search('barnes')))
This commit is contained in:
parent
b65a56b4d9
commit
c807d335e9
1 changed files with 3 additions and 10 deletions
|
@ -795,7 +795,7 @@ Scholar.Items = new function(){
|
||||||
* Can be passed ids as individual parameters or as an array of ids, or both
|
* Can be passed ids as individual parameters or as an array of ids, or both
|
||||||
*
|
*
|
||||||
* If only one argument and it's an id, return object directly;
|
* If only one argument and it's an id, return object directly;
|
||||||
* otherwise, return array indexed by itemID
|
* otherwise, return array
|
||||||
*/
|
*/
|
||||||
function get(){
|
function get(){
|
||||||
var toLoad = new Array();
|
var toLoad = new Array();
|
||||||
|
@ -828,7 +828,7 @@ Scholar.Items = new function(){
|
||||||
|
|
||||||
// Otherwise, build return array
|
// Otherwise, build return array
|
||||||
for (i=0; i<ids.length; i++){
|
for (i=0; i<ids.length; i++){
|
||||||
loaded[ids[i]] = _items[ids[i]];
|
loaded.push(_items[ids[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return loaded;
|
return loaded;
|
||||||
|
@ -1828,12 +1828,5 @@ Scholar.getItems = function(parent){
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Items.get() returns an array indexed by itemID,
|
return Scholar.Items.get(children)
|
||||||
// so we have to turn it into a regular numeric array from 0
|
|
||||||
var items = Scholar.Items.get(children)
|
|
||||||
for (var i=0, len=children.length; i<len; i++){
|
|
||||||
toReturn.push(items[children[i]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return toReturn;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue