I'm trying to check if an array of items contains an object with a specific key value, and if it does, just update the array of items with the new item object
[{name: example1, quantity: 2},{name: example2, quantity: 3},{name: example3, quantity: 5}]
so if for example I'm pushing an object with the same name of "example1", I want to check if it does exist in the array and if it does, just update it with the new object with the new quantity for example.
I tried to explain what I want as best as I can, please let me know if you need more clarification.
nameandquantitykeys? If so, then you should just use a mapping, not an array of objects. If there's more keys in the objects, what would happen to those keys when you merge?