Skip to content
Snippets Groups Projects
Commit 3b57d2d0 authored by mcmlxxix's avatar mcmlxxix
Browse files

added sortListByProperty(list,property) function

parent a02c63fa
No related branches found
No related tags found
No related merge requests found
......@@ -412,10 +412,28 @@ function combine(obj1,obj2,concat_str)
}
return newobj;
}
function compressList(list)
{
var c=[];
for(var l in list)
c.push(list[l]);
return c;
}
function sortListByProperty(list,prop)
{
var data=compressList(list);
var numItems=data.length;
for(n=0; n<numItems; n++) {
for(m=0; m<(numItems-1); m++) {
if(data[m][prop] < data[m+1][prop]) {
var holder = data[m+1];
data[m+1] = data[m];
data[m] = holder;
}
}
}
return data;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment