I have this array of objects, (of course it's actually much longer), and I would like to sort it based on the uid properties by first grouping all the uids that have the X, and then the ones that only have the "number" (or on the contrary, it is the same, but the important thing is that they are grouped => all "X" and all "NOT X". It does not matter that they are also sorted).
[
{ id: 114, iid: {uid: "12", xe: 9 }, foo: 123, },
{ id: 120, xid: {uid: "X-12", xe: 9 }, foo: 123, },
{ id: 133, iid: {uid: "31", xe: 9 }, foo: 123, },
{ id: 120, xid: {uid: "X-41", xe: 9 }, foo: 123, },
//And many others....
]
So it should become something like:
[
{ id: 120, xid: {uid: "X-41", xe: 9 }, foo: 123, }
{ id: 120, xid: {uid: "X-12", xe: 9 }, foo: 123, },
{ id: 133, iid: {uid: "31", xe: 9 }, foo: 123, },
{ id: 114, iid: {uid: "12", xe: 9 }, foo: 123, },
//And many others....
]