I'm trying to switch the value of `selected` from whatever it currently is (true or false) to the opposite when a user clicks on a checkbox. My `toggleCheck` function is supposed to return all data with the altered select value. Here's the data structure. It's an object with arrays that have objects.

```json
{
    "ModuleName": [{
            "module": "string",
            "selected": false,
            "name": "title",
            "points": [{
                    "category": "category1",
                    "description": "desc1",
                    "provided": "provided1"
                },
                {
                    "category": "category1",
                    "description": "desc",
                    "provided": "something"
                }
            ]
        },
        {
            "module": "string",
            "selected": false,
            "name": "title_one",
            "points": [{
                    "category": "category1",
                    "description": "desc1",
                    "provided": "provided1"
                },
                {
                    "category": "category1",
                    "description": "desc",
                    "provided": "something"
                }
            ]
        }
    ],
    [...],
    [...]
}

```

My closest attempt but it's the wrong format

```js
function toggleCheck(checkedValue, valuesArr) {
    return {
        value: Object.entries(valuesArr).map(([key, values], i) =>
            values.map((x) => {
                return {
                    ...x,
                    selected:
                        x.name === checkedValue.name ? !x.selected : x.selected,
                };
            })
        ),
    };
}

```

probably cause I used a map it wrapped it in an array

```json
[
   [ 
      {},
      {},
      {}
   ],
   [...],
   [...]
]

```

^^^ What I got

```json
{
    "Name": [  {},
               {},
               {}
            ],
    "Name": [...],
    "Name": [...]
}

```

^^^ What I need