I have a collection of data that looks like this:
const data = {
5c80dd171d9e7b3755911818: {
"_id": "5c80dd171d9e7b3755911818",
"created_at": "2019-03-07T08:25:11.323Z",
"description": ""
}
5c80dd1b1d9e7b3755911819: {
"_id": "5c80dd1b1d9e7b3755911819",
"created_at": "2019-03-07T08:24:11.323Z",
"description": ""
}
5c80dd231d9e7b375591181a: {
"_id": "5c80dd231d9e7b375591181a",
"created_at": "2019-03-07T08:27:11.323Z",
"description": ""
}
}
I've been trying to transform data to an array, sort items inside and then using _keyBy from loadash to create collection once again - but it returns object in mixed order.
Is there a way that I can sort this collection by the created_at
value inside an object and get back the same collection and not an array, but sorted ??