I don't know why, but sorting is one of the things by programming that confuses me every time...
I want to sort the array members on the first level so, that all members with the properties licence: "truck" and active: true are at first in the list. Then the next members should be all members with licence: "car" and active: true
underscore.js is avaiable...
[
{
name: 'Denes',
properties: [
{
licence: "car",
active: true
},
{
licence: "truck",
active: false
},
]
},
{
name: 'Patrick',
properties: [
{
licence: "car",
active: false
},
{
licence: "truck",
active: true
},
]
},
{
name: 'Marc',
properties: [
{
licence: "car",
active: false
},
{
licence: "truck",
active: false
},
]
}
]
Expected result:
[
{
name: 'Patrick',
properties: [
{
licence: "car",
active: false
},
{
licence: "truck",
active: true
},
]
},
{
name: 'Denes',
properties: [
{
licence: "car",
active: true
},
{
licence: "truck",
active: false
},
]
},
{
name: 'Marc',
properties: [
{
licence: "car",
active: false
},
{
licence: "truck",
active: false
},
]
}
]