Is there a way to retrieve an element from inner array in array when using nested lodash find, for example?
I have an array of groups, each element of which has array of children. All children have unique ids (even between groups). I need to get hold of a child with id == value and now I'm doing the following:
Firstly I retrieve needed group:
var group = _(groups).find(g => {return _(g.children).find(c => {return c.id == value})});Then I get the child:
var child = _(group.children).find(c => {return c.id == value});
Is there a more efficient and elegant way to achieve this?