First object is a map (with 1 element only for make it simple):
let dataMap = {
Feed: "data",
};
I need to assign those key values to separated path:
Object.keys(dataMap).forEach((value) => {
struct[value] = Object.assign({}, struct[value], {
"State": obj.Digital[dataMap[value]].State,
});
});
console.log(struct);
Now the result looks something like this:
struct: {
Feed: {
State: "xy"
}
}
What I would like to do, is to change the Feed key to Feed.next. So it would look like:
struct: {
Feed: {
next: {
State: "xy"
}
}
}
Please note that struct.Feed does exist already from the beginning, so this is not created with the code above. My question is how should I write the dataMap object to achieve the structure above?
Is it like (it is not working):
let dataMap = {
Feed[next]: "data",
};
Thank you,