I have variable that defines the order of objects like this:
const order = ['large', 'medium', 'small'];
I want to match that order of data array objects using names from order array:
const data = [{name: "small", children: []}, {name: "medium", children: []}, {name: "large", children: []}]
so the effect should be following:
const data = [{name: "large", children: []}, {name: "medium", children: []}, {name: "small", children: []}]
How can I achieve this ?