What is the optimal method to transform ... ?
const obj = {
A: { B: [0, 0, 0, 0] },
D: {
B: [0, 0, 0, 0],
C: [0, 0, 0, 0]
}
}
into
const obj = {
"A - B": [0, 0, 0, 0],
"D - B": [0, 0, 0, 0],
"D - C": [0, 0, 0, 0]
}
Thank you for your consideration
Edit: I apologize. I have corrected the question. It is required for all pairs in a nested object. The depth remains constant