I am working with an array that contains prefix values
["options_a",
"options_b",
"options_c",
"capable_d",
"capable_e_c"
]
I am looking for a way to transform this array into an object format with the prefix as the key and the grouped split string as the value
The desired output format is:
{
"options":["a","b","c"],
"capable":["d","e_c"]
}
I understand that this can be achieved with a normal for loop, but I am wondering if there is a more simplified way using ES6 functionality.
Any suggestions would be greatly appreciated.