Not sure if there's any lodash or other util method to map object sequence. I have this case where I have to manually reorder the order of bunch of nested objects.
//unprocessed
{
"order": [
"home",
"work"
],
"questions": {
"US": {
"work": "working",
"home": "driving home"
},
"UK": {
"work": "go to work",
"home": "go to home"
}
}
}
How can I map questions's object's object's answer base on order's value. The processed output should be
{
"questions": {
"US": {
"home": "driving home",
"work": "working"
},
"UK": {
"home": "go to home",
"work": "go to work"
}
}
}