var collection = {
'key1': [
{ 'uuid': '123', 'a': 'a' },
{ 'uuid': '456', 'b': 'b',
'randomKeyValue': [
{ 'uuid': '349', 'd': 'd' }
]
}
],
'key2': [
{ 'uuid': '890', 'c': 'c' }
]
}
Using _.find(collection, { 'uuid': '349' })
will return undefined.
How to find the hash that has uuid == 349
?
The expected return of the find is: { 'uuid': '349', 'd': 'd' }
Must be written with ES5 standards and must use Lodash.
It's fairly straightforward using plain js