iam trying to create a list of products varinats from a list of selected options and options values i have data looks like this :
[
{
option: "size",
selected_values: [{id: 1, value: "XL"}, {id: 2, value: "M"}]
},
{
option: "color",
selected_values: [{id: 14, value: "Red"}, {id: 15, value: "Blue"}]
}
]
and from this data i want t create somthing like this :
[
{
varint_name: "XL Red",
selected_values: [1, 14]
},
{
varint_name: "XL Blue",
selected_values: [1, 15]
},
{
varint_name: "M Red",
selected_values: [2, 14]
},
{
varint_name: "M Blue",
selected_values: [3, 15]
}
]
taking into considration that the list of selected options and options values (first list) can be more than two objects its binded to a from so can be more or less iam using vue btw and i know that the list i want should be a computed value but i want to know the logic to genrate the desired shape of list