In my Javascript application I have an Object and I need to be able to order the array by a value within the Inner Object.
For example:
{
a : {
timestamp: xxxxxx
other : yyyyyy
},
b : {
timestamp: xxxxxx
other : yyyyyy
},
c : {
timestamp: xxxxxx
other : yyyyyy
}
}
What I need to do is manage this data set and re-order the array according to the timestamp of each inner object.
What ways are they that I can do to do this?
update:
My initial thought would be doing something like so:
{
a : {},
b : {},
c : {},
_ : [
c, a, b //Key's Only
]
}
Then re-indexing the the object based on those values, that would sort out how to index the object, but when I insert a new element i would also have to regenerate the _
index relationship which seems way to much effort.