I have an array that looks like this:
[{
name: 'foobar',
fields: [{
label: 'argle'
},{
label: 'bargle'
}]
},{
name: 'baz',
fields: [{
label: 'rar'
},{
label: 'hoogah'
}]
}]
I'm looking for the index of the object which has a field matching label === 'rar', so I can update that particular field. Is there an optimum way to accomplish this? I know indexOf won't get me there by itself, but I'm struggling with the logic.