I have some data structure like so: 

```
{
  "category": "Fruits",
  "department": "ABC123",
  "content": {
    "subcategory1": [
      {
        "fruitName": "Apples",
        "inStock": false
      },
      {
        "fruitName": "Pears",
        "inStock": false
      }
    ],
    "subcategory2": [
      {
        "fruitName": "Oranges",
        "inStock": false
      },
      {
        "fruitName": "Lemons",
        "inStock": false
      }
    ]
  }
}

```

I'd like to be able to update the "inStock" value based on some input. I have an array like:

`["Pears", "Oranges"]`

For all instances of the properties in that array, I want to update `inStock` to be `true` to end up: 

```
{
  "category": "Fruits",
  "department": "ABC123",
  "content": {
    "subcategory1": [
      {
        "fruitName": "Apples",
        "inStock": false
      },
      {
        "fruitName": "Pears",
        "inStock": true
      }
    ],
    "subcategory2": [
      {
        "fruitName": "Oranges",
        "inStock": true
      },
      {
        "fruitName": "Lemons",
        "inStock": false
      }
    ]
  }
}

```

I'd like to write some generic function for that, so that I can do something like `const newData = updateStock( oldData );`. However I'm not sure how to start writing this. If I could get some pointers for starting (even if not a solution) I would be very thankful.