I am trying to convert this array to an object. Using underscore, I want to convert this array :
[
{
    "id": "parentA",
    "children": [
        {
            "name": "name1"
        },
        {
            "name": "name2"
        },
        {
            "name": "name3"
        }
    ]
},
{
    "id": "parentB",
    "children": [
        {
            "name": "name4"
        },
        {
            "name": "name5"
        },
        {
            "name": "name6"
        }
    ]
}]
into an object that looks like this:
{
    "name1": "parentA",
    "name2": "parentA",
    "name3": "parentA",
    "name4": "parentB",
    "name5": "parentB",
    "name6": "parentB"
}
I'm really just looking for the cleanest/simplest way possible.
 
                        
Here's a fairly short way to do it with two
reduce: